diff --git a/hgext/absorb.py b/hgext/absorb.py --- a/hgext/absorb.py +++ b/hgext/absorb.py @@ -21,6 +21,7 @@ amend-flag = correlated [color] + absorb.description = yellow absorb.node = blue bold absorb.path = bold """ @@ -74,6 +75,7 @@ configitem('absorb', 'max-stack-size', default=50) colortable = { + 'absorb.description': 'yellow', 'absorb.node': 'blue bold', 'absorb.path': 'bold', } @@ -297,6 +299,7 @@ self.targetlines = [] # [str] self.fixups = [] # [(linelog rev, a1, a2, b1, b2)] self.finalcontents = [] # [str] + self.ctxaffected = set() def diffwith(self, targetfctx, fm=None): """calculate fixups needed by examining the differences between @@ -577,6 +580,7 @@ ctx = self.fctxs[idx] fm.context(fctx=ctx) node = ctx.hex() + self.ctxaffected.add(ctx.changectx()) fm.write('node', '%-7.7s ', node, label='absorb.node') fm.write('diffchar ' + linetype, '%s%s\n', diffchar, line, label=linelabel) @@ -621,6 +625,7 @@ self.fixupmap = {} # {path: filefixupstate} self.replacemap = {} # {oldnode: newnode or None} self.finalnode = None # head after all fixups + self.ctxaffected = set() # ctx that will be absorbed into def diffwith(self, targetctx, match=None, fm=None): """diff and prepare fixups. update self.fixupmap, self.paths""" @@ -660,6 +665,7 @@ fstate.diffwith(targetfctx, fm) self.fixupmap[path] = fstate self.paths.append(path) + self.ctxaffected.update(fstate.ctxaffected) def apply(self): """apply fixups to individual filefixupstates""" @@ -950,6 +956,19 @@ fm = ui.formatter('absorb', opts) state.diffwith(targetctx, matcher, fm) if fm is not None: + fm.startitem() + fm.write("count", "\n%d changesets affected\n", len(state.ctxaffected)) + fm.data(linetype='summary') + for ctx in reversed(stack): + if ctx not in state.ctxaffected: + continue + fm.startitem() + fm.context(ctx=ctx) + fm.data(linetype='changeset') + fm.write('node', '%-7.7s ', ctx.hex(), label='absorb.node') + descfirstline = ctx.description().splitlines()[0] + fm.write('descfirstline', '%s\n', descfirstline, + label='absorb.description') fm.end() if not opts.get('dry_run'): state.apply() diff --git a/tests/test-absorb-rename.t b/tests/test-absorb-rename.t --- a/tests/test-absorb-rename.t +++ b/tests/test-absorb-rename.t @@ -43,6 +43,11 @@ eff892d +1a bf56e1f +2a 0b888b0 +3a + + 3 changesets affected + 0b888b0 3 + bf56e1f 2 + eff892d 1 $ hg status @@ -66,6 +71,10 @@ +1A 9a14ffe +2A 9191d12 +3A + + 2 changesets affected + 9191d12 3 + 9a14ffe 2 $ hg diff diff --git a/a b/a @@ -107,6 +116,10 @@ 17b7212 -2 +1b 17b7212 +2b + + 2 changesets affected + 17b7212 2 + eff892d 1 $ hg diff diff --git a/b b/b @@ -147,6 +160,10 @@ @@ -0,1 +0,1 @@ 55105f9 -1 55105f9 +1a + + 2 changesets affected + e62c256 2 + 55105f9 1 $ hg diff diff --git a/a b/a @@ -192,6 +209,10 @@ 366daad -3 +1c 366daad +3c + + 2 changesets affected + 366daad cp + 55105f9 1 $ hg log -G -p -T '{rev}:{node|short} {desc}\n' @ 1:70606019f91b cp @@ -228,6 +249,9 @@ @@ -0,1 +0,1 @@ 7060601 -1 7060601 +1c + + 1 changesets affected + 7060601 cp $ hg log -G -p -T '{rev}:{node|short} {desc}\n' @ 1:8bd536cce368 cp @@ -298,6 +322,10 @@ 7bc3d43 -2 +1e 7bc3d43 +2e + + 2 changesets affected + 7bc3d43 cp + 55105f9 1 $ hg diff diff --git a/e b/e diff --git a/tests/test-absorb.t b/tests/test-absorb.t --- a/tests/test-absorb.t +++ b/tests/test-absorb.t @@ -59,6 +59,12 @@ 4f55fa6 -5 ad8b8b7 +4d 4f55fa6 +5e + + 4 changesets affected + 4f55fa6 commit 5 + ad8b8b7 commit 4 + 5c5f952 commit 2 + 4ec16f8 commit 1 Run absorb: @@ -173,6 +179,9 @@ @@ -3,1 +3,1 @@ 85b4e0e -Insert aftert 4d 85b4e0e +insert aftert 4d + + 1 changesets affected + 85b4e0e commit 4 $ hg absorb saved backup bundle to * (glob) 1 of 2 chunk(s) applied @@ -290,6 +299,9 @@ 712d16a -b Line 2 +b line 1 712d16a +b line 2 + + 1 changesets affected + 712d16a commit b 2 Test obsolete markers creation: @@ -352,6 +364,9 @@ @@ -0,1 +0,1 @@ 99b4ae7 - 99b4ae7 +bla + + 1 changesets affected + 99b4ae7 foo $ hg absorb 1 of 1 chunk(s) applied $ hg diff -c . @@ -393,6 +408,12 @@ 1154859 -2 30970db -3 a393a58 -4 + + 4 changesets affected + a393a58 b4 + 30970db b3 + 1154859 b12 + bfafb49 a12 $ hg absorb -v | grep became bfafb49242db: 1 file(s) changed, became 1a2de97fc652 115485984805: 2 file(s) changed, became 0c930dfab74c @@ -443,6 +464,10 @@ @@ -2,2 +2,0 @@ f1c23dd -3 82dbe7f -4 + + 2 changesets affected + 82dbe7f a1234 + f1c23dd a123 $ hg absorb --verbose f1c23dd5d08d: became empty and was dropped 82dbe7fd19f0: became empty and was dropped