diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -551,8 +551,16 @@ if not self.keepf: if self.collapsef: collapsedas = newnode + + fm = None + if repo.ui.configbool('experimental', 'showhashchanges'): + fm = repo.ui.formatter('rebase', opts) + clearrebased(ui, repo, self.destmap, self.state, self.skipped, - collapsedas, self.keepf) + collapsedas, self.keepf, fm=fm) + + if fm: + fm.end() clearstatus(repo) clearcollapsemsg(repo) @@ -1517,7 +1525,7 @@ return originalwd, destmap, state def clearrebased(ui, repo, destmap, state, skipped, collapsedas=None, - keepf=False): + keepf=False, fm=None): """dispose of rebased revision at the end of the rebase If `collapsedas` is not None, the rebase was a collapse whose result if the @@ -1541,6 +1549,9 @@ succs = (newnode,) replacements[oldnode] = succs scmutil.cleanupnodes(repo, replacements, 'rebase', moves) + if fm: + fm.startitem() + scmutil.showchanges(replacements, fm) def pullrebase(orig, ui, repo, *args, **opts): 'Call rebase after pull if the latter has been invoked with --rebase' diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -236,6 +236,9 @@ coreconfigitem('experimental', 'revlogv2', default=None, ) +coreconfigitem('experimental', 'showhashchanges', + default=False, +) coreconfigitem('experimental', 'spacemovesdown', default=False, ) diff --git a/tests/test-rebase-base.t b/tests/test-rebase-base.t --- a/tests/test-rebase-base.t +++ b/tests/test-rebase-base.t @@ -415,4 +415,51 @@ | o 0: A +Enabling obsolete markers + + $ cat >> $HGRCPATH << EOF + > [experimental] + > stabilization=createmarkers + > showhashchanges=True + > EOF + +Testing the experimental.showhashchanges config + + $ hg rebase -s 4 -d 2 + rebasing 4:abc67d0cf023 "C" + rebasing 5:a701fddfacec "D" (tip) + 'abc67d0cf023' --> ['2e4b11ea9404'] + 'a701fddfacec' --> ['003ba25ccc56'] + 'abc67d0cf023' --> ['2e4b11ea9404'] + + $ hg tglog + o 7: D + | + o 6: C + | + | o 3: B + |/ + o 2: Z + | + o 1: Y + | + o 0: A + + +JSON output using the config + + $ hg rebase -s 6 -d 3 -Tjson + rebasing 6:2e4b11ea9404 "C" + rebasing 7:003ba25ccc56 "D" (tip) + [ + { + "hashchanges": {"003ba25ccc56": ["38bd5f90ba6a"], "2e4b11ea9404": ["583565ab89ac"]} + } + ] + +Using `-q` to make sure ui.status() things don't appear + + $ hg rebase -s 8 -d 2 -T '{hashchanges|json}' -q + {"38bd5f90ba6a": ["28cb79571ec7"], "583565ab89ac": ["89a178738706"]} (no-eol) + $ cd ..