[more experimients] (was: single-file-merge?)

Becker, Mischa J mischa.becker at kroger.com
Wed Oct 25 20:50:56 UTC 2023


From: Uwe Brauer
Sent: Wednesday, October 25, 2023 12:16 AM
Subject: [more experimients] (was: single-file-merge?)
>
> > 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.
>
>
> I tried the following
> hg init
> echo "First" > test.org
> hg add test.org
> hg commit  -m "0: First"
> echo "Second" >> test.org
> hg commit  -m "1: Second"
> echo "Third" >> test.org
> hg commit  -m "2: Third"
> echo "Forth" >> test.org
> hg commit  -m "3: BUG Fourth"
> hg up -r 1
> hg branch meta
> echo "new stuff" >> meta.org
> hg add meta.org
> hg commit -m "Add meta.org to the meta branch"
> echo "Fifth" >> test.org
> hg commit  -m "4: Fifth"
> hg up default
> echo "Six" >> test.org
> hg commit  -m "5: Six"
> hg merge  meta --tool internal:other
> hg revert --all -r default
> hg revert test.org -r meta
> hg commit -m "Single file merge: test.org"
> echo "Seven" >> test.org
> hg commit  -m "6: Seven"
> hg up meta
> hg merge default --tool internal:other
> hg revert --all -r meta
> hg revert test.org -r default
> hg commit -m "Single file merge: test.org"
>
>
> And it did what I expected.

You're right. As long as you remember to repeat your 'Single file merge' back from default into meta before you do a regular merge from default to meta, later regular merges won't result in losing the current contents of meta. My problem was I'd do a regular merge forgetting I hadn't yet done that 2nd special merge and my code was intermingled enough that it wasn't as obvious as a missing file that I'd lost my changes in the 2nd branch.

The only other thing I'd point out is your test example doesn't give you the same result as using graft because you aren't actually merging your single file, you're replacing it.  If it was your intent to replace all changes to test.org in default great. But if you only intended to replace the bugged Forth change and forgot you also had a Third and Six change...

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