Patchwork [1,of,2,STABLE] shelve: disallow commit while unshelve is in progress

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Oct. 28, 2013, 4:14 p.m.
Message ID <5cbd059b04e23c6abb2d.1382976853@feefifofum>
Download mbox | patch
Permalink /patch/2827/
State Accepted
Commit 6f29cc567845cbc819c90718b64566b6b0d26062
Headers show

Comments

Katsunori FUJIWARA - Oct. 28, 2013, 4:14 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1382976223 -32400
#      Tue Oct 29 01:03:43 2013 +0900
# Branch stable
# Node ID 5cbd059b04e23c6abb2d2f5254658bf7adf2f131
# Parent  1d7a36ff2615e6e12ce65681db4e07622e7b60d1
shelve: disallow commit while unshelve is in progress

Before this patch, commit is allowed even while unshelve is in
progress.

In the other hand, "hg unshelve --abort" and "hg unshelve --continue"
check whether parent revisions of the working directory have changed
or not since last "hg unshelve", and abort without clearing state for
unshelve in progress if they have.

This causes that accidental commit makes clearing state for unshelve
difficult in ordinary ways.

This patch disallows commit while unshelve is in progress for
consistency.

Patch

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -704,5 +704,6 @@ 
 
 def extsetup(ui):
     cmdutil.unfinishedstates.append(
-        [shelvedstate._filename, False, True, _('unshelve already in progress'),
+        [shelvedstate._filename, False, False,
+         _('unshelve already in progress'),
          _("use 'hg unshelve --continue' or 'hg unshelve --abort'")])
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -303,6 +303,11 @@ 
   $ hg revert -r . a/a
   $ hg resolve -m a/a
 
+  $ hg commit -m 'commit while unshelve in progress'
+  abort: unshelve already in progress
+  (use 'hg unshelve --continue' or 'hg unshelve --abort')
+  [255]
+
   $ hg unshelve -c
   unshelve of 'default' complete