Patchwork D6504: statecheck: changed hint message format

login
register
mail settings
Submitter phabricator
Date June 10, 2019, 2:56 p.m.
Message ID <a3896257ce58fdac08d85a0363a39def@localhost.localdomain>
Download mbox | patch
Permalink /patch/40398/
State Not Applicable
Headers show

Comments

phabricator - June 10, 2019, 2:56 p.m.
taapas1128 updated this revision to Diff 15415.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6504?vs=15409&id=15415

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

AFFECTED FILES
  hgext/histedit.py
  hgext/rebase.py
  hgext/transplant.py
  mercurial/state.py
  tests/test-absorb-unfinished.t
  tests/test-fix.t
  tests/test-graft.t
  tests/test-histedit-arguments.t
  tests/test-histedit-edit.t
  tests/test-histedit-fold.t
  tests/test-histedit-no-change.t
  tests/test-qrecord.t
  tests/test-rebase-abort.t
  tests/test-rebase-conflicts.t
  tests/test-rebase-obsolete.t
  tests/test-rebase-pull.t
  tests/test-shelve.t
  tests/test-transplant.t

CHANGE DETAILS




To: taapas1128, durin42, martinvonz, #hg-reviewers
Cc: mjpieters, mercurial-devel

Patch

diff --git a/tests/test-transplant.t b/tests/test-transplant.t
--- a/tests/test-transplant.t
+++ b/tests/test-transplant.t
@@ -479,7 +479,8 @@ 
   [255]
   $ hg transplant 1:3
   abort: transplant in progress
-  (use 'hg transplant --continue' or 'hg update' to abort)
+  (To continue:    hg transplant --continue
+  To abort:       hg update)
   [255]
   $ echo fixed > baz
   $ hg transplant --continue
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -375,7 +375,8 @@ 
   # 
   # To mark files as resolved:  hg resolve --mark FILE
   
-  # use 'hg unshelve --continue' or 'hg unshelve --abort'
+  # To continue:    hg unshelve --continue
+  # To abort:       hg unshelve --abort
   
 
 ensure that we have a merge with unresolved conflicts
@@ -426,7 +427,8 @@ 
 
   $ hg shelve
   abort: unshelve already in progress
-  (use 'hg unshelve --continue' or 'hg unshelve --abort')
+  (To continue:    hg unshelve --continue
+  To abort:       hg unshelve --abort)
   [255]
 
 abort the unshelve and be happy
@@ -484,7 +486,8 @@ 
 
   $ hg commit -m 'commit while unshelve in progress'
   abort: unshelve already in progress
-  (use 'hg unshelve --continue' or 'hg unshelve --abort')
+  (To continue:    hg unshelve --continue
+  To abort:       hg unshelve --abort)
   [255]
 
   $ hg graft --continue
diff --git a/tests/test-rebase-pull.t b/tests/test-rebase-pull.t
--- a/tests/test-rebase-pull.t
+++ b/tests/test-rebase-pull.t
@@ -93,7 +93,8 @@ 
   [1]
   $ hg pull --rebase
   abort: histedit in progress
-  (use 'hg histedit --continue' or 'hg histedit --abort')
+  (To continue:    hg histedit --continue
+  To abort:       hg histedit --abort)
   [255]
   $ hg histedit --abort --quiet
 
diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
--- a/tests/test-rebase-obsolete.t
+++ b/tests/test-rebase-obsolete.t
@@ -2054,7 +2054,8 @@ 
 
   $ hg rebase -s 3 -d 5
   abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
+  (To continue:    hg rebase --continue
+  To abort:       hg rebase --abort)
   [255]
   $ hg rebase --stop --continue
   abort: cannot use --stop with --continue
diff --git a/tests/test-rebase-conflicts.t b/tests/test-rebase-conflicts.t
--- a/tests/test-rebase-conflicts.t
+++ b/tests/test-rebase-conflicts.t
@@ -80,7 +80,8 @@ 
   # 
   # To mark files as resolved:  hg resolve --mark FILE
   
-  # use 'hg rebase --continue' or 'hg rebase --abort'
+  # To continue:    hg rebase --continue
+  # To abort:       hg rebase --abort
   
 
 Try to continue without solving the conflict:
diff --git a/tests/test-rebase-abort.t b/tests/test-rebase-abort.t
--- a/tests/test-rebase-abort.t
+++ b/tests/test-rebase-abort.t
@@ -319,7 +319,8 @@ 
   $ echo new > a
   $ hg up 1               # user gets an error saying to run hg rebase --abort
   abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
+  (To continue:    hg rebase --continue
+  To abort:       hg rebase --abort)
   [255]
 
   $ cat a
@@ -389,20 +390,24 @@ 
 
   $ hg rebase -s 3 -d tip
   abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
