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