Show More
@@ -1611,25 +1611,26 b' def show_changeset(ui, repo, opts, buffe' | |||
|
1611 | 1611 | |
|
1612 | 1612 | return changeset_templater(ui, repo, matchfn, opts, tmpl, mapfile, buffered) |
|
1613 | 1613 | |
|
1614 |
def showmarker( |
|
|
1614 | def showmarker(fm, marker, index=None): | |
|
1615 | 1615 | """utility function to display obsolescence marker in a readable way |
|
1616 | 1616 | |
|
1617 | 1617 | To be used by debug function.""" |
|
1618 | 1618 | if index is not None: |
|
1619 |
|
|
|
1620 |
|
|
|
1621 |
|
|
|
1622 | ui.write(' ') | |
|
1623 | ui.write(hex(repl)) | |
|
1624 |
|
|
|
1619 | fm.write('index', '%i ', index) | |
|
1620 | fm.write('precnode', '%s ', hex(marker.precnode())) | |
|
1621 | succs = marker.succnodes() | |
|
1622 | fm.condwrite(succs, 'succnodes', '%s ', | |
|
1623 | fm.formatlist(map(hex, succs), name='node')) | |
|
1624 | fm.write('flag', '%X ', marker.flags()) | |
|
1625 | 1625 | parents = marker.parentnodes() |
|
1626 | 1626 | if parents is not None: |
|
1627 | ui.write('{%s} ' % ', '.join(hex(p) for p in parents)) | |
|
1628 | ui.write('(%s) ' % util.datestr(marker.date())) | |
|
1629 | ui.write('{%s}' % (', '.join('%r: %r' % t for t in | |
|
1630 | sorted(marker.metadata().items()) | |
|
1631 | if t[0] != 'date'))) | |
|
1632 | ui.write('\n') | |
|
1627 | fm.write('parentnodes', '{%s} ', | |
|
1628 | fm.formatlist(map(hex, parents), name='node', sep=', ')) | |
|
1629 | fm.write('date', '(%s) ', fm.formatdate(marker.date())) | |
|
1630 | meta = marker.metadata().copy() | |
|
1631 | meta.pop('date', None) | |
|
1632 | fm.write('metadata', '{%s}', fm.formatdict(meta, fmt='%r: %r', sep=', ')) | |
|
1633 | fm.plain('\n') | |
|
1633 | 1634 | |
|
1634 | 1635 | def finddate(ui, repo, date): |
|
1635 | 1636 | """Find the tipmost changeset that matches the given date spec""" |
@@ -3044,7 +3044,7 b' def debuglocks(ui, repo, **opts):' | |||
|
3044 | 3044 | ('r', 'rev', [], _('display markers relevant to REV')), |
|
3045 | 3045 | ('', 'index', False, _('display index of the marker')), |
|
3046 | 3046 | ('', 'delete', [], _('delete markers specified by indices')), |
|
3047 | ] + commitopts2, | |
|
3047 | ] + commitopts2 + formatteropts, | |
|
3048 | 3048 | _('[OBSOLETED [REPLACEMENT ...]]')) |
|
3049 | 3049 | def debugobsolete(ui, repo, precursor=None, *successors, **opts): |
|
3050 | 3050 | """create arbitrary obsolete marker |
@@ -3132,6 +3132,7 b' def debugobsolete(ui, repo, precursor=No' | |||
|
3132 | 3132 | markerset = set(markers) |
|
3133 | 3133 | isrelevant = lambda m: m in markerset |
|
3134 | 3134 | |
|
3135 | fm = ui.formatter('debugobsolete', opts) | |
|
3135 | 3136 | for i, m in enumerate(markerstoiter): |
|
3136 | 3137 | if not isrelevant(m): |
|
3137 | 3138 | # marker can be irrelevant when we're iterating over a set |
@@ -3142,8 +3143,10 b' def debugobsolete(ui, repo, precursor=No' | |||
|
3142 | 3143 | # to get the correct indices, but only display the ones that |
|
3143 | 3144 | # are relevant to --rev value |
|
3144 | 3145 | continue |
|
3146 | fm.startitem() | |
|
3145 | 3147 | ind = i if opts.get('index') else None |
|
3146 |
cmdutil.showmarker( |
|
|
3148 | cmdutil.showmarker(fm, m, index=ind) | |
|
3149 | fm.end() | |
|
3147 | 3150 | |
|
3148 | 3151 | @command('debugpathcomplete', |
|
3149 | 3152 | [('f', 'full', None, _('complete an entire path')), |
@@ -261,7 +261,7 b' Show all commands + options' | |||
|
261 | 261 | debuglocks: force-lock, force-wlock |
|
262 | 262 | debugmergestate: |
|
263 | 263 | debugnamecomplete: |
|
264 | debugobsolete: flags, record-parents, rev, index, delete, date, user | |
|
264 | debugobsolete: flags, record-parents, rev, index, delete, date, user, template | |
|
265 | 265 | debugpathcomplete: full, normal, added, removed |
|
266 | 266 | debugpushkey: |
|
267 | 267 | debugpvec: |
@@ -645,6 +645,80 b' List of both' | |||
|
645 | 645 | cda648ca50f50482b7055c0b0c4c117bba6733d9 3de5eca88c00aa039da7399a220f4a5221faa585 0 (*) {'user': 'test'} (glob) |
|
646 | 646 | cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'} |
|
647 | 647 | |
|
648 | List of all markers in JSON | |
|
649 | ||
|
650 | $ hg debugobsolete -Tjson | |
|
651 | [ | |
|
652 | { | |
|
653 | "date": [1339.0, 0], | |
|
654 | "flag": 0, | |
|
655 | "metadata": {"user": "test"}, | |
|
656 | "precnode": "1339133913391339133913391339133913391339", | |
|
657 | "succnodes": ["ca819180edb99ed25ceafb3e9584ac287e240b00"] | |
|
658 | }, | |
|
659 | { | |
|
660 | "date": [1339.0, 0], | |
|
661 | "flag": 0, | |
|
662 | "metadata": {"user": "test"}, | |
|
663 | "precnode": "1337133713371337133713371337133713371337", | |
|
664 | "succnodes": ["5601fb93a350734d935195fee37f4054c529ff39"] | |
|
665 | }, | |
|
666 | { | |
|
667 | "date": [121.0, 120], | |
|
668 | "flag": 12, | |
|
669 | "metadata": {"user": "test"}, | |
|
670 | "precnode": "245bde4270cd1072a27757984f9cda8ba26f08ca", | |
|
671 | "succnodes": ["cdbce2fbb16313928851e97e0d85413f3f7eb77f"] | |
|
672 | }, | |
|
673 | { | |
|
674 | "date": [1338.0, 0], | |
|
675 | "flag": 1, | |
|
676 | "metadata": {"user": "test"}, | |
|
677 | "precnode": "5601fb93a350734d935195fee37f4054c529ff39", | |
|
678 | "succnodes": ["6f96419950729f3671185b847352890f074f7557"] | |
|
679 | }, | |
|
680 | { | |
|
681 | "date": [1338.0, 0], | |
|
682 | "flag": 0, | |
|
683 | "metadata": {"user": "test"}, | |
|
684 | "precnode": "ca819180edb99ed25ceafb3e9584ac287e240b00", | |
|
685 | "succnodes": ["1337133713371337133713371337133713371337"] | |
|
686 | }, | |
|
687 | { | |
|
688 | "date": [1337.0, 0], | |
|
689 | "flag": 0, | |
|
690 | "metadata": {"user": "test"}, | |
|
691 | "precnode": "cdbce2fbb16313928851e97e0d85413f3f7eb77f", | |
|
692 | "succnodes": ["ca819180edb99ed25ceafb3e9584ac287e240b00"] | |
|
693 | }, | |
|
694 | { | |
|
695 | "date": [0.0, 0], | |
|
696 | "flag": 0, | |
|
697 | "metadata": {"user": "test"}, | |
|
698 | "parentnodes": ["6f96419950729f3671185b847352890f074f7557"], | |
|
699 | "precnode": "94b33453f93bdb8d457ef9b770851a618bf413e1", | |
|
700 | "succnodes": [] | |
|
701 | }, | |
|
702 | { | |
|
703 | "date": *, (glob) | |
|
704 | "flag": 0, | |
|
705 | "metadata": {"user": "test"}, | |
|
706 | "precnode": "cda648ca50f50482b7055c0b0c4c117bba6733d9", | |
|
707 | "succnodes": ["3de5eca88c00aa039da7399a220f4a5221faa585"] | |
|
708 | } | |
|
709 | ] | |
|
710 | ||
|
711 | Template keywords | |
|
712 | ||
|
713 | $ hg debugobsolete -r6 -T '{succnodes % "{node|short}"} {date|shortdate}\n' | |
|
714 | 3de5eca88c00 ????-??-?? (glob) | |
|
715 | $ hg debugobsolete -r6 -T '{join(metadata % "{key}={value}", " ")}\n' | |
|
716 | user=test | |
|
717 | $ hg debugobsolete -r6 -T '{metadata}\n' | |
|
718 | 'user': 'test' | |
|
719 | $ hg debugobsolete -r6 -T '{flag} {get(metadata, "user")}\n' | |
|
720 | 0 test | |
|
721 | ||
|
648 | 722 | #if serve |
|
649 | 723 | |
|
650 | 724 | Test the debug output for exchange |
@@ -1110,6 +1184,25 b' only a subset of those are displayed (be' | |||
|
1110 | 1184 | $ hg debugobsolete --index --rev "3+7" |
|
1111 | 1185 | 1 6fdef60fcbabbd3d50e9b9cbc2a240724b91a5e1 d27fb9b066076fd921277a4b9e8b9cb48c95bc6a 0 \(.*\) {'user': 'test'} (re) |
|
1112 | 1186 | 3 4715cf767440ed891755448016c2b8cf70760c30 7ae79c5d60f049c7b0dd02f5f25b9d60aaf7b36d 0 \(.*\) {'user': 'test'} (re) |
|
1187 | $ hg debugobsolete --index --rev "3+7" -Tjson | |
|
1188 | [ | |
|
1189 | { | |
|
1190 | "date": *, (glob) | |
|
1191 | "flag": 0, | |
|
1192 | "index": 1, | |
|
1193 | "metadata": {"user": "test"}, | |
|
1194 | "precnode": "6fdef60fcbabbd3d50e9b9cbc2a240724b91a5e1", | |
|
1195 | "succnodes": ["d27fb9b066076fd921277a4b9e8b9cb48c95bc6a"] | |
|
1196 | }, | |
|
1197 | { | |
|
1198 | "date": *, (glob) | |
|
1199 | "flag": 0, | |
|
1200 | "index": 3, | |
|
1201 | "metadata": {"user": "test"}, | |
|
1202 | "precnode": "4715cf767440ed891755448016c2b8cf70760c30", | |
|
1203 | "succnodes": ["7ae79c5d60f049c7b0dd02f5f25b9d60aaf7b36d"] | |
|
1204 | } | |
|
1205 | ] | |
|
1113 | 1206 | |
|
1114 | 1207 | Test the --delete option of debugobsolete command |
|
1115 | 1208 | $ hg debugobsolete --index |
General Comments 0
You need to be logged in to leave comments.
Login now