D6652: continue: added support for unshelve

2019-07-17 Thread taapas1128 (Taapas Agrawal)
Closed by commit rHG3072efd46d1c: continue: added support for unshelve 
(authored by taapas1128).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6652?vs=15939=15943

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

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

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

CHANGE DETAILS

diff --git a/tests/test-shelve2.t b/tests/test-shelve2.t
--- a/tests/test-shelve2.t
+++ b/tests/test-shelve2.t
@@ -1,5 +1,6 @@
 #testcases stripbased phasebased
 #testcases abortflag abortcommand
+#testcases continueflag continuecommand
 
   $ cat <> $HGRCPATH
   > [extensions]
@@ -27,6 +28,13 @@
   > EOF
 #endif
 
+#if continueflag
+  $ cat >> $HGRCPATH < [alias]
+  > continue = unshelve --continue
+  > EOF
+#endif
+
 shelve should leave dirstate clean (issue4055)
 
   $ hg init shelverebase
@@ -560,7 +568,7 @@
   $ hg resolve --mark a
   (no more unresolved files)
   continue: hg unshelve --continue
-  $ hg unshelve --continue
+  $ hg continue
   marked working directory as branch test
   unshelve of 'default' complete
   $ cat a
@@ -641,7 +649,13 @@
   $ hg resolve --mark a
   (no more unresolved files)
   continue: hg unshelve --continue
-  $ hg unshelve --continue
+
+#if continuecommand
+  $ hg continue --dry-run
+  unshelve in progress, will be resumed
+#endif
+
+  $ hg continue
   unshelve of 'default' complete
   $ cat a
   aaabbbccc
@@ -704,7 +718,7 @@
   $ echo somethingsomething > .hg/shelvedstate
 
 Unshelve --continue fails with appropriate message if shelvedstate is corrupted
-  $ hg unshelve --continue
+  $ hg continue
   abort: corrupted shelved state file
   (please run hg unshelve --abort to abort unshelve operation)
   [255]
@@ -751,7 +765,7 @@
   $ hg resolve --mark file
   (no more unresolved files)
   continue: hg unshelve --continue
-  $ hg unshelve --continue
+  $ hg continue
   unshelve of 'default' complete
   $ hg shelve --list
   default (*s ago) * changes to: 1 (glob)
@@ -822,7 +836,7 @@
   (no more unresolved files)
   continue: hg unshelve --continue
 mercurial does not crash
-  $ hg unshelve --continue
+  $ hg continue
   unshelve of 'ashelve' complete
 
 #if phasebased
diff --git a/mercurial/shelve.py b/mercurial/shelve.py
--- a/mercurial/shelve.py
+++ b/mercurial/shelve.py
@@ -751,6 +751,12 @@
 unshelvecleanup(ui, repo, state.name, opts)
 ui.status(_("unshelve of '%s' complete\n") % state.name)
 
+def hgcontinueunshelve(ui, repo):
+"""logic to resume unshelve using 'hg continue'"""
+with repo.wlock():
+state = _loadshelvedstate(ui, repo, {'continue' : True})
+return unshelvecontinue(ui, repo, state, {'keep' : state.keep})
+
 def _commitworkingcopychanges(ui, repo, opts, tmpwctx):
 """Temporarily commit working copy changes before moving unshelve commit"""
 # Store pending changes in a commit and remember added in case a shelve
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -6219,6 +6219,7 @@
 statemod.addunfinished(
 'unshelve', fname='shelvedstate', continueflag=True,
 abortfunc=shelvemod.hgabortunshelve,
+continuefunc=shelvemod.hgcontinueunshelve,
 cmdmsg=_('unshelve already in progress'),
 )
 



To: taapas1128, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6652: continue: added support for unshelve

2019-07-17 Thread taapas1128 (Taapas Agrawal)
taapas1128 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This patch adds the support for `ushelve` in `hg continue` plan.
  
  `hgcontinueunshelve()` has been created for independent calls.
  In case an interrupted unshelve is resumed via hg continue the
  shelvedstate needs to be loaded seperately. This has been
  ensured by `_loadunshelvedstate()`
  
  `hgcontinueunshelve()` is then registered as `continuefunc` for state
  detection API.
  
  Results are shown as tests.

REPOSITORY
  rHG Mercurial

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

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

CHANGE DETAILS

diff --git a/tests/test-shelve2.t b/tests/test-shelve2.t
--- a/tests/test-shelve2.t
+++ b/tests/test-shelve2.t
@@ -1,5 +1,6 @@
 #testcases stripbased phasebased
 #testcases abortflag abortcommand
+#testcases continueflag continuecommand
 
   $ cat <> $HGRCPATH
   > [extensions]
@@ -27,6 +28,13 @@
   > EOF
 #endif
 
+#if continueflag
+  $ cat >> $HGRCPATH < [alias]
+  > continue = unshelve --continue
+  > EOF
+#endif
+
 shelve should leave dirstate clean (issue4055)
 
   $ hg init shelverebase
@@ -560,7 +568,7 @@
   $ hg resolve --mark a
   (no more unresolved files)
   continue: hg unshelve --continue
-  $ hg unshelve --continue
+  $ hg continue
   marked working directory as branch test
   unshelve of 'default' complete
   $ cat a
@@ -641,7 +649,13 @@
   $ hg resolve --mark a
   (no more unresolved files)
   continue: hg unshelve --continue
-  $ hg unshelve --continue
+
+#if continuecommand
+  $ hg continue --dry-run
+  unshelve in progress, will be resumed
+#endif
+
+  $ hg continue
   unshelve of 'default' complete
   $ cat a
   aaabbbccc
@@ -704,7 +718,7 @@
   $ echo somethingsomething > .hg/shelvedstate
 
 Unshelve --continue fails with appropriate message if shelvedstate is corrupted
-  $ hg unshelve --continue
+  $ hg continue
   abort: corrupted shelved state file
   (please run hg unshelve --abort to abort unshelve operation)
   [255]
@@ -751,7 +765,7 @@
   $ hg resolve --mark file
   (no more unresolved files)
   continue: hg unshelve --continue
-  $ hg unshelve --continue
+  $ hg continue
   unshelve of 'default' complete
   $ hg shelve --list
   default (*s ago) * changes to: 1 (glob)
@@ -822,7 +836,7 @@
   (no more unresolved files)
   continue: hg unshelve --continue
 mercurial does not crash
-  $ hg unshelve --continue
+  $ hg continue
   unshelve of 'ashelve' complete
 
 #if phasebased
diff --git a/mercurial/shelve.py b/mercurial/shelve.py
--- a/mercurial/shelve.py
+++ b/mercurial/shelve.py
@@ -751,6 +751,12 @@
 unshelvecleanup(ui, repo, state.name, opts)
 ui.status(_("unshelve of '%s' complete\n") % state.name)
 
+def hgcontinueunshelve(ui, repo):
+"""logic to resume unshelve using 'hg continue'"""
+with repo.wlock():
+state = _loadshelvedstate(ui, repo, {'continue' : True})
+return unshelvecontinue(ui, repo, state, {'keep' : state.keep})
+
 def _commitworkingcopychanges(ui, repo, opts, tmpwctx):
 """Temporarily commit working copy changes before moving unshelve commit"""
 # Store pending changes in a commit and remember added in case a shelve
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -6219,6 +6219,7 @@
 statemod.addunfinished(
 'unshelve', fname='shelvedstate', continueflag=True,
 abortfunc=shelvemod.hgabortunshelve,
+continuefunc=shelvemod.hgcontinueunshelve,
 cmdmsg=_('unshelve already in progress'),
 )
 



To: taapas1128, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel