2474 @command('debuglabelcomplete', [], _('LABEL...')) |
2474 @command('debuglabelcomplete', [], _('LABEL...')) |
2475 def debuglabelcomplete(ui, repo, *args): |
2475 def debuglabelcomplete(ui, repo, *args): |
2476 '''backwards compatibility with old bash completion scripts (DEPRECATED)''' |
2476 '''backwards compatibility with old bash completion scripts (DEPRECATED)''' |
2477 debugnamecomplete(ui, repo, *args) |
2477 debugnamecomplete(ui, repo, *args) |
2478 |
2478 |
|
2479 @command('debugmergestate', [], '') |
|
2480 def debugmergestate(ui, repo, *args): |
|
2481 """print merge state |
|
2482 |
|
2483 Use --verbose to print out information about whether v1 or v2 merge state |
|
2484 was chosen.""" |
|
2485 def printrecords(version): |
|
2486 ui.write(('* version %s records\n') % version) |
|
2487 if version == 1: |
|
2488 records = v1records |
|
2489 else: |
|
2490 records = v2records |
|
2491 |
|
2492 for rtype, record in records: |
|
2493 # pretty print some record types |
|
2494 if rtype == 'L': |
|
2495 ui.write(('local: %s\n') % record) |
|
2496 elif rtype == 'O': |
|
2497 ui.write(('other: %s\n') % record) |
|
2498 elif rtype == 'F': |
|
2499 r = record.split('\0') |
|
2500 f, state, hash, lfile, afile, anode, ofile = r[0:7] |
|
2501 if version == 1: |
|
2502 onode = 'not stored in v1 format' |
|
2503 flags = r[7] |
|
2504 else: |
|
2505 onode, flags = r[7:9] |
|
2506 ui.write(('file: %s (state "%s", hash %s)\n') |
|
2507 % (f, state, hash)) |
|
2508 ui.write((' local path: %s (flags "%s")\n') % (lfile, flags)) |
|
2509 ui.write((' ancestor path: %s (node %s)\n') % (afile, anode)) |
|
2510 ui.write((' other path: %s (node %s)\n') % (ofile, onode)) |
|
2511 else: |
|
2512 ui.write(('unrecognized entry: %s\t%s\n') |
|
2513 % (rtype, record.replace('\0', '\t'))) |
|
2514 |
|
2515 ms = mergemod.mergestate(repo) |
|
2516 |
|
2517 # sort so that reasonable information is on top |
|
2518 v1records = ms._readrecordsv1() |
|
2519 v2records = ms._readrecordsv2() |
|
2520 order = 'LO' |
|
2521 def key(r): |
|
2522 idx = order.find(r[0]) |
|
2523 if idx == -1: |
|
2524 return (1, r[1]) |
|
2525 else: |
|
2526 return (0, idx) |
|
2527 v1records.sort(key=key) |
|
2528 v2records.sort(key=key) |
|
2529 |
|
2530 if not v1records and not v2records: |
|
2531 ui.write(('no merge state found\n')) |
|
2532 elif not v2records: |
|
2533 ui.note(('no version 2 merge state\n')) |
|
2534 printrecords(1) |
|
2535 elif ms._v1v2match(v1records, v2records): |
|
2536 ui.note(('v1 and v2 states match: using v2\n')) |
|
2537 printrecords(2) |
|
2538 else: |
|
2539 ui.note(('v1 and v2 states mismatch: using v1\n')) |
|
2540 printrecords(1) |
|
2541 if ui.verbose: |
|
2542 printrecords(2) |
|
2543 |
2479 @command('debugnamecomplete', [], _('NAME...')) |
2544 @command('debugnamecomplete', [], _('NAME...')) |
2480 def debugnamecomplete(ui, repo, *args): |
2545 def debugnamecomplete(ui, repo, *args): |
2481 '''complete "names" - tags, open branch names, bookmark names''' |
2546 '''complete "names" - tags, open branch names, bookmark names''' |
2482 |
2547 |
2483 names = set() |
2548 names = set() |