[PATCH] shelve: adds restoring original 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] shelve: adds restoring original parents after unshelve (issue5123)

liscju
# HG changeset patch
# User liscju <[hidden email]>
# Date 1458639243 -3600
#      Tue Mar 22 10:34:03 2016 +0100
# Node ID 30c3e45abd3e5446757653a85f3a22d9e39f5254
# Parent  78e4e558fa74aa4489609953328cbcecf1a8a428
shelve: adds restoring original parents after unshelve (issue5123)

Unshelve command works on the first parent of the working directory,
in which it does commiting pending changes, applying saved commit
in shelve and rebasing it to the first parent.

In this process it totally forgets about second parent, which are
not restored and loses it in the process. This commit makes
unshelve remembers original parents of working directory  and
recreates it when working context had more than one parent.

To save information about original parents this commit adds line
to shelvedstate file format with this information. However it
doesn't break compability, because older version of mercurial will
not read this line. If version of mercurial with this commit will
read older version of shelvedstate file it will not break as well,
because when line is absent fp.readline() returns empty string,
resulting in originalparents being empty list. Function restoreparents
restores parents when there is more than one parent in parents list.

test-shelve uses some globs, because shelve --continue changes nodeid
of the base context in which works.

diff -r 78e4e558fa74 -r 30c3e45abd3e hgext/shelve.py
--- a/hgext/shelve.py Sat Mar 19 08:27:54 2016 -0700
+++ b/hgext/shelve.py Tue Mar 22 10:34:03 2016 +0100
@@ -168,6 +168,7 @@ class shelvedstate(object):
             parents = [nodemod.bin(h) for h in fp.readline().split()]
             stripnodes = [nodemod.bin(h) for h in fp.readline().split()]
             branchtorestore = fp.readline().strip()
+            originalparents = [nodemod.bin(h) for h in fp.readline().split()]
         finally:
             fp.close()
 
@@ -178,12 +179,13 @@ class shelvedstate(object):
         obj.parents = parents
         obj.stripnodes = stripnodes
         obj.branchtorestore = branchtorestore
+        obj.originalparents = originalparents
 
         return obj
 
     @classmethod
     def save(cls, repo, name, originalwctx, pendingctx, stripnodes,
-             branchtorestore):
+             branchtorestore, originalparents):
         fp = repo.vfs(cls._filename, 'wb')
         fp.write('%i\n' % cls._version)
         fp.write('%s\n' % name)
@@ -194,6 +196,8 @@ class shelvedstate(object):
         fp.write('%s\n' %
                  ' '.join([nodemod.hex(n) for n in stripnodes]))
         fp.write('%s\n' % branchtorestore)
+        fp.write('%s\n' %
+                 ' '.join([nodemod.hex(n) for n in originalparents]))
         fp.close()
 
     @classmethod
@@ -532,6 +536,7 @@ def unshelveabort(ui, repo, state, opts)
             mergefiles(ui, repo, state.wctx, state.pendingctx)
             repair.strip(ui, repo, state.stripnodes, backup=False,
                          topic='shelve')
+            restoreparents(repo, state.originalparents)
         finally:
             shelvedstate.clear(repo)
             ui.warn(_("unshelve of '%s' aborted\n") % state.name)
