| 1 |
$ . "$TESTDIR/histedit-helpers.sh" |
| 2 |
|
| 3 |
$ cat >> $HGRCPATH <<EOF |
| 4 |
> [extensions] |
| 5 |
> histedit= |
| 6 |
> EOF |
| 7 |
|
| 8 |
$ initrepo () |
| 9 |
> { |
| 10 |
> hg init r |
| 11 |
> cd r |
| 12 |
> for x in a b c d e f ; do |
| 13 |
> echo $x > $x |
| 14 |
> hg add $x |
| 15 |
> hg ci -m $x |
| 16 |
> done |
| 17 |
> echo a >> e |
| 18 |
> hg ci -m 'does not commute with e' |
| 19 |
> cd .. |
| 20 |
> } |
| 21 |
|
| 22 |
$ initrepo |
| 23 |
$ cd r |
| 24 |
|
| 25 |
log before edit |
| 26 |
$ hg log --graph |
| 27 |
@ changeset: 6:bfa474341cc9 |
| 28 |
| tag: tip |
| 29 |
| user: test |
| 30 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 31 |
| summary: does not commute with e |
| 32 |
| |
| 33 |
o changeset: 5:652413bf663e |
| 34 |
| user: test |
| 35 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 36 |
| summary: f |
| 37 |
| |
| 38 |
o changeset: 4:e860deea161a |
| 39 |
| user: test |
| 40 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 41 |
| summary: e |
| 42 |
| |
| 43 |
o changeset: 3:055a42cdd887 |
| 44 |
| user: test |
| 45 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 46 |
| summary: d |
| 47 |
| |
| 48 |
o changeset: 2:177f92b77385 |
| 49 |
| user: test |
| 50 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 51 |
| summary: c |
| 52 |
| |
| 53 |
o changeset: 1:d2ae7f538514 |
| 54 |
| user: test |
| 55 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 56 |
| summary: b |
| 57 |
| |
| 58 |
o changeset: 0:cb9a9f314b8b |
| 59 |
user: test |
| 60 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 61 |
summary: a |
| 62 |
|
| 63 |
|
| 64 |
edit the history |
| 65 |
$ hg histedit 177f92b77385 --commands - 2>&1 <<EOF | fixbundle |
| 66 |
> pick 177f92b77385 c |
| 67 |
> pick 055a42cdd887 d |
| 68 |
> pick bfa474341cc9 does not commute with e |
| 69 |
> pick e860deea161a e |
| 70 |
> pick 652413bf663e f |
| 71 |
> EOF |
| 72 |
merging e |
| 73 |
warning: conflicts while merging e! (edit, then use 'hg resolve --mark') |
| 74 |
Fix up the change (pick e860deea161a) |
| 75 |
(hg histedit --continue to resume) |
| 76 |
|
| 77 |
insert unsupported advisory merge record |
| 78 |
$ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py fakemergerecord -x |
| 79 |
$ hg debugmergestate |
| 80 |
local (already edited): 8f7551c7e4a2f2efe0bc8c741baf7f227d65d758 |
| 81 |
other (current change): e860deea161a2f77de56603b340ebbb4536308ae |
| 82 |
file: e (state "u") |
| 83 |
local path: e (hash 58e6b3a414a1e090dfc6029add0f3555ccba127f, flags "") |
| 84 |
ancestor path: e (node 0000000000000000000000000000000000000000) |
| 85 |
other path: e (node 6b67ccefd5ce6de77e7ead4f5292843a0255329f) |
| 86 |
extra: ancestorlinknode = 0000000000000000000000000000000000000000 |
| 87 |
extra: merged = yes |
| 88 |
$ hg resolve -l |
| 89 |
U e |
| 90 |
|
| 91 |
insert unsupported mandatory merge record |
| 92 |
$ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py fakemergerecord -X |
| 93 |
$ hg debugmergestate |
| 94 |
abort: unsupported merge state records: X |
| 95 |
(see https://mercurial-scm.org/wiki/MergeStateRecords for more information) |
| 96 |
[255] |
| 97 |
$ hg resolve -l |
| 98 |
abort: unsupported merge state records: X |
| 99 |
(see https://mercurial-scm.org/wiki/MergeStateRecords for more information) |
| 100 |
[255] |
| 101 |
$ hg resolve -ma |
| 102 |
abort: unsupported merge state records: X |
| 103 |
(see https://mercurial-scm.org/wiki/MergeStateRecords for more information) |
| 104 |
[255] |
| 105 |
|
| 106 |
abort the edit (should clear out merge state) |
| 107 |
$ hg histedit --abort 2>&1 | fixbundle |
| 108 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 109 |
$ hg debugmergestate |
| 110 |
no merge state found |
| 111 |
|
| 112 |
log after abort |
| 113 |
$ hg resolve -l |
| 114 |
$ hg log --graph |
| 115 |
@ changeset: 6:bfa474341cc9 |
| 116 |
| tag: tip |
| 117 |
| user: test |
| 118 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 119 |
| summary: does not commute with e |
| 120 |
| |
| 121 |
o changeset: 5:652413bf663e |
| 122 |
| user: test |
| 123 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 124 |
| summary: f |
| 125 |
| |
| 126 |
o changeset: 4:e860deea161a |
| 127 |
| user: test |
| 128 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 129 |
| summary: e |
| 130 |
| |
| 131 |
o changeset: 3:055a42cdd887 |
| 132 |
| user: test |
| 133 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 134 |
| summary: d |
| 135 |
| |
| 136 |
o changeset: 2:177f92b77385 |
| 137 |
| user: test |
| 138 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 139 |
| summary: c |
| 140 |
| |
| 141 |
o changeset: 1:d2ae7f538514 |
| 142 |
| user: test |
| 143 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 144 |
| summary: b |
| 145 |
| |
| 146 |
o changeset: 0:cb9a9f314b8b |
| 147 |
user: test |
| 148 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 149 |
summary: a |
| 150 |
|
| 151 |
|
| 152 |
Early tree conflict doesn't leave histedit in a wedged state. Note |
| 153 |
that we don't specify --commands here: we catch the problem before we |
| 154 |
even prompt the user for rules, sidestepping any dataloss issues. |
| 155 |
|
| 156 |
$ hg rm c |
| 157 |
$ hg ci -m 'remove c' |
| 158 |
$ echo collision > c |
| 159 |
|
| 160 |
$ hg histedit e860deea161a |
| 161 |
c: untracked file differs |
| 162 |
abort: untracked files in working directory conflict with files in 055a42cdd887 |
| 163 |
[20] |
| 164 |
|
| 165 |
We should have detected the collision early enough we're not in a |
| 166 |
histedit state, and p1 is unchanged. |
| 167 |
|
| 168 |
$ hg log -r 'p1()' -T'{node}\n' |
| 169 |
1b0954ff00fccb15a37b679e4a35e9b01dfe685e |
| 170 |
$ hg status --config ui.tweakdefaults=yes |
| 171 |
? c |
| 172 |
? e.orig |
| 173 |
|
| 174 |
$ cd .. |