Reputation: 14740
I work in Mercurial and I recently pushed a few changesets to a repository. Another person merged and pushed their stuff.
At this point one of my files had edits that were lost within the merge process. I back tracked the files to see where the removal of the code occured but I can't find any case where the lines were explicitly removed.
Does anyone know what could have happened here? I looked and the 1 changeset above mine doesn't include the code. It was a hg merging changeset.
Upvotes: 2
Views: 164
Reputation: 78350
No line of code that's been committed is ever lost.
A merge is just a commit with two parents -- the merger can include or remove any code from either parent.
The tricky part is that the normal commands one uses to see where code might have been removed (hg log -p
for example) compare a changeset with its left parent, so you'll only see additions and removals relative to that parent.
If, for example, history looks like this:
[A]--[B]--[D]
\ /
-[C]-
(where A is the parent of both B and C, and D has two parents B and C)
If you change was added in B, but D's left parent is C and D's right parent is B, then when you run hg log -p
to see patches you're seeing:
None of those will show the removal of your change. To see that you need D as compared to B, which you'd get with:
hg diff -r B -r D
So the person that merged tossed your code, and you can dig around a bit for proof.
Upvotes: 4