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 |