I'm toying with the idea of adding a "remote-run (personal build) for Mercurial" ability in the TeamCity Visual Stuio plugin.
Since v6.5, TeamCity supports a "remote run branch trigger", where if a named branch matching the trigger in TeamCity is pushed, TeamCity will run a personal build of that branch.
The idea is taking the current outgoing changeset(s) from the current branch (let's say default
), and moving them to a temporary named branch called remote-run
. This is then pushed to the CI, so the personal build gets triggered, and if the personal build is successful, changes are moved back to the original branch, and the remote-run
branch is deleted.
I have a few questions regarding this:
The scenario I'm currently targeting is as follows: while working on the default branch, user adds 3 new revisions. He then wants to run those changes as a personal build on TeamCity, but he forgot to commit those revisions to a specially named branch. Instead, my addin will take those outgoing changes, and put them in the named branch. Once the personal build succeeds, those changes are then placed back in the original (default) branch, and pushed to the remote repository.
Something like this:
[default] A---B---C---D
Assuming B
, C
and D
are the new revisions, I want the tool to do:
[default] A
\
[remote-run] B---C---D
And after it's done, return it to the original state, i.e.:
[default] A---B---C---D
EDIT: I managed to move the changes to another branch with Mq, this ended up being very easy. Unfortunately, I have no idea how to revert this change :)
Hope this makes sense!
That is exactly what 'hg rebase' command for. In your case use
hg rebase -s B -d A --detach
Make sure you use the latest version (latest night build). Recently a bug had been fixed that can affect this specified situation. Also, 'rebase' extension must be enabled for this to work. Make sure yo have following line in ~/.hgrc (or mercurial.ini) file:
[extensions]
rebase =
EDIT: It seems I answered an opposite question (how to remove a local branch). To create a new named branch and import B,C,D revisions into it you'll need following sequence of commands:
hg qimport -r tip:B #Revisions B,C,D will be imported into mq
#(here B is revision id of the "B" commit)
hg qpop --all #Unapply all patches
hg branch remote-run #Create a new branch
hg qpush --all #Push patches into the new branch
hg qfinish -a #Transform applied patches to regular commits