Patchwork D6636: unshelve: changed Corruptedstate error msg from ui.warn to error.Abort

login
register
mail settings
Submitter phabricator
Date July 10, 2019, 6:21 p.m.
Message ID <differential-rev-PHID-DREV-g66mpwcxnznwsprhkpzv-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/40875/
State Superseded
Headers show

Comments

phabricator - July 10, 2019, 6:21 p.m.
taapas1128 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This changes the message type of Corruptedstate error in case of `hg unshelve --abort`
  to error.Abort from warning message. This is fone so as to avoid the return statement
  after the warning.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/shelve.py
  tests/test-shelve2.t

CHANGE DETAILS




To: taapas1128, #hg-reviewers
Cc: mercurial-devel
phabricator - July 10, 2019, 6:51 p.m.
pulkit added a comment.


  > This is fone so as to avoid the return statement
  
  s/fone/done in flight

INLINE COMMENTS

> shelve.py:884
>                  shelvedstate.clear(repo)
> -            return
> +                raise error.Abort(_('could not read shelved state file, your '
> +                                 'working copy may be in an unexpected state\n'

will fix this indentation in flight.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6636/new/

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

To: taapas1128, #hg-reviewers, pulkit
Cc: mercurial-devel
phabricator - July 10, 2019, 7:41 p.m.
taapas1128 added a comment.


  Fixed the message.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6636/new/

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

To: taapas1128, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/tests/test-shelve2.t b/tests/test-shelve2.t
--- a/tests/test-shelve2.t
+++ b/tests/test-shelve2.t
@@ -696,8 +696,10 @@ 
 
 Unshelve --abort works with a corrupted shelvedstate
   $ hg unshelve --abort
-  could not read shelved state file, your working copy may be in an unexpected state
+  abort: could not read shelved state file, your working copy may be in an unexpected state
   please update to some commit
+  
+  [255]
 
 Unshelve --abort fails with appropriate message if there's no unshelve in
 progress
diff --git a/mercurial/shelve.py b/mercurial/shelve.py
--- a/mercurial/shelve.py
+++ b/mercurial/shelve.py
@@ -880,12 +880,10 @@ 
                          'operation')
                 raise error.Abort(msg, hint=hint)
             elif abortf:
-                msg = _('could not read shelved state file, your working copy '
-                        'may be in an unexpected state\nplease update to some '
-                        'commit\n')
-                ui.warn(msg)
                 shelvedstate.clear(repo)
-            return
+                raise error.Abort(_('could not read shelved state file, your '
+                                 'working copy may be in an unexpected state\n'
+                                 'please update to some commit\n'))
 
         if abortf:
             return unshelveabort(ui, repo, state, opts)