diff hgext/obsolete.py @ 273:87e4d1eec5e8

obsolete: add debugsuccessors command It dumps obsolete changesets and their successors.
author Patrick Mezard <patrick@mezard.eu>
date Tue, 19 Jun 2012 10:02:32 +0200
parents 3ff969da57ef
children 6622a24f3b0f
line wrap: on
line diff
--- 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, [], '<subject> <object>'),
             'debugconvertobsolete': (cmddebugconvertobsolete, [], ''),
+            'debugsuccessors': (cmddebugsuccessors, [], ''),
            }
 
 ### Altering existing command