debugmergestate: explain why we create mergestate objects directly
authorSiddharth Agarwal <sid0@fb.com>
Tue, 17 Nov 2015 14:22:30 -0800
changeset 27004 a4c26918fb23
parent 27003 487cca1bf61f
child 27005 3185c01c551c
debugmergestate: explain why we create mergestate objects directly We would normally use the read() constructor, but in this case it's fine because - we implement our own reading layer, so the extra parsing done by read() is unnecessary - read() can raise an exception for unsupported merge state records, but here we'd like to handle that separately - debugmergestate needs to be privy to mergestate internals anyway
mercurial/commands.py
--- a/mercurial/commands.py	Wed Nov 11 13:28:00 2015 -0800
+++ b/mercurial/commands.py	Tue Nov 17 14:22:30 2015 -0800
@@ -2556,6 +2556,9 @@
                 ui.write(('unrecognized entry: %s\t%s\n')
                          % (rtype, record.replace('\0', '\t')))
 
+    # Avoid mergestate.read() since it may raise an exception for unsupported
+    # merge state records. We shouldn't be doing this, but this is OK since this
+    # command is pretty low-level.
     ms = mergemod.mergestate(repo)
 
     # sort so that reasonable information is on top