@@ -565,6 +570,11 @@ def restorebranch(ui, repo, branchtorest
         ui.status(_('marked working directory as branch %s\n')
                   % branchtorestore)
 
+def restoreparents(repo, parents):
+    if len(parents) > 1:
+        repo.setparents(parents[0],
+                        parents[1])
+
 def unshelvecleanup(ui, repo, name, opts):
     """remove related files after an unshelve"""
     if not opts.get('keep'):
@@ -605,6 +615,7 @@ def unshelvecontinue(ui, repo, state, op
 
         mergefiles(ui, repo, state.wctx, shelvectx)
         restorebranch(ui, repo, state.branchtorestore)
+        restoreparents(repo, state.originalparents)
 
         repair.strip(ui, repo, state.stripnodes, backup=False, topic='shelve')
         shelvedstate.clear(repo)
@@ -712,6 +723,7 @@ def _dounshelve(ui, repo, *shelved, **op
         oldtiprev = len(repo)
 
         pctx = repo['.']
+        originalwctxparents = [ctx.node() for ctx in repo[None].parents()]
         tmpwctx = pctx
         # The goal is to have a commit structure like so:
         # ...-> pctx -> tmpwctx -> shelvectx
@@ -776,7 +788,7 @@ def _dounshelve(ui, repo, *shelved, **op
                 stripnodes = [repo.changelog.node(rev)
                               for rev in xrange(oldtiprev, len(repo))]
                 shelvedstate.save(repo, basename, pctx, tmpwctx, stripnodes,
-                                  branchtorestore)
+                                  branchtorestore, originalwctxparents)
 
                 util.rename(repo.join('rebasestate'),
                             repo.join('unshelverebasestate'))
@@ -793,6 +805,7 @@ def _dounshelve(ui, repo, *shelved, **op
 
         mergefiles(ui, repo, pctx, shelvectx)
         restorebranch(ui, repo, branchtorestore)
+        restoreparents(repo, originalwctxparents)
 
         # Forget any files that were unknown before the shelve, unknown before
         # unshelve started, but are now added.
diff -r 78e4e558fa74 -r 30c3e45abd3e tests/test-shelve.t
--- a/tests/test-shelve.t Sat Mar 19 08:27:54 2016 -0700
+++ b/tests/test-shelve.t Tue Mar 22 10:34:03 2016 +0100
@@ -1582,3 +1582,431 @@ On non bare shelve the branch informatio
   ? b
   $ hg branch
   default
+
+  $ 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 unshelving_restores_merge_parents
+  $ cd unshelving_restores_merge_parents
+  $ 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 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 d
+  $ hg commit -m "d"
+  $ hg log -G
+  @    changeset:   3:cf9d915cbda8
+  |\   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
+  |
+  o  changeset:   0:3903775176ed
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
+
+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
+  @  changeset:   5:eed8e5d60bdb
+  |  tag:         tip
+  |  parent:      3:cf9d915cbda8
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     f
+  |
+  | o  changeset:   4:2bb82181804e
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     e
+  |
+  o    changeset:   3:cf9d915cbda8
+  |\   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
+  |
+  o  changeset:   0:3903775176ed
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
+  $ 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:eed8e5d60bdb
+  tag:         tip
+  parent:      3:cf9d915cbda8
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     f
+  
+  changeset:   4:2bb82181804e
+  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:f3112b16f74c "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:f3112b16f74c "changes to: f" (tip)
+  unshelve of 'default' complete
+  $ hg parents
+  changeset:   5:eed8e5d60bdb
+  tag:         tip
+  parent:      3:cf9d915cbda8
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     f
+  
+  changeset:   4:2bb82181804e
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     e
+  
+  $ hg commit -m "g"
+  $ hg log -G
+  @    changeset:   6:* (glob)
+  |\   tag:         tip
+  | |  parent:      5:eed8e5d60bdb
+  | |  parent:      4:2bb82181804e
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  summary:     g
+  | |
+  | o  changeset:   5:eed8e5d60bdb
+  | |  parent:      3:cf9d915cbda8
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  summary:     f
+  | |
+  o |  changeset:   4:2bb82181804e
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     e
+  |
+  o    changeset:   3:cf9d915cbda8
+  |\   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
+  |
+  o  changeset:   0:3903775176ed
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
+
+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
+  @  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:eed8e5d60bdb
+  | |  parent:      4:2bb82181804e
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  summary:     g
+  | |
+  | o  changeset:   5:eed8e5d60bdb
+  | |  parent:      3:cf9d915cbda8
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  summary:     f
+  | |
+  o |  changeset:   4:2bb82181804e
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     e
+  |
+  o    changeset:   3:cf9d915cbda8
+  |\   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
+  |
+  o  changeset:   0:3903775176ed
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
+  $ 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 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
+  @  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:eed8e5d60bdb
+  | |  parent:      4:2bb82181804e
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  summary:     g
+  | |
+  | o  changeset:   5:eed8e5d60bdb
+  | |  parent:      3:cf9d915cbda8
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  summary:     f
+  | |
+  o |  changeset:   4:2bb82181804e
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     e
+  |
+  o    changeset:   3:cf9d915cbda8
+  |\   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
+  |
+  o  changeset:   0:3903775176ed
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
_______________________________________________
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] shelve: adds restoring original parents after unshelve (issue5123)

timeless
liscju wrote:
> shelve: adds restoring original parents after unshelve (issue5123)

perhaps: "shelve: restore parents after unshelve (...)"?

"adds" isn't helpful.
also, "original" is confusing.
My initial reading made me think it was the shelve parents.


> Unshelve command works on the first parent of the working directory,

Probably "unshelve operates on ..." (lowercase the command, it's a special
proper name), alternatively "The unshelve command ..."

note "operates" is better than "works"

> in which it does commiting pending changes, applying saved commit
> in shelve and rebasing it to the first parent.

drop "in which it does"
add "the" before "saved"
or use "the commit saved by shelve"

Is it really a "rebase"?

> In this process it totally forgets about second parent, which are

Commit messages should describe "now", to talk about the past,
use "before, it ..." or "previously, ..."

thus "forgot", "were"

> not restored and loses it in the process.

and "lost"

> This commit makes
> unshelve remembers original parents of working directory  and

"remember", and don't use two spaces before "and" :o

> recreates it when working context had more than one parent.

it -> them
add "the" before "working"

> To save information about original parents this commit adds line

"a line"

> to shelvedstate file format with this information. However it

"to the"

> doesn't break compability, because older version of mercurial will

please spell compatibility correctly.

"versions" of the "mercurial shelve extension"

> not read this line. If version of mercurial with this commit will

"a version"
drop "will"

> read older version of shelvedstate file it will not break as well,

"reads an"; "of the"; well -> either

> because when line is absent fp.readline() returns empty string,

"the line"
returns->will return an

> resulting in originalparents being empty list. Function restoreparents
> restores parents when there is more than one parent in parents list.

I'd split "Function" into its own paragraph, but I'm not sure if this
new "paragraph" is necessary.

> test-shelve uses some globs, because shelve --continue changes nodeid
> of the base context in which works.

I don't understand this
_______________________________________________
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] shelve: adds restoring original parents after unshelve (issue5123)

Yuya Nishihara
In reply to this post by liscju
On Tue, 22 Mar 2016 13:18:00 +0100, liscju wrote:
> # HG changeset patch
> # User liscju <[hidden email]>
> # Date 1458639243 -3600
> #      Tue Mar 22 10:34:03 2016 +0100
> # Node ID 30c3e45abd3e5446757653a85f3a22d9e39f5254
> # Parent  78e4e558fa74aa4489609953328cbcecf1a8a428
> shelve: adds restoring original parents after unshelve (issue5123)

>      def save(cls, repo, name, originalwctx, pendingctx, stripnodes,
> -             branchtorestore):
> +             branchtorestore, originalparents):
>          fp = repo.vfs(cls._filename, 'wb')
>          fp.write('%i\n' % cls._version)
>          fp.write('%s\n' % name)
> @@ -194,6 +196,8 @@ class shelvedstate(object):
>          fp.write('%s\n' %
>                   ' '.join([nodemod.hex(n) for n in stripnodes]))
>          fp.write('%s\n' % branchtorestore)
> +        fp.write('%s\n' %
> +                 ' '.join([nodemod.hex(n) for n in originalparents]))

One of originalparents should be saved as originalwctx (= pctx). And I think
originalparents can be obtained from pendingctx (= tmpwctx).

  pctx -> tmpwctx -> shelvectx
       /
  (p2)-

  if pctx != tmpwctx:
      originalparents = tmpwctx.parents()

> +def restoreparents(repo, parents):
> +    if len(parents) > 1:
> +        repo.setparents(parents[0],
> +                        parents[1])

Maybe it would need begin/endparentchange().
_______________________________________________
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] shelve: adds restoring original parents after unshelve (issue5123)

