D6684: unshelve: modify --continue on interactive unshelve

2019-07-25 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh added a comment.


  In D6684#97930 , @pulkit wrote:
  
  > Sorry for getting this and the parent patch split before, after the recent 
improvements, it looks like they should be folded into one.
  
  Cool. Changes from this patch is folded to affect in D6679 
. Abandoning this.

REPOSITORY
  rHG Mercurial

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

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

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


D6684: unshelve: modify --continue on interactive unshelve

2019-07-25 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  Sorry for getting this and the parent patch split before, after the recent 
improvements, it looks like they should be folded into one.

REPOSITORY
  rHG Mercurial

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

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

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


D6684: unshelve: modify --continue on interactive unshelve

2019-07-24 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh edited the summary of this revision.
navaneeth.suresh updated this revision to Diff 16058.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6684?vs=16056=16058

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

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

AFFECTED FILES
  mercurial/shelve.py

CHANGE DETAILS

diff --git a/mercurial/shelve.py b/mercurial/shelve.py
--- a/mercurial/shelve.py
+++ b/mercurial/shelve.py
@@ -698,11 +698,12 @@
 if shfile.exists():
 shfile.movetobackup()
 cleanupoldbackups(repo)
-def unshelvecontinue(ui, repo, state, opts, basename=None):
+def unshelvecontinue(ui, repo, state, opts):
 """subcommand to continue an in-progress unshelve"""
 # We're finishing off a merge. First parent is our original
 # parent, second is the temporary "fake" commit we're unshelving.
 interactive = state.interactive
+basename = state.name
 with repo.lock():
 checkparents(repo, state)
 ms = merge.mergestate.read(repo)
@@ -933,7 +934,7 @@
 if opts.get("name"):
 shelved.append(opts["name"])
 
-if abortf or continuef and not interactive:
+if abortf or continuef:
 if abortf and continuef:
 raise error.Abort(_('cannot use both abort and continue'))
 if shelved:
@@ -955,11 +956,8 @@
 raise error.Abort(_('no shelved changes to apply!'))
 basename = util.split(shelved[0][1])[1]
 ui.status(_("unshelving change '%s'\n") % basename)
-elif shelved:
+else:
 basename = shelved[0]
-if continuef and interactive:
-state = _loadshelvedstate(ui, repo, opts)
-return unshelvecontinue(ui, repo, state, opts, basename)
 
 if not shelvedfile(repo, basename, patchextension).exists():
 raise error.Abort(_("shelved change '%s' not found") % basename)



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


D6684: unshelve: modify --continue on interactive unshelve

2019-07-24 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh edited the summary of this revision.
navaneeth.suresh updated this revision to Diff 16056.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6684?vs=16037=16056

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

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

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

CHANGE DETAILS

diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -1351,13 +1351,12 @@
   A
   B
   C
-  $ hg unshelve --continue -i < y
   > y
   > y
   > y
   > EOF
-  unshelving change 'default-01'
   diff --git a/bar1 b/bar1
   1 hunks, 1 lines changed
   examine changes to 'bar1'?
diff --git a/mercurial/shelve.py b/mercurial/shelve.py
--- a/mercurial/shelve.py
+++ b/mercurial/shelve.py
@@ -698,11 +698,12 @@
 if shfile.exists():
 shfile.movetobackup()
 cleanupoldbackups(repo)
-def unshelvecontinue(ui, repo, state, opts, basename=None):
+def unshelvecontinue(ui, repo, state, opts):
 """subcommand to continue an in-progress unshelve"""
 # We're finishing off a merge. First parent is our original
 # parent, second is the temporary "fake" commit we're unshelving.
 interactive = state.interactive
+basename = state.name
 with repo.lock():
 checkparents(repo, state)
 ms = merge.mergestate.read(repo)
@@ -933,10 +934,10 @@
 if opts.get("name"):
 shelved.append(opts["name"])
 
-if abortf or continuef and not interactive:
+if abortf or continuef:
 if abortf and continuef:
 raise error.Abort(_('cannot use both abort and continue'))
-if shelved:
+if opts.get("name"):
 raise error.Abort(_('cannot combine abort/continue with '
'naming a shelved change'))
 if abortf and opts.get('tool', False):
@@ -947,19 +948,17 @@
 return unshelveabort(ui, repo, state)
 elif continuef:
 return unshelvecontinue(ui, repo, state, opts)
-elif len(shelved) > 1:
+if len(shelved) > 1:
 raise error.Abort(_('can only unshelve one change at a time'))
 elif not shelved:
 shelved = listshelves(repo)
 if not shelved:
 raise error.Abort(_('no shelved changes to apply!'))
 basename = util.split(shelved[0][1])[1]
