| 1 |
$ . "$TESTDIR/histedit-helpers.sh" |
| 2 |
|
| 3 |
$ cat >> $HGRCPATH <<EOF |
| 4 |
> [extensions] |
| 5 |
> histedit= |
| 6 |
> EOF |
| 7 |
|
| 8 |
$ initrepo () |
| 9 |
> { |
| 10 |
> hg init $1 |
| 11 |
> cd $1 |
| 12 |
> for x in a b c d e f ; do |
| 13 |
> echo $x$x$x$x$x > $x |
| 14 |
> hg add $x |
| 15 |
> done |
| 16 |
> hg ci -m 'Initial commit' |
| 17 |
> for x in a b c d e f ; do |
| 18 |
> echo $x > $x |
| 19 |
> hg ci -m $x |
| 20 |
> done |
| 21 |
> echo 'I can haz no commute' > e |
| 22 |
> hg ci -m 'does not commute with e' |
| 23 |
> cd .. |
| 24 |
> } |
| 25 |
|
| 26 |
$ initrepo r1 |
| 27 |
$ cd r1 |
| 28 |
|
| 29 |
Initial generation of the command files |
| 30 |
|
| 31 |
$ EDITED="$TESTTMP/editedhistory" |
| 32 |
$ hg log --template 'pick {node|short} {rev} {desc}\n' -r 3 >> $EDITED |
| 33 |
$ hg log --template 'pick {node|short} {rev} {desc}\n' -r 4 >> $EDITED |
| 34 |
$ hg log --template 'pick {node|short} {rev} {desc}\n' -r 7 >> $EDITED |
| 35 |
$ hg log --template 'pick {node|short} {rev} {desc}\n' -r 5 >> $EDITED |
| 36 |
$ hg log --template 'pick {node|short} {rev} {desc}\n' -r 6 >> $EDITED |
| 37 |
$ cat $EDITED |
| 38 |
pick 65a9a84f33fd 3 c |
| 39 |
pick 00f1c5383965 4 d |
| 40 |
pick 39522b764e3d 7 does not commute with e |
| 41 |
pick 7b4e2f4b7bcd 5 e |
| 42 |
pick 500cac37a696 6 f |
| 43 |
|
| 44 |
log before edit |
| 45 |
$ hg log --graph |
| 46 |
@ changeset: 7:39522b764e3d |
| 47 |
| tag: tip |
| 48 |
| user: test |
| 49 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 50 |
| summary: does not commute with e |
| 51 |
| |
| 52 |
o changeset: 6:500cac37a696 |
| 53 |
| user: test |
| 54 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 55 |
| summary: f |
| 56 |
| |
| 57 |
o changeset: 5:7b4e2f4b7bcd |
| 58 |
| user: test |
| 59 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 60 |
| summary: e |
| 61 |
| |
| 62 |
o changeset: 4:00f1c5383965 |
| 63 |
| user: test |
| 64 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 65 |
| summary: d |
| 66 |
| |
| 67 |
o changeset: 3:65a9a84f33fd |
| 68 |
| user: test |
| 69 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 70 |
| summary: c |
| 71 |
| |
| 72 |
o changeset: 2:da6535b52e45 |
| 73 |
| user: test |
| 74 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 75 |
| summary: b |
| 76 |
| |
| 77 |
o changeset: 1:c1f09da44841 |
| 78 |
| user: test |
| 79 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 80 |
| summary: a |
| 81 |
| |
| 82 |
o changeset: 0:1715188a53c7 |
| 83 |
user: test |
| 84 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 85 |
summary: Initial commit |
| 86 |
|
| 87 |
|
| 88 |
edit the history |
| 89 |
$ hg histedit 3 --commands $EDITED 2>&1 | fixbundle |
| 90 |
merging e |
| 91 |
warning: conflicts while merging e! (edit, then use 'hg resolve --mark') |
| 92 |
Fix up the change (pick 39522b764e3d) |
| 93 |
(hg histedit --continue to resume) |
| 94 |
|
| 95 |
abort the edit |
| 96 |
$ hg histedit --abort 2>&1 | fixbundle |
| 97 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 98 |
|
| 99 |
|
| 100 |
second edit set |
| 101 |
|
| 102 |
$ hg log --graph |
| 103 |
@ changeset: 7:39522b764e3d |
| 104 |
| tag: tip |
| 105 |
| user: test |
| 106 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 107 |
| summary: does not commute with e |
| 108 |
| |
| 109 |
o changeset: 6:500cac37a696 |
| 110 |
| user: test |
| 111 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 112 |
| summary: f |
| 113 |
| |
| 114 |
o changeset: 5:7b4e2f4b7bcd |
| 115 |
| user: test |
| 116 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 117 |
| summary: e |
| 118 |
| |
| 119 |
o changeset: 4:00f1c5383965 |
| 120 |
| user: test |
| 121 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 122 |
| summary: d |
| 123 |
| |
| 124 |
o changeset: 3:65a9a84f33fd |
| 125 |
| user: test |
| 126 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 127 |
| summary: c |
| 128 |
| |
| 129 |
o changeset: 2:da6535b52e45 |
| 130 |
| user: test |
| 131 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 132 |
| summary: b |
| 133 |
| |
| 134 |
o changeset: 1:c1f09da44841 |
| 135 |
| user: test |
| 136 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 137 |
| summary: a |
| 138 |
| |
| 139 |
o changeset: 0:1715188a53c7 |
| 140 |
user: test |
| 141 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 142 |
summary: Initial commit |
| 143 |
|
| 144 |
|
| 145 |
edit the history |
| 146 |
$ hg histedit 3 --commands $EDITED 2>&1 | fixbundle |
| 147 |
merging e |
| 148 |
warning: conflicts while merging e! (edit, then use 'hg resolve --mark') |
| 149 |
Fix up the change (pick 39522b764e3d) |
| 150 |
(hg histedit --continue to resume) |
| 151 |
|
| 152 |
fix up |
| 153 |
$ echo 'I can haz no commute' > e |
| 154 |
$ hg resolve --mark e |
| 155 |
(no more unresolved files) |
| 156 |
continue: hg histedit --continue |
| 157 |
$ hg histedit --continue 2>&1 | fixbundle |
| 158 |
merging e |
| 159 |
warning: conflicts while merging e! (edit, then use 'hg resolve --mark') |
| 160 |
Fix up the change (pick 7b4e2f4b7bcd) |
| 161 |
(hg histedit --continue to resume) |
| 162 |
We forcibly enable curses here so we can verify that continuing works |
| 163 |
with curses enabled. |
| 164 |
$ hg continue --config ui.interactive=true \ |
| 165 |
> --config ui.interface=curses 2>&1 | fixbundle |
| 166 |
abort: unresolved merge conflicts (see 'hg help resolve') |
| 167 |
|
| 168 |
This failure is caused by 7b4e2f4b7bcd "e" not rebasing the non commutative |
| 169 |
former children. |
| 170 |
|
| 171 |
just continue this time |
| 172 |
$ hg revert -r 'p1()' e |
| 173 |
make sure the to-be-empty commit doesn't screw up the state (issue5545) |
| 174 |
$ hg histedit --continue 2>&1 | fixbundle |
| 175 |
abort: unresolved merge conflicts (see 'hg help resolve') |
| 176 |
$ hg resolve --mark e |
| 177 |
(no more unresolved files) |
| 178 |
continue: hg histedit --continue |
| 179 |
$ hg continue 2>&1 | fixbundle |
| 180 |
7b4e2f4b7bcd: skipping changeset (no changes) |
| 181 |
|
| 182 |
log after edit |
| 183 |
$ hg log --graph |
| 184 |
@ changeset: 6:7efe1373e4bc |
| 185 |
| tag: tip |
| 186 |
| user: test |
| 187 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 188 |
| summary: f |
| 189 |
| |
| 190 |
o changeset: 5:e334d87a1e55 |
| 191 |
| user: test |
| 192 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 193 |
| summary: does not commute with e |
| 194 |
| |
| 195 |
o changeset: 4:00f1c5383965 |
| 196 |
| user: test |
| 197 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 198 |
| summary: d |
| 199 |
| |
| 200 |
o changeset: 3:65a9a84f33fd |
| 201 |
| user: test |
| 202 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 203 |
| summary: c |
| 204 |
| |
| 205 |
o changeset: 2:da6535b52e45 |
| 206 |
| user: test |
| 207 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 208 |
| summary: b |
| 209 |
| |
| 210 |
o changeset: 1:c1f09da44841 |
| 211 |
| user: test |
| 212 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 213 |
| summary: a |
| 214 |
| |
| 215 |
o changeset: 0:1715188a53c7 |
| 216 |
user: test |
| 217 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 218 |
summary: Initial commit |
| 219 |
|
| 220 |
|
| 221 |
start over |
| 222 |
|
| 223 |
$ cd .. |
| 224 |
|
| 225 |
$ initrepo r2 |
| 226 |
$ cd r2 |
| 227 |
$ rm $EDITED |
| 228 |
$ hg log --template 'pick {node|short} {rev} {desc}\n' -r 3 >> $EDITED |
| 229 |
$ hg log --template 'pick {node|short} {rev} {desc}\n' -r 4 >> $EDITED |
| 230 |
$ hg log --template 'mess {node|short} {rev} {desc}\n' -r 7 >> $EDITED |
| 231 |
$ hg log --template 'pick {node|short} {rev} {desc}\n' -r 5 >> $EDITED |
| 232 |
$ hg log --template 'pick {node|short} {rev} {desc}\n' -r 6 >> $EDITED |
| 233 |
$ cat $EDITED |
| 234 |
pick 65a9a84f33fd 3 c |
| 235 |
pick 00f1c5383965 4 d |
| 236 |
mess 39522b764e3d 7 does not commute with e |
| 237 |
pick 7b4e2f4b7bcd 5 e |
| 238 |
pick 500cac37a696 6 f |
| 239 |
|
| 240 |
edit the history, this time with a fold action |
| 241 |
$ hg histedit 3 --commands $EDITED 2>&1 | fixbundle |
| 242 |
merging e |
| 243 |
warning: conflicts while merging e! (edit, then use 'hg resolve --mark') |
| 244 |
Fix up the change (mess 39522b764e3d) |
| 245 |
(hg histedit --continue to resume) |
| 246 |
|
| 247 |
$ echo 'I can haz no commute' > e |
| 248 |
$ hg resolve --mark e |
| 249 |
(no more unresolved files) |
| 250 |
continue: hg histedit --continue |
| 251 |
$ hg histedit --continue 2>&1 | fixbundle |
| 252 |
merging e |
| 253 |
warning: conflicts while merging e! (edit, then use 'hg resolve --mark') |
| 254 |
Fix up the change (pick 7b4e2f4b7bcd) |
| 255 |
(hg histedit --continue to resume) |
| 256 |
second edit also fails, but just continue |
| 257 |
$ hg revert -r 'p1()' e |
| 258 |
$ hg resolve --mark e |
| 259 |
(no more unresolved files) |
| 260 |
continue: hg histedit --continue |
| 261 |
$ hg continue 2>&1 | fixbundle |
| 262 |
7b4e2f4b7bcd: skipping changeset (no changes) |
| 263 |
|
| 264 |
post message fix |
| 265 |
$ hg log --graph |
| 266 |
@ changeset: 6:7efe1373e4bc |
| 267 |
| tag: tip |
| 268 |
| user: test |
| 269 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 270 |
| summary: f |
| 271 |
| |
| 272 |
o changeset: 5:e334d87a1e55 |
| 273 |
| user: test |
| 274 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 275 |
| summary: does not commute with e |
| 276 |
| |
| 277 |
o changeset: 4:00f1c5383965 |
| 278 |
| user: test |
| 279 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 280 |
| summary: d |
| 281 |
| |
| 282 |
o changeset: 3:65a9a84f33fd |
| 283 |
| user: test |
| 284 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 285 |
| summary: c |
| 286 |
| |
| 287 |
o changeset: 2:da6535b52e45 |
| 288 |
| user: test |
| 289 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 290 |
| summary: b |
| 291 |
| |
| 292 |
o changeset: 1:c1f09da44841 |
| 293 |
| user: test |
| 294 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 295 |
| summary: a |
| 296 |
| |
| 297 |
o changeset: 0:1715188a53c7 |
| 298 |
user: test |
| 299 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 300 |
summary: Initial commit |
| 301 |
|
| 302 |
|
| 303 |
An invalid editor shouldn't leave the user in a broken state: |
| 304 |
$ EDITOR=totally-not-a-thing-unsensible-editor-value hg histedit 4 |
| 305 |
|
| 306 |
$ cd .. |