Yuya Nishihara
On Sat, 26 Mar 2016 16:50:37 +0100, Piotr Listkiewicz wrote:
> > pctx is p1, second parent only exists in working directory, not in
> > changeset history or tmpwctx or shelvectx
>
> I forgot to write that this situation is when merge is not commited, when
> merge is commited then you are right

But shouldn't a merge be committed as it is dirty?

> >> > +def restoreparents(repo, parents):
> >> > +    if len(parents) > 1:
> >> > +        repo.setparents(parents[0],
> >> > +                        parents[1])
> >> Maybe it would need begin/endparentchange().
> >
> > localrepo.setparents invokes begin/endparentchange() internally on
> > dirstate

Oh, you're right. So debugsetparents won't have to do that, too.
_______________________________________________
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] shelve: adds restoring original parents after unshelve (issue5123)

liscju
> > pctx is p1, second parent only exists in working directory, not in
> > changeset history or tmpwctx or shelvectx
>
> I forgot to write that this situation is when merge is not commited, when
> merge is commited then you are right
But shouldn't a merge be committed as it is dirty?

You are right, i didnt think about this. I have to check this once again. 

2016-03-26 17:05 GMT+01:00 Yuya Nishihara <[hidden email]>:
On Sat, 26 Mar 2016 16:50:37 +0100, Piotr Listkiewicz wrote:
> > pctx is p1, second parent only exists in working directory, not in
> > changeset history or tmpwctx or shelvectx
>
> I forgot to write that this situation is when merge is not commited, when
> merge is commited then you are right

