Patchwork D5428: absorb: don't prompt to apply changes when there are none to apply

login
register
mail settings
Submitter phabricator
Date Dec. 15, 2018, 1:36 a.m.
Message ID <573baab694a8fb3280317720f897b8ef@localhost.localdomain>
Download mbox | patch
Permalink /patch/37169/
State Not Applicable
Headers show

Comments

phabricator - Dec. 15, 2018, 1:36 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGa08e12149bcb: absorb: don&#039;t prompt to apply changes when there are none to apply (authored by hooper, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5428?vs=12859&id=12864

REVISION DETAIL
  https://phab.mercurial-scm.org/D5428

AFFECTED FILES
  hgext/absorb.py
  tests/test-absorb.t

CHANGE DETAILS




To: hooper, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-absorb.t b/tests/test-absorb.t
--- a/tests/test-absorb.t
+++ b/tests/test-absorb.t
@@ -129,6 +129,20 @@ 
   nothing applied
   [1]
 
+The prompt is not given if there are no changes to be applied, even if there
+are some changes that won't be applied:
+
+  $ hg absorb
+  showing changes for a
+          @@ -0,2 +0,1 @@
+          -2b
+          -4d
+          +1
+  
+  0 changesets affected
+  nothing applied
+  [1]
+
 Insertaions:
 
   $ cat > a << EOF
diff --git a/hgext/absorb.py b/hgext/absorb.py
--- a/hgext/absorb.py
+++ b/hgext/absorb.py
@@ -971,9 +971,10 @@ 
                      label='absorb.description')
         fm.end()
     if not opts.get('dry_run'):
-        if not opts.get('apply_changes'):
-            if ui.promptchoice("apply changes (yn)? $$ &Yes $$ &No", default=1):
-                raise error.Abort(_('absorb cancelled\n'))
+        if (not opts.get('apply_changes') and
+            state.ctxaffected and
+            ui.promptchoice("apply changes (yn)? $$ &Yes $$ &No", default=1)):
+            raise error.Abort(_('absorb cancelled\n'))
 
         state.apply()
         if state.commit():