Bug 3667 - commit during graft conflict creates a merge
Summary: commit during graft conflict creates a merge
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: earlier
Hardware: All All
: normal bug
Assignee: Bugzilla
URL:
Keywords: easy
: 3800 3947 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-10-20 15:35 UTC by Matt Mackall
Modified: 2017-11-01 18:05 UTC (History)
9 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Mackall 2012-10-20 15:35 UTC
If you do a graft that stops for conflict resolution, the working dir has two parents. Committing the result rather than 'graft -c' thus creates an undesirable merge.

Ideally, graft would leave the working directory in a state where commit generates an ok commit (despite losing the original changeset's metadata).
This turns out to be complicated, because the resolve command needs to see the second parent to do its job.

Alternately, commit should refuse to work if a graft's in progress. This would probably require adding an --abort flag to back out of a graft.
Comment 1 Antoine Pitrou 2013-01-01 02:02 UTC
Ok, so this issue occurred to me on CPython and we now have a broken branch ancestry in our history. See issue3748 for the symptoms.
Comment 2 Antoine Pitrou 2013-01-01 02:19 UTC
> Ideally, graft would leave the working directory in a state where commit
> generates an ok commit (despite losing the original changeset's metadata).

Why would it lose the original changeset's metadata? If "graft -c" is able to retrieve that data, surely "commit" can retrieve it too?

> Alternately, commit should refuse to work if a graft's in progress.

If "commit" can't work as "graft -c", then IMHO this solution would be best.
Comment 3 Matt Mackall 2013-05-28 12:01 UTC
*** Bug 3947 has been marked as a duplicate of this bug. ***
Comment 4 Matt Mackall 2013-05-28 12:01 UTC
*** Bug 3800 has been marked as a duplicate of this bug. ***
Comment 5 Martin Janicek 2013-05-29 04:55 UTC
Just want to inform, is there a plan to fix this any time soon? This is actually one thing that is blocking most of the people in my team to use graft over the transplant as the results might be dangerous.
It would be definitely fine and valid if the commit would just refuse to work with proper message.
Comment 6 Matt Mackall 2013-05-29 14:27 UTC
Marking this easy. Someone who's never looked at the source could fix this in an afternoon (hint hint).
Comment 7 HG Bot 2013-06-01 18:15 UTC
Fixed by http://selenic.com/repo/hg/rev/e078ea9b4ce4
Simon King <simon@simonking.org.uk>
graft: refuse to commit an interrupted graft (issue3667)

(please test the fix)