But shouldn't a merge be committed as it is dirty?

> >> > +def restoreparents(repo, parents):
> >> > +    if len(parents) > 1:
> >> > +        repo.setparents(parents[0],
> >> > +                        parents[1])
> >> Maybe it would need begin/endparentchange().
> >
> > localrepo.setparents invokes begin/endparentchange() internally on
> > dirstate

Oh, you're right. So debugsetparents won't have to do that, too.


_______________________________________________
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] shelve: adds restoring original parents after unshelve (issue5123)

liscju
> > pctx is p1, second parent only exists in working directory, not in
> > changeset history or tmpwctx or shelvectx
>
> I forgot to write that this situation is when merge is not commited, when
> merge is commited then you are right
But shouldn't a merge be committed as it is dirty?

I checked this once again and You were right. It can be done using tmpwctx and workingctx - i sent patch V2 using only those.


2016-03-26 17:12 GMT+01:00 Piotr Listkiewicz <[hidden email]>:
> > pctx is p1, second parent only exists in working directory, not in
> > changeset history or tmpwctx or shelvectx
>
> I forgot to write that this situation is when merge is not commited, when
> merge is commited then you are right
But shouldn't a merge be committed as it is dirty?

You are right, i didnt think about this. I have to check this once again. 

2016-03-26 17:05 GMT+01:00 Yuya Nishihara <[hidden email]>:
On Sat, 26 Mar 2016 16:50:37 +0100, Piotr Listkiewicz wrote:
> > pctx is p1, second parent only exists in working directory, not in
> > changeset history or tmpwctx or shelvectx
>
> I forgot to write that this situation is when merge is not commited, when
> merge is commited then you are right

But shouldn't a merge be committed as it is dirty?

> >> > +def restoreparents(repo, parents):
> >> > +    if len(parents) > 1:
> >> > +        repo.setparents(parents[0],
> >> > +                        parents[1])
> >> Maybe it would need begin/endparentchange().
> >
> > localrepo.setparents invokes begin/endparentchange() internally on
> > dirstate

Oh, you're right. So debugsetparents won't have to do that, too.



_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel