# HG changeset patch # User Patrick Mezard # Date 1340092952 -7200 # Node ID 87e4d1eec5e870205ffd1c2ced2ae97338006bcb # Parent 78d01e341438e8c3e79f25d55de9f97f9075541f obsolete: add debugsuccessors command It dumps obsolete changesets and their successors. diff -r 78d01e341438 -r 87e4d1eec5e8 hgext/obsolete.py --- a/hgext/obsolete.py Mon Jun 18 12:11:06 2012 +0200 +++ b/hgext/obsolete.py Tue Jun 19 10:02:32 2012 +0200 @@ -433,9 +433,28 @@ l.release() ui.status('%i obsolete marker converted\n' % cnt) +def cmddebugsuccessors(ui, repo): + """dump obsolete changesets and their successors + + Each line matches an existing marker, the first identifier is the + obsolete changeset identifier, followed by it successors. + """ + lock = repo.lock() + try: + allsuccessors = repo.obsoletestore.objects + for old in sorted(allsuccessors): + successors = [sorted(m['subjects']) for m in allsuccessors[old]] + for i, group in enumerate(sorted(successors)): + ui.write('%s' % short(old)) + for new in group: + ui.write(' %s' % short(new)) + ui.write('\n') + finally: + lock.release() cmdtable = {'debugobsolete': (cmddebugobsolete, [], ' '), 'debugconvertobsolete': (cmddebugconvertobsolete, [], ''), + 'debugsuccessors': (cmddebugsuccessors, [], ''), } ### Altering existing command diff -r 78d01e341438 -r 87e4d1eec5e8 tests/test-amend.t --- a/tests/test-amend.t Mon Jun 18 12:11:06 2012 +0200 +++ b/tests/test-amend.t Tue Jun 19 10:02:32 2012 +0200 @@ -24,6 +24,10 @@ marked working directory as branch foo (branches are permanent and global, did you want a bookmark?) $ hg amend + $ hg debugsuccessors + 07f494440405 a34b93d251e4 + 07f494440405 bd19cbe78fbf + bd19cbe78fbf a34b93d251e4 $ hg branch foo $ hg branches @@ -59,6 +63,10 @@ $ hg amend --change 2 abort: no updates found [255] + $ hg debugsuccessors + 07f494440405 a34b93d251e4 + 07f494440405 bd19cbe78fbf + bd19cbe78fbf a34b93d251e4 $ hg phase 2 2: draft $ glog @@ -82,6 +90,11 @@ $ hg amend --change 2 abort: no updates found [255] + $ hg debugsuccessors + 07f494440405 a34b93d251e4 + 07f494440405 bd19cbe78fbf + 7384bbcba36f 000000000000 + bd19cbe78fbf a34b93d251e4 $ glog @ 6@foo(secret) amends a34b93d251e49c93d5685ebacad785c73a7e8605 |