diff mercurial/commands.py @ 27134:cb5bdf65420f

debugmergestate: print out null nodes as 'null' This is so much easier to read than a long string of zeroes, and we're going to have a lot more of these nodes once change/delete conflicts are part of the merge state.
author Siddharth Agarwal <sid0@fb.com>
date Mon, 30 Nov 2015 10:26:37 -0800
parents 37edc8e5ed4f
children cc9d49160adc
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Nov 24 15:03:00 2015 -0800
+++ b/mercurial/commands.py	Mon Nov 30 10:26:37 2015 -0800
@@ -5,7 +5,7 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-from node import hex, bin, nullid, nullrev, short
+from node import hex, bin, nullhex, nullid, nullrev, short
 from lock import release
 from i18n import _
 import os, re, difflib, time, tempfile, errno, shlex
@@ -2539,6 +2539,12 @@
 
     Use --verbose to print out information about whether v1 or v2 merge state
     was chosen."""
+    def _hashornull(h):
+        if h == nullhex:
+            return 'null'
+        else:
+            return h
+
     def printrecords(version):
         ui.write(('* version %s records\n') % version)
         if version == 1:
@@ -2567,8 +2573,10 @@
                 ui.write(('file: %s (record type "%s", state "%s", hash %s)\n')
                          % (f, rtype, state, hash))
                 ui.write(('  local path: %s (flags "%s")\n') % (lfile, flags))
-                ui.write(('  ancestor path: %s (node %s)\n') % (afile, anode))
-                ui.write(('  other path: %s (node %s)\n') % (ofile, onode))
+                ui.write(('  ancestor path: %s (node %s)\n')
+                         % (afile, _hashornull(anode)))
+                ui.write(('  other path: %s (node %s)\n')
+                         % (ofile, _hashornull(onode)))
             else:
                 ui.write(('unrecognized entry: %s\t%s\n')
                          % (rtype, record.replace('\0', '\t')))