comparison 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
comparison
equal deleted inserted replaced
27133:8dff49c34a67 27134:cb5bdf65420f
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> 3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
4 # 4 #
5 # This software may be used and distributed according to the terms of the 5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version. 6 # GNU General Public License version 2 or any later version.
7 7
8 from node import hex, bin, nullid, nullrev, short 8 from node import hex, bin, nullhex, nullid, nullrev, short
9 from lock import release 9 from lock import release
10 from i18n import _ 10 from i18n import _
11 import os, re, difflib, time, tempfile, errno, shlex 11 import os, re, difflib, time, tempfile, errno, shlex
12 import sys, socket 12 import sys, socket
13 import hg, scmutil, util, revlog, copies, error, bookmarks 13 import hg, scmutil, util, revlog, copies, error, bookmarks
2537 def debugmergestate(ui, repo, *args): 2537 def debugmergestate(ui, repo, *args):
2538 """print merge state 2538 """print merge state
2539 2539
2540 Use --verbose to print out information about whether v1 or v2 merge state 2540 Use --verbose to print out information about whether v1 or v2 merge state
2541 was chosen.""" 2541 was chosen."""
2542 def _hashornull(h):
2543 if h == nullhex:
2544 return 'null'
2545 else:
2546 return h
2547
2542 def printrecords(version): 2548 def printrecords(version):
2543 ui.write(('* version %s records\n') % version) 2549 ui.write(('* version %s records\n') % version)
2544 if version == 1: 2550 if version == 1:
2545 records = v1records 2551 records = v1records
2546 else: 2552 else:
2565 else: 2571 else:
2566 onode, flags = r[7:9] 2572 onode, flags = r[7:9]
2567 ui.write(('file: %s (record type "%s", state "%s", hash %s)\n') 2573 ui.write(('file: %s (record type "%s", state "%s", hash %s)\n')
2568 % (f, rtype, state, hash)) 2574 % (f, rtype, state, hash))
2569 ui.write((' local path: %s (flags "%s")\n') % (lfile, flags)) 2575 ui.write((' local path: %s (flags "%s")\n') % (lfile, flags))
2570 ui.write((' ancestor path: %s (node %s)\n') % (afile, anode)) 2576 ui.write((' ancestor path: %s (node %s)\n')
2571 ui.write((' other path: %s (node %s)\n') % (ofile, onode)) 2577 % (afile, _hashornull(anode)))
2578 ui.write((' other path: %s (node %s)\n')
2579 % (ofile, _hashornull(onode)))
2572 else: 2580 else:
2573 ui.write(('unrecognized entry: %s\t%s\n') 2581 ui.write(('unrecognized entry: %s\t%s\n')
2574 % (rtype, record.replace('\0', '\t'))) 2582 % (rtype, record.replace('\0', '\t')))
2575 2583
2576 # Avoid mergestate.read() since it may raise an exception for unsupported 2584 # Avoid mergestate.read() since it may raise an exception for unsupported