1
votes

I have a mercurial repo with a rather tangled branch/merge structure. Certain branches contain local customizations that should not be be pushed to the main repo, but some changesets from such branches may have been merged into default and/or some feature branches that should be pushed.

Before I push the revisions of a particular branch, I would like to know which other branches, if any, have contributed changesets that will be pulled along. Example:

feature1 ... o--o--o---o--o--o--o
              \       /    
config         x--x--x--x

If I push the branch feature1, it will also pull along three changesets from branch config. I can use hg outgoing -b branchname destination_repo to preview the changesets that will be pushed, but there are a lot of changesets and a lot of branches to push. Is there a way to get just a list of the branches that will contribute ancestor changesets, or just the affected changesets that do not belong to the named branch I specified?

2

2 Answers

1
votes

Simply template the output of hg outgoing to (only) provide the info you need:

hg outgoing -T"{rev}: {branch}\n"

or if you have bash, squash it down to a list of branches (tail is required as we want to ignore the lines which state which repo ist being compared to and that it is searching for changes):

hg outgoing -T"{branch}\n" | tail -n+3 | sort -u

The same will work with hg incoming. If you only want to pull (or push) a certain revision, give the desired revision explicitly by means of the --rev XXX or --branch BBB argument.

-1
votes

You can use Tortoise hg https://tortoisehg.bitbucket.io/ to deal with such things. Switch to a particular branch and push the changes done to specific branch in which you wish to commit.


If you are doing such thing on a unix machine then

hg shelve --all --name "UnfinishedChanges"

hg update [-c] [-C] [-d DATE] [[-r] REV]

aliases: up, checkout, co

update working directory (or switch revisions)

hg unshelve --name "UnfinishedChanges"

And at last commit and pust only required changes. It will push the feature only in the required branch where you have updated your working directory.