I'm trying to figure out how to merge branches from a separate repo into the current.
I have the following:
PJT1 - contains branches default and foodog
PJT2 - contains branch default
from PJT2, I do the following:
$ hg fetch -y ../PJT1 -r foodog -m "this is a test"
Now, if I look in PJT2, I see the correct files and changes. However, I if I do hg branches
, I get the following:
[someone@myhome pjt2]$ hg branches
foodog 1:c1e14fde816b
default 0:7b1adb938f71 (inactive)
and hg branch
reveals the following:
[someone@myhome pjt2]$ hg branch
foodog
How do I get the contents from PJT1's foodog
branch into PJT2's default
branch?
You need to merge, but keep in mind changes on branch foodog will always be on foodog -- branches never go away but they can be hidden. This sequence of commands is as close as you'll get to what you're asking:
After the merge
hg branches
will still showfoodog
unless you dohg branches --active
which only shows branches that have heads on them. After thecommit --close-branch
you won't seefoodog
unless you dohg branches --closed
.It's because branches in Mercurial never go away entirely (a design feature) that they're often reserved only for life-long things like
release-1.0
orstable
. For short-lived efforts like bugs and features consider using bookmarks instead. Here's a great comparison of the two: http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurialYou could also try using the rebase extension. It would look something like this:
The rebase action will detatch changeset sRev and all descendents and apply the group of changes to changeset dRev. By default, the changes will be applied on the default branch. So, in your case, sRev would be the first changeset on branch foodog and dRev would be the default changeset you want to apply them to.
Finally, If you want to override this and preserve the source branch name you can use rebase option
--keepbranches
. Your questions indicates that this is exactly what you do not want to do, but it should still be noted.