+  (To continue:    hg rebase --continue
+  To abort:       hg rebase --abort)
   [255]
   $ hg up .
   abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
+  (To continue:    hg rebase --continue
+  To abort:       hg rebase --abort)
   [255]
   $ hg up -C .
   abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
+  (To continue:    hg rebase --continue
+  To abort:       hg rebase --abort)
   [255]
 
   $ hg graft 3
   abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
+  (To continue:    hg rebase --continue
+  To abort:       hg rebase --abort)
   [255]
 
   $ hg rebase --abort
diff --git a/tests/test-qrecord.t b/tests/test-qrecord.t
--- a/tests/test-qrecord.t
+++ b/tests/test-qrecord.t
@@ -459,5 +459,6 @@ 
   > n
   > EOF
   abort: histedit in progress
-  (use 'hg histedit --continue' or 'hg histedit --abort')
-  [255]
+  (To continue:    hg histedit --continue
+  To abort:       hg histedit --abort)
+  [255]
diff --git a/tests/test-histedit-no-change.t b/tests/test-histedit-no-change.t
--- a/tests/test-histedit-no-change.t
+++ b/tests/test-histedit-no-change.t
@@ -168,7 +168,8 @@ 
 abort editing session, after first forcibly updating away
   $ hg up 0
   abort: histedit in progress
-  (use 'hg histedit --continue' or 'hg histedit --abort')
+  (To continue:    hg histedit --continue
+  To abort:       hg histedit --abort)
   [255]
   $ mv .hg/histedit-state .hg/histedit-state-ignore
   $ hg up 0
diff --git a/tests/test-histedit-fold.t b/tests/test-histedit-fold.t
--- a/tests/test-histedit-fold.t
+++ b/tests/test-histedit-fold.t
@@ -306,7 +306,8 @@ 
   # 
   # To mark files as resolved:  hg resolve --mark FILE
   
-  # use 'hg histedit --continue' or 'hg histedit --abort'
+  # To continue:    hg histedit --continue
+  # To abort:       hg histedit --abort
   
   $ hg resolve -l
   U file
diff --git a/tests/test-histedit-edit.t b/tests/test-histedit-edit.t
--- a/tests/test-histedit-edit.t
+++ b/tests/test-histedit-edit.t
@@ -81,7 +81,8 @@ 
 try to update and get an error
   $ hg update tip
   abort: histedit in progress
-  (use 'hg histedit --continue' or 'hg histedit --abort')
+  (To continue:    hg histedit --continue
+  To abort:       hg histedit --abort)
   [255]
 
 edit the plan via the editor
@@ -135,7 +136,8 @@ 
   3+
   $ hg up 0
   abort: histedit in progress
-  (use 'hg histedit --continue' or 'hg histedit --abort')
+  (To continue:    hg histedit --continue
+  To abort:       hg histedit --abort)
   [255]
 
 Try to delete necessary commit
@@ -152,7 +154,8 @@ 
 
   $ hg --config extensions.mq= qnew please-fail
   abort: histedit in progress
-  (use 'hg histedit --continue' or 'hg histedit --abort')
+  (To continue:    hg histedit --continue
+  To abort:       hg histedit --abort)
   [255]
   $ HGEDITOR='echo foobaz > ' hg histedit --continue 2>&1 | fixbundle
 
diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t
--- a/tests/test-histedit-arguments.t
+++ b/tests/test-histedit-arguments.t
@@ -494,7 +494,8 @@ 
   continue: hg histedit --continue
   $ hg commit --amend -m 'reject this fold'
   abort: histedit in progress
-  (use 'hg histedit --continue' or 'hg histedit --abort')
+  (To continue:    hg histedit --continue
+  To abort:       hg histedit --abort)
   [255]
 
 With markers enabled, histedit does not get confused, and
diff --git a/tests/test-graft.t b/tests/test-graft.t
--- a/tests/test-graft.t
+++ b/tests/test-graft.t
@@ -278,14 +278,18 @@ 
   # 
   # To mark files as resolved:  hg resolve --mark FILE
   
-  # use 'hg graft --continue' or 'hg graft --stop' to stop
+  # To continue:    hg graft --continue
+  # To abort:       hg graft --abort
+  # To stop:        hg graft --stop
   
 
 Commit while interrupted should fail:
 
   $ hg ci -m 'commit interrupted graft'
   abort: graft in progress
-  (use 'hg graft --continue' or 'hg graft --stop' to stop)
+  (To continue:    hg graft --continue
+  To abort:       hg graft --abort
+  To stop:        hg graft --stop)
   [255]
 
 Abort the graft and try committing:
diff --git a/tests/test-fix.t b/tests/test-fix.t
--- a/tests/test-fix.t
+++ b/tests/test-fix.t
@@ -801,7 +801,8 @@ 
 
   $ hg --config extensions.rebase= fix -r .
   abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
