changeset 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 8dff49c34a67
children cc9d49160adc
files mercurial/commands.py tests/test-histedit-non-commute-abort.t
diffstat 2 files changed, 13 insertions(+), 5 deletions(-) [+]
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')))
--- a/tests/test-histedit-non-commute-abort.t	Tue Nov 24 15:03:00 2015 -0800
+++ b/tests/test-histedit-non-commute-abort.t	Mon Nov 30 10:26:37 2015 -0800
@@ -84,7 +84,7 @@
   unrecognized entry: x	advisory record
   file: e (record type "F", state "u", hash 58e6b3a414a1e090dfc6029add0f3555ccba127f)
     local path: e (flags "")
-    ancestor path: e (node 0000000000000000000000000000000000000000)
+    ancestor path: e (node null)
     other path: e (node 6b67ccefd5ce6de77e7ead4f5292843a0255329f)
   $ hg resolve -l
   U e
@@ -97,7 +97,7 @@
   other: e860deea161a2f77de56603b340ebbb4536308ae
   file: e (record type "F", state "u", hash 58e6b3a414a1e090dfc6029add0f3555ccba127f)
     local path: e (flags "")
-    ancestor path: e (node 0000000000000000000000000000000000000000)
+    ancestor path: e (node null)
     other path: e (node 6b67ccefd5ce6de77e7ead4f5292843a0255329f)
   unrecognized entry: X	mandatory record
   $ hg resolve -l