diff mercurial/debugcommands.py @ 33274:68f3e819d41d

obsolete: closest divergent support Add a closest argument to successorssets changing the definition of latest successors. With "closest=false" (current behavior), latest successors are "leafs" on the obsmarker graph. They don't have any successor and are known locally. With "closest=true", latest successors are the closest locally-known changesets that are visible in the repository or repoview. Closest successors can be then obsolete, orphan. This will be used in a later patch to show the closest successor of changesets with the successorssets template.
author Boris Feld <boris.feld@octobus.net>
date Fri, 30 Jun 2017 15:27:19 +0200
parents 5724aaa99dd6
children 4672db164c98
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Fri Jun 30 15:02:19 2017 +0200
+++ b/mercurial/debugcommands.py	Fri Jun 30 15:27:19 2017 +0200
@@ -2067,13 +2067,14 @@
         ui.write((' revision %s\n') % v[1])
 
 @command('debugsuccessorssets',
-    [],
+    [('', 'closest', False, _('return closest successors sets only'))],
     _('[REV]'))
-def debugsuccessorssets(ui, repo, *revs):
+def debugsuccessorssets(ui, repo, *revs, **opts):
     """show set of successors for revision
 
     A successors set of changeset A is a consistent group of revisions that
-    succeed A. It contains non-obsolete changesets only.
+    succeed A. It contains non-obsolete changesets only unless closests
+    successors set is set.
 
     In most cases a changeset A has a single successors set containing a single
     successor (changeset A replaced by A').
@@ -2111,7 +2112,9 @@
     for rev in scmutil.revrange(repo, revs):
         ctx = repo[rev]
         ui.write('%s\n'% ctx2str(ctx))
-        for succsset in obsutil.successorssets(repo, ctx.node(), cache=cache):
+        for succsset in obsutil.successorssets(repo, ctx.node(),
+                                                closest=opts['closest'],
+                                                cache=cache):
             if succsset:
                 ui.write('    ')
                 ui.write(node2str(succsset[0]))