##// END OF EJS Templates
mergestate.commit: factor out making the list of records...
Siddharth Agarwal -
r27006:9d58dc19 default
parent child Browse files
Show More
@@ -286,20 +286,24 b' class mergestate(object):'
286 def commit(self):
286 def commit(self):
287 """Write current state on disk (if necessary)"""
287 """Write current state on disk (if necessary)"""
288 if self._dirty:
288 if self._dirty:
289 records = []
289 records = self._makerecords()
290 records.append(('L', hex(self._local)))
291 records.append(('O', hex(self._other)))
292 if self.mergedriver:
293 records.append(('m', '\0'.join([
294 self.mergedriver, self._mdstate])))
295 for d, v in self._state.iteritems():
296 if v[0] == 'd':
297 records.append(('D', '\0'.join([d] + v)))
298 else:
299 records.append(('F', '\0'.join([d] + v)))
300 self._writerecords(records)
290 self._writerecords(records)
301 self._dirty = False
291 self._dirty = False
302
292
293 def _makerecords(self):
294 records = []
295 records.append(('L', hex(self._local)))
296 records.append(('O', hex(self._other)))
297 if self.mergedriver:
298 records.append(('m', '\0'.join([
299 self.mergedriver, self._mdstate])))
300 for d, v in self._state.iteritems():
301 if v[0] == 'd':
302 records.append(('D', '\0'.join([d] + v)))
303 else:
304 records.append(('F', '\0'.join([d] + v)))
305 return records
306
303 def _writerecords(self, records):
307 def _writerecords(self, records):
304 """Write current state on disk (both v1 and v2)"""
308 """Write current state on disk (both v1 and v2)"""
305 self._writerecordsv1(records)
309 self._writerecordsv1(records)
General Comments 0
You need to be logged in to leave comments. Login now