changeset 26986:1ee5e48f09d4

mergestate: raise structured exception for unsupported merge records We're going to catch this exception in 'hg summary' to print a better error message. This code is pretty untested, so there are no changes to test output. In upcoming patches we're going to test the output more thoroughly.
author Siddharth Agarwal <sid0@fb.com>
date Tue, 17 Nov 2015 14:11:52 -0800
parents 039a53c87370
children 416b2b7d3068
files mercurial/merge.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Tue Nov 17 14:10:12 2015 -0800
+++ b/mercurial/merge.py	Tue Nov 17 14:11:52 2015 -0800
@@ -110,6 +110,7 @@
             del self.otherctx
         self._readmergedriver = None
         self._mdstate = 's'
+        unsupported = set()
         records = self._readrecords()
         for rtype, record in records:
             if rtype == 'L':
@@ -129,10 +130,12 @@
                 bits = record.split('\0')
                 self._state[bits[0]] = bits[1:]
             elif not rtype.islower():
-                raise error.Abort(_('unsupported merge state record: %s')
-                                   % rtype)
+                unsupported.add(rtype)
         self._dirty = False
 
+        if unsupported:
+            raise error.UnsupportedMergeRecords(unsupported)
+
     def _readrecords(self):
         """Read merge state from disk and return a list of record (TYPE, data)