[Updated] D8920: mergestate: use _stateextras instead of merge records for commit related info
pulkit (Pulkit Goyal)
phabricator at mercurial-scm.org
Sat Aug 22 23:34:11 UTC 2020
Closed by commit rHG0652a533fe3c: mergestate: use _stateextras instead of merge records for commit related info (authored by pulkit).
This revision was automatically updated to reflect the committed changes.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D8920?vs=22392&id=22423
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D8920/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D8920
AFFECTED FILES
mercurial/commands.py
mercurial/commit.py
mercurial/mergestate.py
CHANGE DETAILS
diff --git a/mercurial/mergestate.py b/mercurial/mergestate.py
--- a/mercurial/mergestate.py
+++ b/mercurial/mergestate.py
@@ -81,6 +81,8 @@
MERGE_RECORD_DRIVER_RESOLVED = b'd'
# represents that the file was automatically merged in favor
# of other version. This info is used on commit.
+# This is now deprecated and commit related information is now
+# stored in RECORD_FILE_VALUES
MERGE_RECORD_MERGED_OTHER = b'o'
#####
@@ -257,7 +259,13 @@
LEGACY_RECORD_RESOLVED_OTHER,
):
bits = record.split(b'\0')
- self._state[bits[0]] = bits[1:]
+ # merge entry type MERGE_RECORD_MERGED_OTHER is deprecated
+ # and we now store related information in _stateextras, so
+ # lets write to _stateextras directly
+ if bits[1] == MERGE_RECORD_MERGED_OTHER:
+ self._stateextras[bits[0]][b'filenode-source'] = b'other'
+ else:
+ self._state[bits[0]] = bits[1:]
elif rtype == RECORD_FILE_VALUES:
filename, rawextras = record.split(b'\0', 1)
extraparts = rawextras.split(b'\0')
@@ -486,8 +494,6 @@
records.append(
(RECORD_PATH_CONFLICT, b'\0'.join([filename] + v))
)
- elif v[0] == MERGE_RECORD_MERGED_OTHER:
- records.append((RECORD_MERGED, b'\0'.join([filename] + v)))
elif v[1] == nullhex or v[6] == nullhex:
# Change/Delete or Delete/Change conflicts. These are stored in
# 'C' records. v[1] is the local file, and is nullhex when the
@@ -587,7 +593,7 @@
self._dirty = True
def addmergedother(self, path):
- self._state[path] = [MERGE_RECORD_MERGED_OTHER, nullhex, nullhex]
+ self._stateextras[path] = {b'filenode-source': b'other'}
self._dirty = True
def __contains__(self, dfile):
@@ -636,8 +642,6 @@
"""
if self[dfile] in (MERGE_RECORD_RESOLVED, MERGE_RECORD_DRIVER_RESOLVED):
return True, 0
- if self._state[dfile][0] == MERGE_RECORD_MERGED_OTHER:
- return True, 0
stateentry = self._state[dfile]
state, localkey, lfile, afile, anode, ofile, onode, flags = stateentry
octx = self._repo[self._other]
diff --git a/mercurial/commit.py b/mercurial/commit.py
--- a/mercurial/commit.py
+++ b/mercurial/commit.py
@@ -325,10 +325,7 @@
elif not fparentancestors:
# TODO: this whole if-else might be simplified much more
ms = mergestate.mergestate.read(repo)
- if (
- fname in ms
- and ms[fname] == mergestate.MERGE_RECORD_MERGED_OTHER
- ):
+ if ms.extras(fname).get(b'filenode-source') == b'other':
fparent1, fparent2 = fparent2, nullid
# is the file changed?
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5969,8 +5969,6 @@
if not m(f):
continue
- if ms[f] == mergestatemod.MERGE_RECORD_MERGED_OTHER:
- continue
label, key = mergestateinfo[ms[f]]
fm.startitem()
fm.context(ctx=wctx)
@@ -6018,9 +6016,6 @@
didwork = True
- if ms[f] == mergestatemod.MERGE_RECORD_MERGED_OTHER:
- continue
-
# don't let driver-resolved files be marked, and run the conclude
# step if asked to resolve
if ms[f] == mergestatemod.MERGE_RECORD_DRIVER_RESOLVED:
To: pulkit, #hg-reviewers, marmoute, indygreg
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20200822/b0ae8bb2/attachment-0002.html>
More information about the Mercurial-patches
mailing list