single-file-merge?
Becker, Mischa J
mischa.becker at kroger.com
Tue Oct 24 18:34:28 UTC 2023
> From: Uwe Brauer
> Sent: Tuesday, October 24, 2023 5:54 AM
> To: Mercurial List <mercurial at mercurial-scm.org>
> Subject: single-file-merge?
>
> ** [EXTERNAL EMAIL]: Do not click links or open attachments unless you
> recognize the sender and know the content is safe. **
>
> Hi all
>
> I have two branches
>
> 1. default
> 2. meta: which contains more files I don't want to have on the
> default branch.
>
>
> I edit one file frequently that is on both branches. Then after
> committing, I want always that all changes appear in the file in both
> branches.
>
> So say I finished an edit and commit on meta, I then do
>
> hg up default
> hg revert common-file.tex -r meta
>
> That is ok, but the graph of course does not display it, because there was
> no merge.
>
> So I thought of doing a single-file-merge.
>
> And did:
>
> hg up default
> hg merge meta --tool internal:other
> hg revert --all default
> hg revert common-file.tex meta
> hg commit -m "A single-file merge with common-file.tex"
>
> Any comments?
I'm pretty sure all those file changes you threw away in the merge from meta to default will get stripped from meta if you later merge default back into meta.
When I need changes made in another branch pulled into default without everything else in the branch I use hg graft. Graft merges over just the specific commit(s) you've selected, not the whole branch. As long as the changes you want to pull into default are in their own commits, doing this with graft is quite easy.
I'm not sure how grafted commits look in the console but in TortoiseHg grafts are shown with a dashed line while merges and regular commits are shown with a solid line. Graft also adds to the commit message telling you where the commit was grafted from.
Mischa
________________________________
This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is confidential and protected by law from unauthorized disclosure. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
More information about the Mercurial
mailing list