+  (To continue:    hg rebase --continue
+  To abort:       hg rebase --abort)
   [255]
 
 When fixing a file that was renamed, we should diff against the source of the
diff --git a/tests/test-absorb-unfinished.t b/tests/test-absorb-unfinished.t
--- a/tests/test-absorb-unfinished.t
+++ b/tests/test-absorb-unfinished.t
@@ -25,6 +25,7 @@ 
 
   $ hg --config extensions.rebase= absorb
   abort: rebase in progress
-  (use 'hg rebase --continue' or 'hg rebase --abort')
+  (To continue:    hg rebase --continue
+  To abort:       hg rebase --abort)
   [255]
 
diff --git a/mercurial/state.py b/mercurial/state.py
--- a/mercurial/state.py
+++ b/mercurial/state.py
@@ -98,7 +98,7 @@ 
     """
 
     def __init__(self, cmdname, fname, clearable=False, allowcommit=False,
-                 cmdmsg="", cmdhint=""):
+                 cmdmsg="", cmdhint="", stopflag=False):
         """cmdname is the name the command
         fname is the file name in which data should be stored in .hg directory.
         It is None for merge command.
@@ -109,21 +109,29 @@ 
         cmdmsg is used to pass a different status message in case standard
         message of the format "abort: cmdname in progress" is not required.
         cmdhint is used to pass a different hint message in case standard
-        message of the format use 'hg cmdname --continue' or
-        'hg cmdname --abort'" is not required.
+        message of the format "To continue: hg cmdname --continue  
+        To abort: hg cmdname --abort" is not required.
+        stopflag is a boolean that determines whether or not a command supports
+        --stop flag
         """
         self.cmdname = cmdname
         self.fname = fname
         self.clearable = clearable
         self.allowcommit = allowcommit
         self.cmdhint = cmdhint
         self.cmdmsg = cmdmsg
+        self.stopflag = stopflag
 
     def hint(self):
         """returns the hint message corresponding to the command"""
         if not self.cmdhint == "":
-                return (_("use 'hg %s --continue' or 'hg %s --abort'") %
-                        (self.cmdname,self.cmdname))
+            hint = (_('To continue:    hg %s --continue\n'
+                      'To abort:       hg %s --abort') % (self.cmdname,
+                       self.cmdname))
+            if self.stopflag:
+                hint = hint + (_('\nTo stop:        hg %s --stop') %
+                                (self.cmdname))
+            return hint
         return self.cmdhint
 
     def msg(self):
@@ -145,7 +153,8 @@ 
 unfinishedstates=[]
 unfinishedstates.append(statecheck('graft', 'graftstate', clearable=True,
                                     allowcommit=False, cmdhint=_("use 'hg graft"
-                                  " --continue' or 'hg graft --stop' to stop")))
+                                  " --continue' or 'hg graft --stop' to stop"),
+                                  stopflag=True))
 unfinishedstates.append(statecheck('bisect', 'bisect.state', clearable=False,
                                    allowcommit=True, cmdhint=
                         _('To mark the changeset good:    hg bisect --good\n'
diff --git a/hgext/transplant.py b/hgext/transplant.py
--- a/hgext/transplant.py
+++ b/hgext/transplant.py
@@ -760,7 +760,8 @@ 
 def extsetup(ui):
     statemod.unfinishedstates.append(statemod.statecheck('transplant',
     'transplant/journal', clearable=True, allowcommit=False ,
-    cmdhint=_("use 'hg transplant --continue' or 'hg update' to abort")))
+    cmdhint=_('To continue:    hg transplant --continue\n'
+              'To abort:       hg update')))
 
 # tell hggettext to extract docstrings from these functions:
 i18nfunctions = [revsettransplanted, kwtransplanted]
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1948,6 +1948,6 @@ 
                      _("specify merge tool for rebase")))
     cmdutil.summaryhooks.add('rebase', summaryhook)
     statemod.unfinishedstates.append(statemod.statecheck('rebase',
-    'rebasestate', clearable=False, allowcommit=False))
+    'rebasestate', clearable=False, allowcommit=False, stopflag=False))
     cmdutil.afterresolvedstates.append(
         ['rebasestate', _('hg rebase --continue')])
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -2289,6 +2289,6 @@ 
 def extsetup(ui):
     cmdutil.summaryhooks.add('histedit', summaryhook)
     statemod.unfinishedstates.append(statemod.statecheck('histedit',
-    'histedit-state', clearable=False, allowcommit=True))
+    'histedit-state', clearable=False, allowcommit=True, stopflag=False))
     cmdutil.afterresolvedstates.append(
         ['histedit-state', _('hg histedit --continue')])