Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Mercurial #6

Open
MaksSlesarenko opened this issue Dec 2, 2013 · 30 comments
Open

Add support for Mercurial #6

MaksSlesarenko opened this issue Dec 2, 2013 · 30 comments
Assignees

Comments

@MaksSlesarenko
Copy link

No description provided.

@ghost ghost assigned meriouma Dec 2, 2013
@meriouma
Copy link
Member

meriouma commented Dec 2, 2013

Are you using the latest version? Also, be sure to add +:refs/heads/* in Branch specification of your VCS root.
This bug was found and fixed in the last version, but it requires the branch specification to be able to find the commits.

Thank you!

@MaksSlesarenko
Copy link
Author

It triggers on pull-request but says no changes.

TeamCity 8.0.5
plugin from build #13 http://teamcity.arcbees.com/repository/download/TeamCityPlugins_CompileMaster/710:id/bitbucket/target/bitbucket.zip

@meriouma
Copy link
Member

meriouma commented Dec 3, 2013

Did you install a previous version of the plugin, then updated to the new one?

@meriouma
Copy link
Member

meriouma commented Dec 3, 2013

If it's not the first build on the branch, it might show that there's no change (since the last build)

@MaksSlesarenko
Copy link
Author

The plugin was not updated.
I see in build agent work directory that the code was checkouted from main branch without changes from PR.

@meriouma
Copy link
Member

meriouma commented Dec 4, 2013

The thing is that we had that bug in the past, and fixed it with the latest version.

What is the version number shown for the plugin on the page : {yourTeamCityServer}/admin/admin.html?item=plugins

@MaksSlesarenko
Copy link
Author

@meriouma
Copy link
Member

meriouma commented Dec 5, 2013

I'm out of ideas here. The plugin works on our TeamCity server and I've had another person that reported the bug you are experiencing, but the last version fixed it and it works fine for him too. Do you have anything relevant in your log files?

@MaksSlesarenko
Copy link
Author

Can you give any tips what to look for?

@seif
Copy link

seif commented Dec 6, 2013

I ran into such an issue when my branch spec didn't match what the plugin was passing.

Try manually triggering a build, selecting a branch to run build from and then look at what teamcity has in the build history for the branch name. That match what the bitbucket plugin is passing (I think you can see what that is by looking at one of the builds triggered by it)

@MaksSlesarenko
Copy link
Author

Does this plugin support mercurial? As I understand +:refs/heads/* doesn't make much sense for hg.

@meriouma
Copy link
Member

Ah that's a good point, the plugin was only tested with git. I'm not sure what's the branch specification for mercurial.. Maybe you can try +:* ?

@MaksSlesarenko
Copy link
Author

As I understand branch is not created on pull request in mercurial. You need to checkout upstream branch and than do

hg import https://bitbucket.org/!api/2.0/repositories/COMPANY/PROJECT/pullrequests/REQUEST_ID/diff

@meriouma
Copy link
Member

In bitbucket, a branch is not created for git pull requests either. The plugin uses the bitbucket REST API to find the pull requests, not the VCS.
What the branch specification does is gather information on branches so the plugin can find the commits.

@meriouma
Copy link
Member

@MaksSlesarenko
Copy link
Author

I've already tried +:* with no luck. As I understand from what you said above, wrong branch specification can result than commits are not displayed at TeamCity's build page. But my source code does not have changes from PR, that means that hg import was not executed.

@meriouma
Copy link
Member

Can you try +:* and wait for the next PR to open?

@MaksSlesarenko
Copy link
Author

I have set branch to default branch specification to +:*

if I create a pull request within my repository from develop to default than develop branch gets a build
if I create a pull request from fork default to main default than default is built, no patches applied
if I create a pull request from fork develop to main default than develop is built, no patches applied

@MaksSlesarenko
Copy link
Author

I agent's build log there is comments that patch was applied http://pastebin.com/qHQsS5Vc

@MaksSlesarenko
Copy link
Author

teamcity-activities.log http://pastebin.com/ZUqr3qN8

@meriouma
Copy link
Member

Thank you for those tests. So if I understand, your first PR from a branch to another triggered the build with the correct changes? But the PR from a fork didnt?

@MaksSlesarenko
Copy link
Author

In first case default should have been built + patch from develop, instead develop itself was built.

Also in build logs I have such thing

teamcity.build.branch=develop
vcsroot.branchName=default

From what I see now branch specification +:* just overrides specified branch name

@meriouma
Copy link
Member

The first case is the expected result, as develop contains default + your changes. For forks, I must say that I don't think it's supported. There's no way teamcity knows about the forks, because the VCS root doesn't include them

@MaksSlesarenko
Copy link
Author

The first case is the expected result, as develop contains default + your changes

But TeamCity labled it as a develop branch build

For forks, I must say that I don't think it's supported. There's no way teamcity knows about the forks, because the VCS root doesn't include them

Actually it knows, otherwise build would not be triggered on pull request from fork.

In any case, can your plugin export parameter with PULL_REQUEST_ID to Ant or do you know a way I can get it in Ant from TeamCity? This will do the job for me.

@meriouma
Copy link
Member

The reason it's labeled develop is that you want develop to be compiled when you ask for a PR from develop to default, as develop is the branch containing the new changes and is the branch you want to test to be sure it doesn't break anything, not default. I might be missing something about your use case though.

As for the parameter, I can look on what's possible with TeamCity to pass to the build

@MaksSlesarenko
Copy link
Author

As I understand your in your plugin gets changeset number from api and calls setChangeset(CHANGESET_ID) and then git implicitly changes branch to pull request, because pull requests are stored within same repository in git. But this approach does not work for mercurial. Maybe you can use https://bitbucket.org/aragost/javahg/ to import patch that is provided by bitbucket api to project working copy in build agent?

@olafleur
Copy link
Member

Is this issue still relevant?

@meriouma
Copy link
Member

Yes it is

@meriouma meriouma changed the title plugin does checkout from main branch without adding changes from pull request Add support for Mercurial Jul 10, 2014
@scottaubrey
Copy link

Any idea on when you might work on this? I'm keen to get a pull-request setup on mercurial/bitbucket combo, and there are so little tools supporting this. I had thought my salvation was here, but alas, it doesn't work.

I'm not a Java developer, so I did clone the repo, but very quickly got lost in how to map the links that come back from bitbucket using gson.

Could even exporting the pull request ID into the TeamCity Env variables be the place to start? Then the first build step can download the patch (PullRequest.links.patch) and apply it?

@meriouma
Copy link
Member

Sorry for the delays. We are not using mercurial at the moment so it's hard to tell when we'll implement this feature. If anyone wants to contribute this, pull requests are more than welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants