D6504: statecheck: changed hint message format

taapas1128 (Taapas Agrawal) phabricator at mercurial-scm.org
Sat Jun 8 21:01:53 UTC 2019


taapas1128 created this revision.
Herald added a reviewer: durin42.
Herald added subscribers: mercurial-devel, mjpieters.
Herald added a reviewer: martinvonz.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This changes the old message format used by `unfinishedstates`
  to the format which was used by `STATES`.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/histedit.py
  hgext/rebase.py
  hgext/shelve.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

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
@@ -97,7 +97,8 @@
        multistep operation or multistep command extension.
     """
 
-    def __init__(self, cmdname, fname, clearable=False, allowcommit=False):
+    def __init__(self, cmdname, fname, clearable=False, allowcommit=False,
+                 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.
@@ -112,25 +113,29 @@
         self.fname = fname
         self.clearable = clearable
         self.allowcommit = allowcommit
+        self.stopflag = stopflag
 
     def hint(self):
         """returns the hint message corresponding to the command"""
         if self.cmdname == 'bisect':
             msg = _('To mark the changeset good:    hg bisect --good\n'
                     'To mark the changeset bad:     hg bisect --bad\n'
                     'To abort:                      hg bisect --reset\n')
-        elif self.cmdname == 'graft':
-            msg = _("use 'hg graft --continue' or 'hg graft --stop' to stop")
-        elif self.cmdname == 'merge':
-            msg = _('To continue:    hg commit\n'
-                    'To abort:       hg merge --abort')
         elif self.cmdname == 'update':
             msg = _("use 'hg update' to get a consistent checkout")
         elif self.cmdname == 'transplant':
-            msg = _("use 'hg transplant --continue' or 'hg update' to abort")
+                msg = _('To continue:    hg %s --continue\n'
+                        'To abort:       hg update') % (self.cmdname)
+        elif self.cmdname == 'merge':
+                msg = _('To continue:    hg commit\n'
+                        'To abort:       hg %s --abort') % (self.cmdname)
         else:
-            msg = (_("use 'hg %s --continue' or 'hg %s --abort'") %
-            (self.cmdname, self.cmdname))
+            msg = (_('To continue:    hg %s --continue\n'
+                    'To abort:       hg %s --abort') % (self.cmdname,
+                    self.cmdname))
+            if self.stopflag:
+                msg = msg + (_('\nTo stop:        hg %s --stop') %
+                     (self.cmdname))
         return msg
 
     def msg(self):
@@ -154,13 +159,13 @@
 
 unfinishedstates=[]
 unfinishedstates.append(statecheck('graft', 'graftstate', clearable=True,
-                                   allowcommit=False))
+                                   allowcommit=False, stopflag=True))
 unfinishedstates.append(statecheck('bisect', 'bisect.state', clearable=False,
-                                   allowcommit=True))
+                                   allowcommit=True, stopflag=False))
 unfinishedstates.append(statecheck('update', 'updatestate', clearable=True,
-                                    allowcommit=False))
+                                    allowcommit=False, stopflag=False))
 unfinishedstates.append(statecheck('merge', 'None', clearable=False,
-                                    allowcommit=False))
+                                    allowcommit=False, stopflag=False))
 
 def checkunfinished(repo, commit=False):
     '''Look for an unfinished multistep operation, like graft, and abort
diff --git a/hgext/transplant.py b/hgext/transplant.py
--- a/hgext/transplant.py
+++ b/hgext/transplant.py
@@ -759,7 +759,7 @@
 
 def extsetup(ui):
     statemod.unfinishedstates.append(statemod.statecheck('transplant',
-    'transplant/journal', clearable=True, allowcommit=False))
+    'transplant/journal', clearable=True, allowcommit=False, stopflag=False))
 
 # tell hggettext to extract docstrings from these functions:
 i18nfunctions = [revsettransplanted, kwtransplanted]
diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -1141,7 +1141,7 @@
 
 def extsetup(ui):
     statemod.unfinishedstates.append(statemod.statecheck('unshelve',
-    shelvedstate._filename, clearable=False, allowcommit=False))
+    shelvedstate._filename, clearable=False, allowcommit=False, stopflag=False))
     cmdutil.afterresolvedstates.append(
         [shelvedstate._filename, _('hg unshelve --continue')])
 
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')])



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


More information about the Mercurial-devel mailing list