[ https://issues.jenkins-ci.org/browse/JENKINS-10558?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=162226#comment-162226 ]
jglick commented on JENKINS-10558: ---------------------------------- http://mercurial.selenic.com/wiki/Bookmarks is the current feature description. Since it makes no sense to specify both a branch name and a bookmark, probably the UI should be a checkbox that indicates that the "branch" field is really a bookmark name. (It would be great if the plugin could automatically detect this, but I doubt that is possible.) Pull requests implementing this feature without affecting existing usage would be considered. (Wujek's change may make subtle changes to behavior of jobs not using bookmarks; the use of {{\--rev}} rather than {{\--branch}} is intentional. It also includes no new tests, is long out of date with {{master}}, and does not seem to be available as a pull request anyway.) > Jenkins mercurial plugin - add support for bookmarks > ---------------------------------------------------- > > Key: JENKINS-10558 > URL: https://issues.jenkins-ci.org/browse/JENKINS-10558 > Project: Jenkins > Issue Type: New Feature > Components: mercurial > Affects Versions: current > Environment: all > Reporter: wujek srujek > Assignee: Kohsuke Kawaguchi > Priority: Critical > > Mercurial plugin supports branches, which is nice. However, there are a lot > of people, especially these coming from git, who think that such named > branches are no good (they stay for ever, the branch is baked into the > commit), and prefer using bookmarks* instead. There seems to be a lot of > momentum around that extension, which culminated in it being incorporated > into mercurial core since hg 1.8 (which means it is not an extension any > more; rather, it is a first-class citizen now). > * http://mercurial.selenic.com/wiki/BookmarksExtension, > http://www.mronge.com/2009/04/01/a-sample-mercurial-bookmark-workflow, > http://groups.google.com/group/mercurial_general/browse_thread/thread/5f7d2d7c5cfc109b?fwc=2 > (post #4 by Daniel Carrera is really good) > Bookmarks is the closest thing that mercurial currently supports that > resembles git-like branches. This is what we would love to use (as we share > the view that such long running named branches are no good), but we can't > since the Jenkins plugin doesn't support this (we would like to create ad-hoc > Jenkins jobs for our features (topic branches), which are bookmarks, not > branches, and once the feature is implemented, we drop the Jenkins job). > A basic bookmarks workflow (in a repository): > $ hg bookmark feature_x > ... work work work > $ hg commit -m 'some feature_x code' > ... push to some canonical repo for others to see > $ hg push -B feature_x -f // -f most likely needed as bookmarks are simply > 'named heads' - but it doesn't matter for Jenkins > Now some other collaborator: > $ hg incoming -B // shows that there is a new bookmark, 'feature_x' > $ hg pull -B feature_x > and they can now start working on this bookmark ('lightweight branch'). > I tried simply changing the value of the 'branch' field in my project > configuration, but it doesn't work. But it is very close. What seems not to > work is the fact that Jenkins doesn't know the '-B' switch, and doesn't know > that I want to import the bookmark. What Jenkins does is this (shortened a > little, the template is not used): > $ hg incoming --quiet --bundle hg.bundle --template "..." --rev feature_x > $ hg unbundle hg.bundle > adding changesets > adding manifests > adding file changes > added 1 changesets with 1 changes to 1 files (+1 heads) > (run 'hg heads' to see heads, 'hg merge' to merge) > $ hg update --clean --rev feature_x > abort: unknown revision 'test'! > This means that the incoming changes were found with the bookmark name and > were pulled, but the bookmark itself wasn't imported, and doesn't exist > locally - and update fails. With the '-B' switch, it would work fine (tested > on the command line): > $ hg incoming --quiet --bundle hg.bundle --template "..." --rev feature_x > $ hg unbundle hg.bundle > adding changesets > adding manifests > adding file changes > added 1 changesets with 1 changes to 1 files (+1 heads) > (run 'hg heads' to see heads, 'hg merge' to merge) > $ hg pull -B feature_x // <----------------------------- that's the missing > link > no changes found > importing bookmark test > $ hg update --clean --rev feature_x > 1 files updated, 0 files merged, 0 files removed, 0 files unresolved > With the single call to pull the bookmark (which effectively imports it) > makes it work! > Of course, there could be a mix of branch and bookmark, so the 'incoming' > should use the branch name, and if and only if a bookmark is specified, a > 'pull -B <bookmark_name>' should be issued, and the update should use the > bookmark and not the branch. This means there should be some additional field > for the bookmark, and some additional logic, but not that much, I think? > I will take a look at the source code on GitHub to see if maybe I could help > you with that, if you are interested? > I as setting it as critical, as it has the potential to influence the > decision whether we can use Jenkins or not for this project. Naturally, you > are the bosses so feel free to squash it. > As a side note: what is the relationship between the Jenkins Mercurial Plugin > (version 1.37, code on GitHub) and Hudson Mercurial Plugin (version 1.35, > couldn't find a repository)? I am asking since we use both, and it would be > nice if the code could be written once and work for both servers, of course ;d > Regards, > wujek -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jenkins-ci.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira