mergestate.commit: factor out making the list of records
Will aid in testing.
--- a/mercurial/merge.py Tue Nov 17 14:04:56 2015 -0800
+++ b/mercurial/merge.py Tue Nov 17 14:23:26 2015 -0800
@@ -286,20 +286,24 @@
def commit(self):
"""Write current state on disk (if necessary)"""
if self._dirty:
- records = []
- records.append(('L', hex(self._local)))
- records.append(('O', hex(self._other)))
- if self.mergedriver:
- records.append(('m', '\0'.join([
- self.mergedriver, self._mdstate])))
- for d, v in self._state.iteritems():
- if v[0] == 'd':
- records.append(('D', '\0'.join([d] + v)))
- else:
- records.append(('F', '\0'.join([d] + v)))
+ records = self._makerecords()
self._writerecords(records)
self._dirty = False
+ def _makerecords(self):
+ records = []
+ records.append(('L', hex(self._local)))
+ records.append(('O', hex(self._other)))
+ if self.mergedriver:
+ records.append(('m', '\0'.join([
+ self.mergedriver, self._mdstate])))
+ for d, v in self._state.iteritems():
+ if v[0] == 'd':
+ records.append(('D', '\0'.join([d] + v)))
+ else:
+ records.append(('F', '\0'.join([d] + v)))
+ return records
+
def _writerecords(self, records):
"""Write current state on disk (both v1 and v2)"""
self._writerecordsv1(records)