comparison tests/test-shelve.t @ 42050:03f6480bfdda

unshelve: disable unshelve during merge (issue5123) As stated in the issue5123, unshelve can destroy the second parent of the context when tried to unshelve with an uncommitted merge. This patch makes unshelve to abort when called with an uncommitted merge. See 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(with 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. Changing this revert operation is crucial to restore parents after unshelve. This is a complicated issue as this is not fixing a regression. Thus, for the time being, unshelve during an uncommitted merge can be aborted. (Details taken from http://mercurial.808500.n3.nabble.com/PATCH-V3-shelve-restore-parents-after-unshelve-issue5123-tt4036858.html#a4037408) Differential Revision: https://phab.mercurial-scm.org/D6169
author Navaneeth Suresh <navaneeths1998@gmail.com>
date Mon, 25 Mar 2019 12:33:41 +0530
parents 00c1ee0f746a
children 12243f15d53e
comparison
equal deleted inserted replaced
42049:1711f5813a63 42050:03f6480bfdda
1109 $ hg bookmarks 1109 $ hg bookmarks
1110 \* foo (5|19):703117a2acfb (re) 1110 \* foo (5|19):703117a2acfb (re)
1111 test (4|13):33f7f61e6c5e (re) 1111 test (4|13):33f7f61e6c5e (re)
1112 1112
1113 $ cd .. 1113 $ cd ..
1114
1115 Abort unshelve while merging (issue5123)
1116 ----------------------------------------
1117
1118 $ hg init issue5123
1119 $ cd issue5123
1120 $ echo > a
1121 $ hg ci -Am a
1122 adding a
1123 $ hg co null
1124 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1125 $ echo > b
1126 $ hg ci -Am b
1127 adding b
1128 created new head
1129 $ echo > c
1130 $ hg add c
1131 $ hg shelve
1132 shelved as default
1133 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1134 $ hg co 1
1135 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1136 $ hg merge 0
1137 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1138 (branch merge, don't forget to commit)
1139 -- successful merge with two parents
1140 $ hg log -G
1141 @ changeset: 1:406bf70c274f
1142 tag: tip
1143 parent: -1:000000000000
1144 user: test
1145 date: Thu Jan 01 00:00:00 1970 +0000
1146 summary: b
1147
1148 @ changeset: 0:ada8c9eb8252
1149 user: test
1150 date: Thu Jan 01 00:00:00 1970 +0000
1151 summary: a
1152
1153 -- trying to pull in the shelve bits
1154 -- unshelve should abort otherwise, it'll eat my second parent.
1155 $ hg unshelve
1156 abort: cannot unshelve while merging
1157 [255]
1158
1159 $ cd ..