##// END OF EJS Templates
merge: add pathconflict merge state...
Mark Thomas -
r34546:19131628 default
parent child Browse files
Show More
@@ -66,6 +66,7 b' class mergestate(object):'
66 66 C: a change/delete or delete/change conflict
67 67 D: a file that the external merge driver will merge internally
68 68 (experimental)
69 P: a path conflict (file vs directory)
69 70 m: the external merge driver defined for this merge plus its run state
70 71 (experimental)
71 72 f: a (filename, dictionary) tuple of optional values for a given file
@@ -79,6 +80,15 b' class mergestate(object):'
79 80 m: driver-resolved files marked -- only needs to be run before commit
80 81 s: success/skipped -- does not need to be run any more
81 82
83 Merge record states (stored in self._state, indexed by filename):
84 u: unresolved conflict
85 r: resolved conflict
86 pu: unresolved path conflict (file conflicts with directory)
87 pr: resolved path conflict
88 d: driver-resolved conflict
89
90 The resolve command transitions between 'u' and 'r' for conflicts and
91 'pu' and 'pr' for path conflicts.
82 92 '''
83 93 statepathv1 = 'merge/state'
84 94 statepathv2 = 'merge/state2'
@@ -158,7 +168,7 b' class mergestate(object):'
158 168
159 169 self._readmergedriver = bits[0]
160 170 self._mdstate = mdstate
161 elif rtype in 'FDC':
171 elif rtype in 'FDCP':
162 172 bits = record.split('\0')
163 173 self._state[bits[0]] = bits[1:]
164 174 elif rtype == 'f':
@@ -354,6 +364,8 b' class mergestate(object):'
354 364 for d, v in self._state.iteritems():
355 365 if v[0] == 'd':
356 366 records.append(('D', '\0'.join([d] + v)))
367 elif v[0] in ('pu', 'pr'):
368 records.append(('P', '\0'.join([d] + v)))
357 369 # v[1] == local ('cd'), v[6] == other ('dc') -- not supported by
358 370 # older versions of Mercurial
359 371 elif v[1] == nullhex or v[6] == nullhex:
@@ -422,6 +434,15 b' class mergestate(object):'
422 434 self._stateextras[fd] = {'ancestorlinknode': hex(fca.node())}
423 435 self._dirty = True
424 436
437 def addpath(self, path, frename, forigin):
438 """add a new conflicting path to the merge state
439 path: the path that conflicts
440 frename: the filename the conflicting file was renamed to
441 forigin: origin of the file ('l' or 'r' for local/remote)
442 """
443 self._state[path] = ['pu', frename, forigin]
444 self._dirty = True
445
425 446 def __contains__(self, dfile):
426 447 return dfile in self._state
427 448
@@ -445,7 +466,7 b' class mergestate(object):'
445 466 """Obtain the paths of unresolved files."""
446 467
447 468 for f, entry in self._state.iteritems():
448 if entry[0] == 'u':
469 if entry[0] in ('u', 'pu'):
449 470 yield f
450 471
451 472 def driverresolved(self):
General Comments 0
You need to be logged in to leave comments. Login now