Reputation: 5202
I am working in branch Feature
and another developer has finished merging his branch Feature2
with Default
. I would like to simply pull one of the files from the now default branch to my branch, before merging my feature (as it is not complete yet).
Upvotes: 0
Views: 228
Reputation: 1131
graft (Hg v2.0.2) allows you selectively copy changes from other branches onto the current branch.
hg graft [OPTION]... REVISION...
This command uses Mercurial's merge logic to copy individual changes from
other branches without merging branches in the history graph. This is
sometimes known as 'backporting' or 'cherry-picking'. By default, graft
will copy user, date, and description from the source changesets.
Upvotes: 1
Reputation: 78330
Mercurial works in changesets, not files, so you can't use traditional pull/push to do this.
You can use:
hg cat -r Feature2 path/to/thefile > path/to/thefile
to get a copy of the modified file. Or use:
hg revert -r Feature2 path/to/thefile
which does the same thing. You could also 'export' and 'import' using -I to include only that file, but there's no benefit in creating a new single-file changeset.
When later you merge into Default the identical files will merge cleanly.
Upvotes: 4