-ui.status(_("unshelving change '%s'\n") % basename)
-elif shelved:
+if not (abortf or continuef):
+ui.status(_("unshelving change '%s'\n") % basename)
+else:
 basename = shelved[0]
-if continuef and interactive:
-state = _loadshelvedstate(ui, repo, opts)
-return unshelvecontinue(ui, repo, state, opts, basename)
 
 if not shelvedfile(repo, basename, patchextension).exists():
 raise error.Abort(_("shelved change '%s' not found") % basename)



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


D6684: unshelve: modify --continue on interactive unshelve

2019-07-24 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh added inline comments.

INLINE COMMENTS

> pulkit wrote in shelve.py:950
> Now I understand how this and the parent patches are arranged.
> 
> Why don't be have all the logic related to interactive in `unshelvecontinue`, 
> including getting the name of the shelve we are processing.
> 
> Right now, we are getting name of top most shelve, however we should read the 
> shelvedstate and get the name from there.

Doing that right away!

REPOSITORY
  rHG Mercurial

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

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

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


D6684: unshelve: modify --continue on interactive unshelve

2019-07-24 Thread pulkit (Pulkit Goyal)
pulkit added inline comments.

INLINE COMMENTS

> shelve.py:950
>  elif continuef:
> -return unshelvecontinue(ui, repo, state, opts)
> -elif len(shelved) > 1:

Now I understand how this and the parent patches are arranged.

Why don't be have all the logic related to interactive in `unshelvecontinue`, 
including getting the name of the shelve we are processing.

Right now, we are getting name of top most shelve, however we should read the 
shelvedstate and get the name from there.

REPOSITORY
  rHG Mercurial

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

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

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


D6684: unshelve: modify --continue on interactive unshelve

2019-07-24 Thread pulkit (Pulkit Goyal)
pulkit added inline comments.

INLINE COMMENTS

> test-shelve.t:1354
>C
> -  $ hg unshelve --continue -i <> y

This test change should be in the parent differential.

REPOSITORY
  rHG Mercurial

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

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

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


D6684: unshelve: modify --continue on interactive unshelve

2019-07-24 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  `shelvedstate` should store info about interactive mode after D6679 
.
  This patch modifies the test and behavior of `hg unshelve --continue`
  after an unshelve on interactive mode.

REPOSITORY
  rHG Mercurial

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

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

CHANGE DETAILS

diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -1351,13 +1351,12 @@
   A
   B
   C
-  $ hg unshelve --continue -i < y
   > y
   > y
   > y
   > EOF
-  unshelving change 'default-01'
   diff --git a/bar1 b/bar1
   1 hunks, 1 lines changed
   examine changes to 'bar1'?
diff --git a/mercurial/shelve.py b/mercurial/shelve.py
--- a/mercurial/shelve.py
+++ b/mercurial/shelve.py
@@ -934,10 +934,21 @@
 if opts.get("name"):
 shelved.append(opts["name"])
 
-if abortf or continuef and not interactive:
+if len(shelved) > 1:
+raise error.Abort(_('can only unshelve one change at a time'))
+elif not shelved:
+shelved = listshelves(repo)
+if not shelved:
+raise error.Abort(_('no shelved changes to apply!'))
+basename = util.split(shelved[0][1])[1]
+if not (abortf or continuef):
+ui.status(_("unshelving change '%s'\n") % basename)
+elif shelved:
+basename = shelved[0]
+if abortf or continuef:
 if abortf and continuef:
 raise error.Abort(_('cannot use both abort and continue'))
-if shelved:
+if opts.get("name"):
 raise error.Abort(_('cannot combine abort/continue with '
'naming a shelved change'))
 if abortf and opts.get('tool', False):
@@ -947,20 +958,7 @@
 if abortf:
 return unshelveabort(ui, repo, state)
 elif continuef:
-return unshelvecontinue(ui, repo, state, opts)
-elif len(shelved) > 1:
-raise error.Abort(_('can only unshelve one change at a time'))
-elif not shelved:
-shelved = listshelves(repo)
-if not shelved:
-raise error.Abort(_('no shelved changes to apply!'))
-basename = util.split(shelved[0][1])[1]
-ui.status(_("unshelving change '%s'\n") % basename)
-elif shelved:
-basename = shelved[0]
-if continuef and interactive:
-state = _loadshelvedstate(ui, repo, opts)
-return unshelvecontinue(ui, repo, state, opts, basename)
+return unshelvecontinue(ui, repo, state, opts, basename)
 
 if not shelvedfile(repo, basename, patchextension).exists():
 raise error.Abort(_("shelved change '%s' not found") % basename)



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