absorb: fix interactive mode I didn't know existed
authorAugie Fackler <augie@google.com>
Mon, 20 May 2019 14:00:12 -0400
changeset 42373 86f17fc31aa8
parent 42372 e0ac310bd033
child 42374 1bc7d4cb4182
absorb: fix interactive mode I didn't know existed While investigating a bug in `hg absorb -e` I unintentionally discovered `hg absorb --interactive` and its brokenness. This adds a test and restores the functionality. Note that this interface is still marked experimental, so we can change this to be more sophisticated in the future. Differential Revision: https://phab.mercurial-scm.org/D6411
hgext/absorb.py
tests/test-absorb.t
--- a/hgext/absorb.py	Fri May 17 11:13:12 2019 -0400
+++ b/hgext/absorb.py	Mon May 20 14:00:12 2019 -0400
@@ -935,7 +935,7 @@
     if opts.get('interactive'):
         diff = patch.diff(repo, stack[-1].node(), targetctx.node(), matcher)
         origchunks = patch.parsepatch(diff)
-        chunks = cmdutil.recordfilter(ui, origchunks)[0]
+        chunks = cmdutil.recordfilter(ui, origchunks, matcher)[0]
         targetctx = overlaydiffcontext(stack[-1], chunks)
     fm = None
     if opts.get('print_changes') or not opts.get('apply_changes'):
--- a/tests/test-absorb.t	Fri May 17 11:13:12 2019 -0400
+++ b/tests/test-absorb.t	Mon May 20 14:00:12 2019 -0400
@@ -399,6 +399,23 @@
   
   1 changesets affected
   99b4ae7 foo
+  $ hg absorb --dry-run --interactive --print-changes
+  diff -r 99b4ae712f84 foo.py
+  1 hunks, 1 lines changed
+  examine changes to 'foo.py'? [Ynesfdaq?] y
+  
+  @@ -1,1 +1,1 @@
+  -
+  +bla
+  record this change to 'foo.py'? [Ynesfdaq?] y
+  
+  showing changes for foo.py
+          @@ -0,1 +0,1 @@
+  99b4ae7 -
+  99b4ae7 +bla
+  
+  1 changesets affected
+  99b4ae7 foo
   $ hg absorb --apply-changes
   1 of 1 chunk(s) applied
   $ hg diff -c .