Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
33273:5724aaa99dd6 | 33274:68f3e819d41d |
---|---|
2065 ui.write(('path %s\n') % k) | 2065 ui.write(('path %s\n') % k) |
2066 ui.write((' source %s\n') % v[0]) | 2066 ui.write((' source %s\n') % v[0]) |
2067 ui.write((' revision %s\n') % v[1]) | 2067 ui.write((' revision %s\n') % v[1]) |
2068 | 2068 |
2069 @command('debugsuccessorssets', | 2069 @command('debugsuccessorssets', |
2070 [], | 2070 [('', 'closest', False, _('return closest successors sets only'))], |
2071 _('[REV]')) | 2071 _('[REV]')) |
2072 def debugsuccessorssets(ui, repo, *revs): | 2072 def debugsuccessorssets(ui, repo, *revs, **opts): |
2073 """show set of successors for revision | 2073 """show set of successors for revision |
2074 | 2074 |
2075 A successors set of changeset A is a consistent group of revisions that | 2075 A successors set of changeset A is a consistent group of revisions that |
2076 succeed A. It contains non-obsolete changesets only. | 2076 succeed A. It contains non-obsolete changesets only unless closests |
2077 successors set is set. | |
2077 | 2078 |
2078 In most cases a changeset A has a single successors set containing a single | 2079 In most cases a changeset A has a single successors set containing a single |
2079 successor (changeset A replaced by A'). | 2080 successor (changeset A replaced by A'). |
2080 | 2081 |
2081 A changeset that is made obsolete with no successors are called "pruned". | 2082 A changeset that is made obsolete with no successors are called "pruned". |
2109 return ctx.hex() | 2110 return ctx.hex() |
2110 node2str = hex | 2111 node2str = hex |
2111 for rev in scmutil.revrange(repo, revs): | 2112 for rev in scmutil.revrange(repo, revs): |
2112 ctx = repo[rev] | 2113 ctx = repo[rev] |
2113 ui.write('%s\n'% ctx2str(ctx)) | 2114 ui.write('%s\n'% ctx2str(ctx)) |
2114 for succsset in obsutil.successorssets(repo, ctx.node(), cache=cache): | 2115 for succsset in obsutil.successorssets(repo, ctx.node(), |
2116 closest=opts['closest'], | |
2117 cache=cache): | |
2115 if succsset: | 2118 if succsset: |
2116 ui.write(' ') | 2119 ui.write(' ') |
2117 ui.write(node2str(succsset[0])) | 2120 ui.write(node2str(succsset[0])) |
2118 for node in succsset[1:]: | 2121 for node in succsset[1:]: |
2119 ui.write(' ') | 2122 ui.write(' ') |