##// END OF EJS Templates
mergestate: use _stateextras instead of merge records for commit related info...
Pulkit Goyal -
r45942:0652a533 default
parent child Browse files
Show More
@@ -5969,8 +5969,6 b' def resolve(ui, repo, *pats, **opts):'
5969 if not m(f):
5969 if not m(f):
5970 continue
5970 continue
5971
5971
5972 if ms[f] == mergestatemod.MERGE_RECORD_MERGED_OTHER:
5973 continue
5974 label, key = mergestateinfo[ms[f]]
5972 label, key = mergestateinfo[ms[f]]
5975 fm.startitem()
5973 fm.startitem()
5976 fm.context(ctx=wctx)
5974 fm.context(ctx=wctx)
@@ -6018,9 +6016,6 b' def resolve(ui, repo, *pats, **opts):'
6018
6016
6019 didwork = True
6017 didwork = True
6020
6018
6021 if ms[f] == mergestatemod.MERGE_RECORD_MERGED_OTHER:
6022 continue
6023
6024 # don't let driver-resolved files be marked, and run the conclude
6019 # don't let driver-resolved files be marked, and run the conclude
6025 # step if asked to resolve
6020 # step if asked to resolve
6026 if ms[f] == mergestatemod.MERGE_RECORD_DRIVER_RESOLVED:
6021 if ms[f] == mergestatemod.MERGE_RECORD_DRIVER_RESOLVED:
@@ -325,10 +325,7 b' def _filecommit('
325 elif not fparentancestors:
325 elif not fparentancestors:
326 # TODO: this whole if-else might be simplified much more
326 # TODO: this whole if-else might be simplified much more
327 ms = mergestate.mergestate.read(repo)
327 ms = mergestate.mergestate.read(repo)
328 if (
328 if ms.extras(fname).get(b'filenode-source') == b'other':
329 fname in ms
330 and ms[fname] == mergestate.MERGE_RECORD_MERGED_OTHER
331 ):
332 fparent1, fparent2 = fparent2, nullid
329 fparent1, fparent2 = fparent2, nullid
333
330
334 # is the file changed?
331 # is the file changed?
@@ -81,6 +81,8 b" MERGE_RECORD_RESOLVED_PATH = b'pr'"
81 MERGE_RECORD_DRIVER_RESOLVED = b'd'
81 MERGE_RECORD_DRIVER_RESOLVED = b'd'
82 # represents that the file was automatically merged in favor
82 # represents that the file was automatically merged in favor
83 # of other version. This info is used on commit.
83 # of other version. This info is used on commit.
84 # This is now deprecated and commit related information is now
85 # stored in RECORD_FILE_VALUES
84 MERGE_RECORD_MERGED_OTHER = b'o'
86 MERGE_RECORD_MERGED_OTHER = b'o'
85
87
86 #####
88 #####
@@ -257,7 +259,13 b' class mergestate(object):'
257 LEGACY_RECORD_RESOLVED_OTHER,
259 LEGACY_RECORD_RESOLVED_OTHER,
258 ):
260 ):
259 bits = record.split(b'\0')
261 bits = record.split(b'\0')
260 self._state[bits[0]] = bits[1:]
262 # merge entry type MERGE_RECORD_MERGED_OTHER is deprecated
263 # and we now store related information in _stateextras, so
264 # lets write to _stateextras directly
265 if bits[1] == MERGE_RECORD_MERGED_OTHER:
266 self._stateextras[bits[0]][b'filenode-source'] = b'other'
267 else:
268 self._state[bits[0]] = bits[1:]
261 elif rtype == RECORD_FILE_VALUES:
269 elif rtype == RECORD_FILE_VALUES:
262 filename, rawextras = record.split(b'\0', 1)
270 filename, rawextras = record.split(b'\0', 1)
263 extraparts = rawextras.split(b'\0')
271 extraparts = rawextras.split(b'\0')
@@ -486,8 +494,6 b' class mergestate(object):'
486 records.append(
494 records.append(
487 (RECORD_PATH_CONFLICT, b'\0'.join([filename] + v))
495 (RECORD_PATH_CONFLICT, b'\0'.join([filename] + v))
488 )
496 )
489 elif v[0] == MERGE_RECORD_MERGED_OTHER:
490 records.append((RECORD_MERGED, b'\0'.join([filename] + v)))
491 elif v[1] == nullhex or v[6] == nullhex:
497 elif v[1] == nullhex or v[6] == nullhex:
492 # Change/Delete or Delete/Change conflicts. These are stored in
498 # Change/Delete or Delete/Change conflicts. These are stored in
493 # 'C' records. v[1] is the local file, and is nullhex when the
499 # 'C' records. v[1] is the local file, and is nullhex when the
@@ -587,7 +593,7 b' class mergestate(object):'
587 self._dirty = True
593 self._dirty = True
588
594
589 def addmergedother(self, path):
595 def addmergedother(self, path):
590 self._state[path] = [MERGE_RECORD_MERGED_OTHER, nullhex, nullhex]
596 self._stateextras[path] = {b'filenode-source': b'other'}
591 self._dirty = True
597 self._dirty = True
592
598
593 def __contains__(self, dfile):
599 def __contains__(self, dfile):
@@ -636,8 +642,6 b' class mergestate(object):'
636 """
642 """
637 if self[dfile] in (MERGE_RECORD_RESOLVED, MERGE_RECORD_DRIVER_RESOLVED):
643 if self[dfile] in (MERGE_RECORD_RESOLVED, MERGE_RECORD_DRIVER_RESOLVED):
638 return True, 0
644 return True, 0
639 if self._state[dfile][0] == MERGE_RECORD_MERGED_OTHER:
640 return True, 0
641 stateentry = self._state[dfile]
645 stateentry = self._state[dfile]
642 state, localkey, lfile, afile, anode, ofile, onode, flags = stateentry
646 state, localkey, lfile, afile, anode, ofile, onode, flags = stateentry
643 octx = self._repo[self._other]
647 octx = self._repo[self._other]
General Comments 0
You need to be logged in to leave comments. Login now