Patchwork D6708: unshelve: clear shelvedstate and _finishunshelve() on partial unshelve

login
register
mail settings
Submitter phabricator
Date Aug. 2, 2019, 8:17 a.m.
Message ID <differential-rev-PHID-DREV-xlcvywgit56b372mw7uw-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/41120/
State Superseded
Headers show

Comments

phabricator - Aug. 2, 2019, 8:17 a.m.
navaneeth.suresh created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  On a partial unshelve, `shelvedstate` was not cleared and `_finishunshelve()`
  was not called. Ideally, these should be called on this case. This patch makes
  `shelvedstate` to delete after a successful partial unshelve and calls
  `_finishunshelve()` in the same case.

REPOSITORY
  rHG Mercurial

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

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

CHANGE DETAILS




To: navaneeth.suresh, #hg-reviewers
Cc: mercurial-devel
phabricator - Aug. 6, 2019, 11:18 a.m.
pulkit added inline comments.

INLINE COMMENTS

> shelve.py:1008
>          if not ispartialunshelve:
>              _forgetunknownfiles(repo, shelvectx, addedbefore)
>              unshelvecleanup(ui, repo, basename, opts)

IIUC, we don't need `_forgetunknownfiles()` too in this if statement. Can you add some related tests and see if we need this as a followup?

REPOSITORY
  rHG Mercurial

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

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

To: navaneeth.suresh, #hg-reviewers
Cc: pulkit, mercurial-devel
phabricator - Aug. 6, 2019, 3:47 p.m.
pulkit added a comment.


  Sorry for not noticing this before, but this patch needs tests.

REPOSITORY
  rHG Mercurial

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

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

To: navaneeth.suresh, #hg-reviewers, pulkit
Cc: pulkit, mercurial-devel
phabricator - Aug. 6, 2019, 4 p.m.
navaneeth.suresh added inline comments.

INLINE COMMENTS

> pulkit wrote in shelve.py:1008
> IIUC, we don't need `_forgetunknownfiles()` too in this if statement. Can you add some related tests and see if we need this as a followup?

sure, will investigate on that.

REPOSITORY
  rHG Mercurial

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

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

To: navaneeth.suresh, #hg-reviewers, pulkit
Cc: pulkit, mercurial-devel
phabricator - Aug. 6, 2019, 5:11 p.m.
pulkit added a comment.


  Applied the following diff in flight which was result of test output changes.
  
    --- /home/pulkit/repo/paccess/tests/test-shelve.t
    +++ /home/pulkit/repo/paccess/tests/test-shelve.t
    @@ -1365,19 +1365,19 @@
     
     #if stripbased
       $ hg log -r 3:: -G
    -  @  changeset:   5:506510493902
    +  @  changeset:   5:f1d5f53e397b
       |  tag:         tip
    -  |  parent:      3:adfeba9a1ac4
    +  |  parent:      3:e28fd7fa7938
       |  user:        shelve@localhost
       |  date:        Thu Jan 01 00:00:00 1970 +0000
       |  summary:     changes to: add A to bars
       |
    -  | @  changeset:   4:8b023952e29c
    +  | @  changeset:   4:fe451a778c81
       |/   user:        test
       |    date:        Thu Jan 01 00:00:00 1970 +0000
       |    summary:     add C to bars
       |
    -  o  changeset:   3:adfeba9a1ac4
    +  o  changeset:   3:e28fd7fa7938
       |  user:        test
       ~  date:        Thu Jan 01 00:00:00 1970 +0000
          summary:     add A to bars
    @@ -1418,13 +1418,13 @@
     
     #if stripbased
       $ hg log -r 3:: -G
    -  @  changeset:   4:8b023952e29c
    +  @  changeset:   4:fe451a778c81
       |  tag:         tip
       |  user:        test
       |  date:        Thu Jan 01 00:00:00 1970 +0000
       |  summary:     add C to bars
       |
    -  o  changeset:   3:adfeba9a1ac4
    +  o  changeset:   3:e28fd7fa7938
       |  user:        test
       ~  date:        Thu Jan 01 00:00:00 1970 +0000
          summary:     add A to bars

REPOSITORY
  rHG Mercurial

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

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

To: navaneeth.suresh, #hg-reviewers, pulkit
Cc: pulkit, mercurial-devel

Patch

diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -1239,6 +1239,7 @@ 
   > y
   > EOF
   unshelving change 'default'
+  temporarily committing pending changes (restore with 'hg unshelve --abort')
   rebasing shelved changes
   diff --git a/d b/d
   new file mode 100644
diff --git a/mercurial/shelve.py b/mercurial/shelve.py
--- a/mercurial/shelve.py
+++ b/mercurial/shelve.py
@@ -1002,11 +1002,10 @@ 
         with ui.configoverride(overrides, 'unshelve'):
             mergefiles(ui, repo, pctx, shelvectx)
         restorebranch(ui, repo, branchtorestore)
+        shelvedstate.clear(repo)
+        _finishunshelve(repo, oldtiprev, tr, activebookmark)
         if not ispartialunshelve:
             _forgetunknownfiles(repo, shelvectx, addedbefore)
-
-            shelvedstate.clear(repo)
-            _finishunshelve(repo, oldtiprev, tr, activebookmark)
             unshelvecleanup(ui, repo, basename, opts)
     finally:
         if tr: