[PATCH V3] shelve: restore parents after unshelve (issue5123)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH V3] shelve: restore parents after unshelve (issue5123)

liscju
# HG changeset patch
# User liscju <[hidden email]>
# Date 1459461357 -7200
#      Thu Mar 31 23:55:57 2016 +0200
# Node ID aba676a11c963282ca8d14d0a25636ecb67e9b54
# Parent  c5565fc8848dd084d104ca40c33d1acdfcff8bc6
shelve: restore parents after unshelve (issue5123)

This patch is a work in progress, it has bug and its not
ready to be merged into repository.

unshelve operates on the first parent of the working directory,
commiting pending changes and applying the saved commit
in shelve on the first parent.

Before this commit it forgot about second parent, so second
parent was not restored and lost in the process. This commit makes
unshelve remember original parents of the working directory and
recreates it when working context had more than one parent.

Recreating merge parent is done in restoremergeparent function.
It sets the working copy second parent to the second parent of
pendingctx. pendingctx is changeset with saved changes to working
copy, it is best represented by the following diagram:

.. -> originalwctx -> pendingctx -> shelvectx

Restoring second parent of pendingctx is done only when originalwctx
is different than pendingctx. When pendingctx is the same as orignalwctx
it means that working copy wasn't changed so working copy after unshelve
should have only one parent - originalwctx.

The problem for now are merged files which before shelve are marked
as modified, but after unshelve are marked as added. I suppose that
it has something to do with bad dirstate content after setting
parent of the working context with repo.setparents in restoremergeparent
function but i need more guidance on this.

diff -r c5565fc8848d -r aba676a11c96 hgext/shelve.py
--- a/hgext/shelve.py Wed Apr 06 22:26:47 2016 -0400
+++ b/hgext/shelve.py Thu Mar 31 23:55:57 2016 +0200
@@ -529,14 +529,15 @@ def unshelveabort(ui, repo, state, opts)
                             repo.join('unshelverebasestate'))
                 raise
 
-            mergefiles(ui, repo, state.wctx, state.pendingctx)
+            mergefiles(ui, repo, state.wctx, state.pendingctx, len(state.pendingctx.parents()) > 1)
             repair.strip(ui, repo, state.stripnodes, backup=False,
                          topic='shelve')
+            restoremergeparent(repo, state.wctx, state.pendingctx)
         finally:
             shelvedstate.clear(repo)
             ui.warn(_("unshelve of '%s' aborted\n") % state.name)
 
-def mergefiles(ui, repo, wctx, shelvectx):
+def mergefiles(ui, repo, wctx, shelvectx, ismerge):
     """updates to wctx and merges the changes from shelvectx into the
     dirstate."""
     oldquiet = ui.quiet
@@ -544,8 +545,12 @@ def mergefiles(ui, repo, wctx, shelvectx
         ui.quiet = True
         hg.update(repo, wctx.node())
         files = []
-        files.extend(shelvectx.files())
-        files.extend(shelvectx.parents()[0].files())
+        if ismerge:
+            files.extend([fn for st in repo.status(wctx, shelvectx)[:3]
+                          for fn in st])
+        else:
+            files.extend(shelvectx.files())
+            files.extend(shelvectx.parents()[0].files())
 
         # revert will overwrite unknown files, so move them out of the way
         for file in repo.status(unknown=True).unknown:
@@ -565,6 +570,14 @@ def restorebranch(ui, repo, branchtorest
         ui.status(_('marked working directory as branch %s\n')
                   % branchtorestore)
 
+def restoremergeparent(repo, originalwctx, pendingctx):
+    if originalwctx != pendingctx and len(pendingctx.parents()) > 1:
+        # We want to keep first parent as it is now,
+        # only second parent should change
+        p1 = repo['.'].node()
+        p2 = pendingctx.p2().node()
+        repo.setparents(p1, p2)
+
 def unshelvecleanup(ui, repo, name, opts):
     """remove related files after an unshelve"""
     if not opts.get('keep'):
@@ -603,8 +616,9 @@ def unshelvecontinue(ui, repo, state, op
             # only strip the shelvectx if the rebase produced it
             state.stripnodes.append(shelvectx.node())
 
-        mergefiles(ui, repo, state.wctx, shelvectx)
+        mergefiles(ui, repo, state.wctx, shelvectx, len(state.pendingctx.parents()) > 1)
         restorebranch(ui, repo, state.branchtorestore)
+        restoremergeparent(repo, state.wctx, state.pendingctx)
 
         repair.strip(ui, repo, state.stripnodes, backup=False, topic='shelve')
         shelvedstate.clear(repo)
@@ -791,8 +805,9 @@ def _dounshelve(ui, repo, *shelved, **op
                 # rebase was a no-op, so it produced no child commit
                 shelvectx = tmpwctx
 
-        mergefiles(ui, repo, pctx, shelvectx)
+        mergefiles(ui, repo, pctx, shelvectx, len(tmpwctx.parents()) > 1)
         restorebranch(ui, repo, branchtorestore)
+        restoremergeparent(repo, pctx, tmpwctx)
 
         # Forget any files that were unknown before the shelve, unknown before
         # unshelve started, but are now added.
diff -r c5565fc8848d -r aba676a11c96 tests/test-shelve.t
--- a/tests/test-shelve.t Wed Apr 06 22:26:47 2016 -0400
+++ b/tests/test-shelve.t Thu Mar 31 23:55:57 2016 +0200
@@ -1583,3 +1583,412 @@ On non bare shelve the branch informatio
   ? b
   $ hg branch
   default
+
+  $ cd ..
+
+Modified files after merge should be preserved after unshelve, for now
+there is a problem that merged files are marked as added instead of
+modified as it were before unshelve.
+
+  $ hg init unshelvekeepsmergedfiles
+  $ cd unshelvekeepsmergedfiles
+  $ echo "aa" >> a
+  $ hg commit -A -m "a"
+  adding a
+  $ echo "bb" >> b
+  $ hg commit -A -m "b"
+  adding b
+  $ hg update -r 0
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo "cc" >> c
+  $ hg commit -A -m "c"
+  adding c
+  created new head
+  $ echo "dd" >> d
+  $ hg add d
+  $ hg shelve
+  shelved as default
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg merge -r 1
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg status
+  M b
+  $ ls
+  a
+  b
+  c
+  $ hg unshelve
+  unshelving change 'default'
+  temporarily committing pending changes (restore with 'hg unshelve --abort')
+  rebasing shelved changes
+  rebasing 4:663cf8e488ec "changes to: c" (tip)
+
+Now b file should be marked as modified but its marked as added
+
+  $ hg status
+  A b
+  A d
+  $ ls
+  a
+  b
+  c
+  d
+
+  $ cd ..
+
+When unshelving is done on working context that has more than
+one parents, working context after unshelving should still has
+the same parents as before.
+
+  $ hg init restoringmergeparents
+  $ cd restoringmergeparents
+  $ touch a
+  $ hg add a
+  $ hg commit -m "a"
+  $ touch b
+  $ hg add b
+  $ hg commit -m "b"
+  $ hg update -r 0
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ touch c
+  $ hg add c
+  $ hg commit -m "c"
+  created new head
+  $ hg update -r 1
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg log -G
+  o  changeset:   2:d5e255ef74f8
+  |  tag:         tip
+  |  parent:      0:3903775176ed
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c
+  |
+  | @  changeset:   1:0e067c57feba
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     b
+  |
+  o  changeset:   0:3903775176ed
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
+  $ touch d
+  $ hg add d
+  $ hg shelve
+  shelved as default
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg merge -r 2
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg status
+  M c
+  $ ls
+  a
+  b
+  c
+  $ hg log -G
+  @  changeset:   2:d5e255ef74f8
+  |  tag:         tip
+  |  parent:      0:3903775176ed
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c
+  |
+  | @  changeset:   1:0e067c57feba
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     b
+  |
+  o  changeset:   0:3903775176ed
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
+  $ hg unshelve
+  unshelving change 'default'
+  temporarily committing pending changes (restore with 'hg unshelve --abort')
+  rebasing shelved changes
+  rebasing 4:013284d9655e "changes to: b" (tip)
+  $ hg parents
+  changeset:   1:0e067c57feba
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     b
+  
+  changeset:   2:d5e255ef74f8
+  tag:         tip
+  parent:      0:3903775176ed
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     c
+  
+  $ hg status
+  A c
+  A d
+  $ ls
+  a
+  b
+  c
+  d
+  $ hg commit -m "d"
+  $ hg log -G --limit=3
+  @    changeset:   3:2120ed92aed1
+  |\   tag:         tip
+  | |  parent:      1:0e067c57feba
+  | |  parent:      2:d5e255ef74f8
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  summary:     d
+  | |
+  | o  changeset:   2:d5e255ef74f8
+  | |  parent:      0:3903775176ed
+  | ~  user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     c
+  |
+  o  changeset:   1:0e067c57feba
+  |  user:        test
+  ~  date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     b
+  
+
+Unshelve should preserve merge parents also when used with --continue
+
+  $ touch e
+  $ hg add e
+  $ hg commit -m "e"
+  $ hg update -r 3
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ touch f
+  $ hg add f
+  $ hg commit -m "f"
+  created new head
+  $ echo "xxx" >> g
+  $ hg add g
+  $ hg shelve
+  shelved as default
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg log -G --limit=3
+  @  changeset:   5:f18cf9069302
+  |  tag:         tip
+  |  parent:      3:2120ed92aed1
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     f
+  |
+  | o  changeset:   4:8ba9f53764c1
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     e
+  |
+  o    changeset:   3:2120ed92aed1
+  |\   parent:      1:0e067c57feba
+  ~ ~  parent:      2:d5e255ef74f8
+       user:        test
+       date:        Thu Jan 01 00:00:00 1970 +0000
+       summary:     d
+  
+
+  $ hg merge -r 4
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg parents
+  changeset:   5:f18cf9069302
+  tag:         tip
+  parent:      3:2120ed92aed1
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     f
+  
+  changeset:   4:8ba9f53764c1
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     e
+  
+  $ echo "ggg" >> g
+  $ hg add g
+  $ hg unshelve
+  unshelving change 'default'
+  temporarily committing pending changes (restore with 'hg unshelve --abort')
+  rebasing shelved changes
+  rebasing 7:e23b1c5ffa02 "changes to: f" (tip)
+  merging g
+  warning: conflicts while merging g! (edit, then use 'hg resolve --mark')
+  unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
+  [1]
+  $ hg resolve --mark g
+  (no more unresolved files)
+  continue: hg unshelve --continue
+  $ hg unshelve --continue
+  rebasing 7:e23b1c5ffa02 "changes to: f" (tip)
+  unshelve of 'default' complete
+  $ hg parents
+  changeset:   5:f18cf9069302
+  tag:         tip
+  parent:      3:2120ed92aed1
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     f
+  
+  changeset:   4:8ba9f53764c1
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     e
+  
+  $ hg commit -m "g"
+  $ hg log -G --limit=3
+  @    changeset:   6:* (glob)
+  |\   tag:         tip
+  | |  parent:      5:f18cf9069302
+  | |  parent:      4:8ba9f53764c1
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  summary:     g
+  | |
+  | o  changeset:   5:f18cf9069302
+  | |  parent:      3:2120ed92aed1
+  | ~  user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     f
+  |
+  o  changeset:   4:8ba9f53764c1
+  |  user:        test
+  ~  date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     e
+  
+
+Unshelve should preserve merge parents after --abort
+
+  $ touch h
+  $ hg add h
+  $ hg commit -m "h"
+  $ hg update -r 6
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ touch i
+  $ hg add i
+  $ hg commit -m "i"
+  created new head
+  $ hg log -G --limit=3
+  @  changeset:   8:* (glob)
+  |  tag:         tip
+  |  parent:      6:* (glob)
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     i
+  |
+  | o  changeset:   7:* (glob)
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     h
+  |
+  o    changeset:   6:* (glob)
+  |\   parent:      5:f18cf9069302
+  ~ ~  parent:      4:8ba9f53764c1
+       user:        test
+       date:        Thu Jan 01 00:00:00 1970 +0000
+       summary:     g
+  
+  $ echo "xxx" >> j
+  $ hg add j
+  $ hg shelve
+  shelved as default
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg merge -r 7
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg parents
+  changeset:   8:* (glob)
+  tag:         tip
+  parent:      6:* (glob)
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     i
+  
+  changeset:   7:* (glob)
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     h
+  
+  $ echo "jjj" >> j
+  $ hg add j
+  $ hg unshelve
+  unshelving change 'default'
+  temporarily committing pending changes (restore with 'hg unshelve --abort')
+  rebasing shelved changes
+  rebasing 10:* "changes to: i" (tip) (glob)
+  merging j
+  warning: conflicts while merging j! (edit, then use 'hg resolve --mark')
+  unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
+  [1]
+  $ hg unshelve --abort
+  rebase aborted
+  unshelve of 'default' aborted
+  $ hg status
+  A h
+  A j
+  ? g.orig
+  ? j.orig
+  $ hg parents
+  changeset:   8:* (glob)
+  tag:         tip
+  parent:      6:* (glob)
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     i
+  
+  changeset:   7:* (glob)
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     h
+  
+  $ hg log -G --limit=3
+  @  changeset:   8:* (glob)
+  |  tag:         tip
+  |  parent:      6:* (glob)
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     i
+  |
+  | @  changeset:   7:* (glob)
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     h
+  |
+  o    changeset:   6:* (glob)
+  |\   parent:      5:f18cf9069302
+  ~ ~  parent:      4:8ba9f53764c1
+       user:        test
+       date:        Thu Jan 01 00:00:00 1970 +0000
+       summary:     g
+  
+Unshelve on merge parent should have only one parent
+
+  $ hg commit -m "Merge 7 and 8"
+  $ touch k
+  $ hg add k
+  $ hg parents
+  changeset:   9:* (glob)
+  tag:         tip
+  parent:      8:* (glob)
+  parent:      7:* (glob)
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     Merge 7 and 8
+  
+  $ hg shelve
+  shelved as default-01
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg unshelve
+  unshelving change 'default-01'
+  $ hg parents
+  changeset:   9:* (glob)
+  tag:         tip
+  parent:      8:* (glob)
+  parent:      7:* (glob)
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     Merge 7 and 8
+  
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH V3] shelve: restore parents after unshelve (issue5123)

Pierre-Yves David-2


On 04/11/2016 02:30 PM, liscju wrote:

> # HG changeset patch
> # User liscju <[hidden email]>
> # Date 1459461357 -7200
> #      Thu Mar 31 23:55:57 2016 +0200
> # Node ID aba676a11c963282ca8d14d0a25636ecb67e9b54
> # Parent  c5565fc8848dd084d104ca40c33d1acdfcff8bc6
> shelve: restore parents after unshelve (issue5123)
>
> This patch is a work in progress, it has bug and its not
> ready to be merged into repository.

You might want consider adding a flag for this kind of patch (like WIP)
to make sure people know what they are about.

This seems to be a complicated issue and as this is not fixing a
regression (just a bug that have always been here, right?). So I
personally think we should defer further digging until the freeze is
lifted. Piotr what would you think about that?

--
Pierre-Yves David
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH V3] shelve: restore parents after unshelve (issue5123)

liscju
You might want consider adding a flag for this kind of patch (like WIP) to make sure people know what they are about.

Right, thanks for tip 
 
This seems to be a complicated issue and as this is not fixing a regression (just a bug that have always been here, right?). So I personally think we should defer further digging until the freeze is lifted. Piotr what would you think about that?

Yeah, thats the bug thats probably has always been in shelve implementation. I agree about deferring further digging, after freeze i will poke devs about this issue 

2016-04-20 23:07 GMT+02:00 Pierre-Yves David <[hidden email]>:


On 04/11/2016 02:30 PM, liscju wrote:
# HG changeset patch
# User liscju <[hidden email]>
# Date 1459461357 -7200
#      Thu Mar 31 23:55:57 2016 +0200
# Node ID aba676a11c963282ca8d14d0a25636ecb67e9b54
# Parent  c5565fc8848dd084d104ca40c33d1acdfcff8bc6
shelve: restore parents after unshelve (issue5123)

This patch is a work in progress, it has bug and its not
ready to be merged into repository.

You might want consider adding a flag for this kind of patch (like WIP) to make sure people know what they are about.

This seems to be a complicated issue and as this is not fixing a regression (just a bug that have always been here, right?). So I personally think we should defer further digging until the freeze is lifted. Piotr what would you think about that?

--
Pierre-Yves David


_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH V3] shelve: restore parents after unshelve (issue5123)

liscju
As code freeze is over it's probably a good time to look at this issue once again. Does anybody have any suggestions about described in patch problem with merged files which before shelve are marked
as modified, but after unshelve are marked as added ?

2016-04-21 7:13 GMT+02:00 Piotr Listkiewicz <[hidden email]>:
You might want consider adding a flag for this kind of patch (like WIP) to make sure people know what they are about.

Right, thanks for tip 
 
This seems to be a complicated issue and as this is not fixing a regression (just a bug that have always been here, right?). So I personally think we should defer further digging until the freeze is lifted. Piotr what would you think about that?

Yeah, thats the bug thats probably has always been in shelve implementation. I agree about deferring further digging, after freeze i will poke devs about this issue 

2016-04-20 23:07 GMT+02:00 Pierre-Yves David <[hidden email]>:


On 04/11/2016 02:30 PM, liscju wrote:
# HG changeset patch
# User liscju <[hidden email]>
# Date 1459461357 -7200
#      Thu Mar 31 23:55:57 2016 +0200
# Node ID aba676a11c963282ca8d14d0a25636ecb67e9b54
# Parent  c5565fc8848dd084d104ca40c33d1acdfcff8bc6
shelve: restore parents after unshelve (issue5123)

This patch is a work in progress, it has bug and its not
ready to be merged into repository.

You might want consider adding a flag for this kind of patch (like WIP) to make sure people know what they are about.

This seems to be a complicated issue and as this is not fixing a regression (just a bug that have always been here, right?). So I personally think we should defer further digging until the freeze is lifted. Piotr what would you think about that?

--
Pierre-Yves David



_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH V3] shelve: restore parents after unshelve (issue5123)

liscju
I have done further research and I suspect that modified files after merge are shown as added because of how shelve.mergefiles works. Commit structure looks like this:
        
... -> pctx -> tmpwctx -> shelvectx
                  /
                 /
        second
        merge parent

pctx = parent before merging working context(first merge parent)
tmpwctx = commited working directory after merge, it has two parents
shelvectx = shelved context

shelve.mergefiles first updates to pctx then it reverts shelvectx to pctx with:

cmdutil.revert(ui, repo, shelvectx, repo.dirstate.parents(),
                       *pathtofiles(repo, files),
                       **{'no_backup': True})

Reverting tmpwctx files that were merged from second parent to pctx makes them added because they are not in pctx.  

I think changing this revert operation is crucial to restore parents after unshelve. Anybody has any idea how to resolve this?

2016-05-04 0:20 GMT+02:00 Piotr Listkiewicz <[hidden email]>:
As code freeze is over it's probably a good time to look at this issue once again. Does anybody have any suggestions about described in patch problem with merged files which before shelve are marked
as modified, but after unshelve are marked as added ?

2016-04-21 7:13 GMT+02:00 Piotr Listkiewicz <[hidden email]>:
You might want consider adding a flag for this kind of patch (like WIP) to make sure people know what they are about.

Right, thanks for tip 
 
This seems to be a complicated issue and as this is not fixing a regression (just a bug that have always been here, right?). So I personally think we should defer further digging until the freeze is lifted. Piotr what would you think about that?

Yeah, thats the bug thats probably has always been in shelve implementation. I agree about deferring further digging, after freeze i will poke devs about this issue 

2016-04-20 23:07 GMT+02:00 Pierre-Yves David <[hidden email]>:


On 04/11/2016 02:30 PM, liscju wrote:
# HG changeset patch
# User liscju <[hidden email]>
# Date 1459461357 -7200
#      Thu Mar 31 23:55:57 2016 +0200
# Node ID aba676a11c963282ca8d14d0a25636ecb67e9b54
# Parent  c5565fc8848dd084d104ca40c33d1acdfcff8bc6
shelve: restore parents after unshelve (issue5123)

This patch is a work in progress, it has bug and its not
ready to be merged into repository.

You might want consider adding a flag for this kind of patch (like WIP) to make sure people know what they are about.

This seems to be a complicated issue and as this is not fixing a regression (just a bug that have always been here, right?). So I personally think we should defer further digging until the freeze is lifted. Piotr what would you think about that?

--
Pierre-Yves David




_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH V3] shelve: restore parents after unshelve (issue5123)

Yuya Nishihara
On Wed, 25 May 2016 15:25:51 +0200, Piotr Listkiewicz wrote:

> I have done further research and I suspect that modified files after merge
> are shown as added because of how shelve.mergefiles works. Commit structure
> looks like this:
>
> ... -> pctx -> tmpwctx -> shelvectx
>                   /
>                  /
>         second
>         merge parent
>
> pctx = parent before merging working context(first merge parent)
> tmpwctx = commited working directory after merge, it has two parents
> shelvectx = shelved context
>
> shelve.mergefiles first updates to pctx then it reverts shelvectx to pctx
> with:
>
> cmdutil.revert(ui, repo, shelvectx, repo.dirstate.parents(),
>                        *pathtofiles(repo, files),
>                        **{'no_backup': True})
>
> Reverting tmpwctx files that were merged from second parent to pctx makes
> them added because they are not in pctx.

What would happen if you do revert cheating the parents as if p2 were the
"second merge parent"? I don't know whether it will work or not, but according
to your investigation, we'll need a way to reproduce a merge with the shelved
content.

> >> You might want consider adding a flag for this kind of patch (like WIP)  
> >>> to make sure people know what they are about.  
> >>
> >> Right, thanks for tip

You can do that by "hg email --flag RFC" or "--flag WIP".
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel