##// END OF EJS Templates
merge: add state extras merge state data...
Durham Goode -
r28009:4a25e91f default
parent child Browse files
Show More
@@ -65,6 +65,7 b' class mergestate(object):'
65 65 (experimental)
66 66 m: the external merge driver defined for this merge plus its run state
67 67 (experimental)
68 f: a (filename, dictonary) tuple of optional values for a given file
68 69 X: unsupported mandatory record type (used in tests)
69 70 x: unsupported advisory record type (used in tests)
70 71
@@ -102,6 +103,7 b' class mergestate(object):'
102 103
103 104 def reset(self, node=None, other=None):
104 105 self._state = {}
106 self._stateextras = {}
105 107 self._local = None
106 108 self._other = None
107 109 for var in ('localctx', 'otherctx'):
@@ -126,6 +128,7 b' class mergestate(object):'
126 128 of on disk file.
127 129 """
128 130 self._state = {}
131 self._stateextras = {}
129 132 self._local = None
130 133 self._other = None
131 134 for var in ('localctx', 'otherctx'):
@@ -152,6 +155,16 b' class mergestate(object):'
152 155 elif rtype in 'FDC':
153 156 bits = record.split('\0')
154 157 self._state[bits[0]] = bits[1:]
158 elif rtype == 'f':
159 filename, rawextras = record.split('\0', 1)
160 extraparts = rawextras.split('\0')
161 extras = {}
162 i = 0
163 while i < len(extraparts):
164 extras[extraparts[i]] = extraparts[i + 1]
165 i += 2
166
167 self._stateextras[filename] = extras
155 168 elif not rtype.islower():
156 169 unsupported.add(rtype)
157 170 self._results = {}
@@ -336,6 +349,10 b' class mergestate(object):'
336 349 records.append(('C', '\0'.join([d] + v)))
337 350 else:
338 351 records.append(('F', '\0'.join([d] + v)))
352 for filename, extras in sorted(self._stateextras.iteritems()):
353 rawextras = '\0'.join('%s\0%s' % (k, v) for k, v in
354 extras.iteritems())
355 records.append(('f', '%s\0%s' % (filename, rawextras)))
339 356 return records
340 357
341 358 def _writerecords(self, records):
@@ -423,6 +440,9 b' class mergestate(object):'
423 440 if entry[0] == 'd':
424 441 yield f
425 442
443 def extras(self, filename):
444 return self._stateextras.setdefault(filename, {})
445
426 446 def _resolve(self, preresolve, dfile, wctx, labels=None):
427 447 """rerun merge process for file path `dfile`"""
428 448 if self[dfile] in 'rd':
@@ -462,6 +482,7 b' class mergestate(object):'
462 482 if r is None:
463 483 # no real conflict
464 484 del self._state[dfile]
485 self._stateextras.pop(dfile, None)
465 486 self._dirty = True
466 487 elif not r:
467 488 self.mark(dfile, 'r')
General Comments 0
You need to be logged in to leave comments. Login now