Mercurial > hg-stable
changeset 20591:02c60e380fd0 stable
merge: record the "other" node in merge state
We need to record the merge we were merging with. This solve multiple
bug with resolve when dropping the second parent after a merge. This
happen a lot when doing special merge (overriding the ancestor).
Backout, shelve, rebase, etc. can takes advantage of it.
This changeset just add the information in the merge state. We'll use it in the
resolve process in a later changeset.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 25 Feb 2014 18:42:11 -0800 |
parents | 2b7d54e929b4 |
children | 303cbfe3dcc8 |
files | mercurial/merge.py |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/merge.py Tue Feb 25 18:37:06 2014 -0800 +++ b/mercurial/merge.py Tue Feb 25 18:42:11 2014 -0800 @@ -36,6 +36,7 @@ Currently known record: L: the node of the "local" part of the merge (hexified version) + O: the node of the "other" part of the merge (hexified version) F: a file to be merged entry ''' statepathv1 = "merge/state" @@ -44,10 +45,11 @@ self._repo = repo self._dirty = False self._read() - def reset(self, node=None): + def reset(self, node=None, other=None): self._state = {} if node: self._local = node + self._other = other shutil.rmtree(self._repo.join("merge"), True) self._dirty = False def _read(self): @@ -56,6 +58,8 @@ for rtype, record in records: if rtype == 'L': self._local = bin(record) + elif rtype == 'O': + self._other = bin(record) elif rtype == "F": bits = record.split("\0") self._state[bits[0]] = bits[1:] @@ -111,6 +115,7 @@ if self._dirty: records = [] records.append(("L", hex(self._local))) + records.append(("O", hex(self._other))) for d, v in self._state.iteritems(): records.append(("F", "\0".join([d] + v))) self._writerecords(records) @@ -529,7 +534,7 @@ updated, merged, removed, unresolved = 0, 0, 0, 0 ms = mergestate(repo) - ms.reset(wctx.p1().node()) + ms.reset(wctx.p1().node(), mctx.node()) moves = [] actions.sort(key=actionkey)