| 1 |
$ . "$TESTDIR/histedit-helpers.sh" |
| 2 |
|
| 3 |
$ cat >> $HGRCPATH <<EOF |
| 4 |
> [extensions] |
| 5 |
> histedit= |
| 6 |
> EOF |
| 7 |
|
| 8 |
$ modwithdate () |
| 9 |
> { |
| 10 |
> echo $1 > $1 |
| 11 |
> hg ci -m $1 -d "$2 0" |
| 12 |
> } |
| 13 |
|
| 14 |
$ initrepo () |
| 15 |
> { |
| 16 |
> hg init $1 |
| 17 |
> cd $1 |
| 18 |
> for x in a b c d e f ; do |
| 19 |
> echo $x$x$x$x$x > $x |
| 20 |
> hg add $x |
| 21 |
> done |
| 22 |
> hg ci -m 'Initial commit' |
| 23 |
> modwithdate a 1 |
| 24 |
> modwithdate b 2 |
| 25 |
> modwithdate c 3 |
| 26 |
> modwithdate d 4 |
| 27 |
> modwithdate e 5 |
| 28 |
> modwithdate f 6 |
| 29 |
> echo 'I can haz no commute' > e |
| 30 |
> hg ci -m 'does not commute with e' -d '7 0' |
| 31 |
> cd .. |
| 32 |
> } |
| 33 |
|
| 34 |
$ initrepo r |
| 35 |
$ cd r |
| 36 |
Initial generation of the command files |
| 37 |
|
| 38 |
$ EDITED="$TESTTMP/editedhistory" |
| 39 |
$ hg log --template 'pick {node|short} {rev} {desc}\n' -r 3 >> $EDITED |
| 40 |
$ hg log --template 'pick {node|short} {rev} {desc}\n' -r 4 >> $EDITED |
| 41 |
$ hg log --template 'fold {node|short} {rev} {desc}\n' -r 7 >> $EDITED |
| 42 |
$ hg log --template 'pick {node|short} {rev} {desc}\n' -r 5 >> $EDITED |
| 43 |
$ hg log --template 'pick {node|short} {rev} {desc}\n' -r 6 >> $EDITED |
| 44 |
$ cat $EDITED |
| 45 |
pick 092e4ce14829 3 c |
| 46 |
pick ae78f4c9d74f 4 d |
| 47 |
fold 42abbb61bede 7 does not commute with e |
| 48 |
pick 7f3755409b00 5 e |
| 49 |
pick dd184f2faeb0 6 f |
| 50 |
|
| 51 |
log before edit |
| 52 |
$ hg log --graph |
| 53 |
@ changeset: 7:42abbb61bede |
| 54 |
| tag: tip |
| 55 |
| user: test |
| 56 |
| date: Thu Jan 01 00:00:07 1970 +0000 |
| 57 |
| summary: does not commute with e |
| 58 |
| |
| 59 |
o changeset: 6:dd184f2faeb0 |
| 60 |
| user: test |
| 61 |
| date: Thu Jan 01 00:00:06 1970 +0000 |
| 62 |
| summary: f |
| 63 |
| |
| 64 |
o changeset: 5:7f3755409b00 |
| 65 |
| user: test |
| 66 |
| date: Thu Jan 01 00:00:05 1970 +0000 |
| 67 |
| summary: e |
| 68 |
| |
| 69 |
o changeset: 4:ae78f4c9d74f |
| 70 |
| user: test |
| 71 |
| date: Thu Jan 01 00:00:04 1970 +0000 |
| 72 |
| summary: d |
| 73 |
| |
| 74 |
o changeset: 3:092e4ce14829 |
| 75 |
| user: test |
| 76 |
| date: Thu Jan 01 00:00:03 1970 +0000 |
| 77 |
| summary: c |
| 78 |
| |
| 79 |
o changeset: 2:40ccdd8beb95 |
| 80 |
| user: test |
| 81 |
| date: Thu Jan 01 00:00:02 1970 +0000 |
| 82 |
| summary: b |
| 83 |
| |
| 84 |
o changeset: 1:cd997a145b29 |
| 85 |
| user: test |
| 86 |
| date: Thu Jan 01 00:00:01 1970 +0000 |
| 87 |
| summary: a |
| 88 |
| |
| 89 |
o changeset: 0:1715188a53c7 |
| 90 |
user: test |
| 91 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 92 |
summary: Initial commit |
| 93 |
|
| 94 |
|
| 95 |
edit the history |
| 96 |
$ hg histedit 3 --commands $EDITED 2>&1 | fixbundle |
| 97 |
merging e |
| 98 |
warning: conflicts while merging e! (edit, then use 'hg resolve --mark') |
| 99 |
Fix up the change (fold 42abbb61bede) |
| 100 |
(hg histedit --continue to resume) |
| 101 |
|
| 102 |
fix up |
| 103 |
$ echo 'I can haz no commute' > e |
| 104 |
$ hg resolve --mark e |
| 105 |
(no more unresolved files) |
| 106 |
continue: hg histedit --continue |
| 107 |
$ HGEDITOR=cat hg histedit --continue 2>&1 | fixbundle | grep -v '2 files removed' |
| 108 |
d |
| 109 |
*** |
| 110 |
does not commute with e |
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
HG: Enter commit message. Lines beginning with 'HG:' are removed. |
| 115 |
HG: Leave message empty to abort commit. |
| 116 |
HG: -- |
| 117 |
HG: user: test |
| 118 |
HG: branch 'default' |
| 119 |
HG: changed d |
| 120 |
HG: changed e |
| 121 |
merging e |
| 122 |
warning: conflicts while merging e! (edit, then use 'hg resolve --mark') |
| 123 |
Fix up the change (pick 7f3755409b00) |
| 124 |
(hg histedit --continue to resume) |
| 125 |
|
| 126 |
just continue this time |
| 127 |
keep the non-commuting change, and thus the pending change will be dropped |
| 128 |
$ hg revert -r 'p1()' e |
| 129 |
$ hg resolve --mark e |
| 130 |
(no more unresolved files) |
| 131 |
continue: hg histedit --continue |
| 132 |
$ hg diff |
| 133 |
$ hg continue 2>&1 | fixbundle |
| 134 |
7f3755409b00: skipping changeset (no changes) |
| 135 |
|
| 136 |
log after edit |
| 137 |
$ hg log --graph |
| 138 |
@ changeset: 5:1300355b1a54 |
| 139 |
| tag: tip |
| 140 |
| user: test |
| 141 |
| date: Thu Jan 01 00:00:06 1970 +0000 |
| 142 |
| summary: f |
| 143 |
| |
| 144 |
o changeset: 4:e2ac33269083 |
| 145 |
| user: test |
| 146 |
| date: Thu Jan 01 00:00:07 1970 +0000 |
| 147 |
| summary: d |
| 148 |
| |
| 149 |
o changeset: 3:092e4ce14829 |
| 150 |
| user: test |
| 151 |
| date: Thu Jan 01 00:00:03 1970 +0000 |
| 152 |
| summary: c |
| 153 |
| |
| 154 |
o changeset: 2:40ccdd8beb95 |
| 155 |
| user: test |
| 156 |
| date: Thu Jan 01 00:00:02 1970 +0000 |
| 157 |
| summary: b |
| 158 |
| |
| 159 |
o changeset: 1:cd997a145b29 |
| 160 |
| user: test |
| 161 |
| date: Thu Jan 01 00:00:01 1970 +0000 |
| 162 |
| summary: a |
| 163 |
| |
| 164 |
o changeset: 0:1715188a53c7 |
| 165 |
user: test |
| 166 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 167 |
summary: Initial commit |
| 168 |
|
| 169 |
|
| 170 |
contents of e |
| 171 |
$ hg cat e |
| 172 |
I can haz no commute |
| 173 |
|
| 174 |
manifest |
| 175 |
$ hg manifest |
| 176 |
a |
| 177 |
b |
| 178 |
c |
| 179 |
d |
| 180 |
e |
| 181 |
f |
| 182 |
|
| 183 |
$ cd .. |
| 184 |
|
| 185 |
Repeat test using "roll", not "fold". "roll" folds in changes but drops message and date |
| 186 |
|
| 187 |
$ initrepo r2 |
| 188 |
$ cd r2 |
| 189 |
|
| 190 |
Initial generation of the command files |
| 191 |
|
| 192 |
$ EDITED="$TESTTMP/editedhistory.2" |
| 193 |
$ hg log --template 'pick {node|short} {rev} {desc}\n' -r 3 >> $EDITED |
| 194 |
$ hg log --template 'pick {node|short} {rev} {desc}\n' -r 4 >> $EDITED |
| 195 |
$ hg log --template 'roll {node|short} {rev} {desc}\n' -r 7 >> $EDITED |
| 196 |
$ hg log --template 'pick {node|short} {rev} {desc}\n' -r 5 >> $EDITED |
| 197 |
$ hg log --template 'pick {node|short} {rev} {desc}\n' -r 6 >> $EDITED |
| 198 |
$ cat $EDITED |
| 199 |
pick 092e4ce14829 3 c |
| 200 |
pick ae78f4c9d74f 4 d |
| 201 |
roll 42abbb61bede 7 does not commute with e |
| 202 |
pick 7f3755409b00 5 e |
| 203 |
pick dd184f2faeb0 6 f |
| 204 |
|
| 205 |
log before edit |
| 206 |
$ hg log --graph |
| 207 |
@ changeset: 7:42abbb61bede |
| 208 |
| tag: tip |
| 209 |
| user: test |
| 210 |
| date: Thu Jan 01 00:00:07 1970 +0000 |
| 211 |
| summary: does not commute with e |
| 212 |
| |
| 213 |
o changeset: 6:dd184f2faeb0 |
| 214 |
| user: test |
| 215 |
| date: Thu Jan 01 00:00:06 1970 +0000 |
| 216 |
| summary: f |
| 217 |
| |
| 218 |
o changeset: 5:7f3755409b00 |
| 219 |
| user: test |
| 220 |
| date: Thu Jan 01 00:00:05 1970 +0000 |
| 221 |
| summary: e |
| 222 |
| |
| 223 |
o changeset: 4:ae78f4c9d74f |
| 224 |
| user: test |
| 225 |
| date: Thu Jan 01 00:00:04 1970 +0000 |
| 226 |
| summary: d |
| 227 |
| |
| 228 |
o changeset: 3:092e4ce14829 |
| 229 |
| user: test |
| 230 |
| date: Thu Jan 01 00:00:03 1970 +0000 |
| 231 |
| summary: c |
| 232 |
| |
| 233 |
o changeset: 2:40ccdd8beb95 |
| 234 |
| user: test |
| 235 |
| date: Thu Jan 01 00:00:02 1970 +0000 |
| 236 |
| summary: b |
| 237 |
| |
| 238 |
o changeset: 1:cd997a145b29 |
| 239 |
| user: test |
| 240 |
| date: Thu Jan 01 00:00:01 1970 +0000 |
| 241 |
| summary: a |
| 242 |
| |
| 243 |
o changeset: 0:1715188a53c7 |
| 244 |
user: test |
| 245 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 246 |
summary: Initial commit |
| 247 |
|
| 248 |
|
| 249 |
edit the history |
| 250 |
$ hg histedit 3 --commands $EDITED 2>&1 | fixbundle |
| 251 |
merging e |
| 252 |
warning: conflicts while merging e! (edit, then use 'hg resolve --mark') |
| 253 |
Fix up the change (roll 42abbb61bede) |
| 254 |
(hg histedit --continue to resume) |
| 255 |
|
| 256 |
fix up |
| 257 |
$ echo 'I can haz no commute' > e |
| 258 |
$ hg resolve --mark e |
| 259 |
(no more unresolved files) |
| 260 |
continue: hg histedit --continue |
| 261 |
$ hg histedit --continue 2>&1 | fixbundle | grep -v '2 files removed' |
| 262 |
merging e |
| 263 |
warning: conflicts while merging e! (edit, then use 'hg resolve --mark') |
| 264 |
Fix up the change (pick 7f3755409b00) |
| 265 |
(hg histedit --continue to resume) |
| 266 |
|
| 267 |
just continue this time |
| 268 |
$ hg revert -r 'p1()' e |
| 269 |
$ hg resolve --mark e |
| 270 |
(no more unresolved files) |
| 271 |
continue: hg histedit --continue |
| 272 |
$ hg continue 2>&1 | fixbundle |
| 273 |
7f3755409b00: skipping changeset (no changes) |
| 274 |
|
| 275 |
log after edit |
| 276 |
$ hg log --graph |
| 277 |
@ changeset: 5:b538bcb461be |
| 278 |
| tag: tip |
| 279 |
| user: test |
| 280 |
| date: Thu Jan 01 00:00:06 1970 +0000 |
| 281 |
| summary: f |
| 282 |
| |
| 283 |
o changeset: 4:317e37cb6d66 |
| 284 |
| user: test |
| 285 |
| date: Thu Jan 01 00:00:04 1970 +0000 |
| 286 |
| summary: d |
| 287 |
| |
| 288 |
o changeset: 3:092e4ce14829 |
| 289 |
| user: test |
| 290 |
| date: Thu Jan 01 00:00:03 1970 +0000 |
| 291 |
| summary: c |
| 292 |
| |
| 293 |
o changeset: 2:40ccdd8beb95 |
| 294 |
| user: test |
| 295 |
| date: Thu Jan 01 00:00:02 1970 +0000 |
| 296 |
| summary: b |
| 297 |
| |
| 298 |
o changeset: 1:cd997a145b29 |
| 299 |
| user: test |
| 300 |
| date: Thu Jan 01 00:00:01 1970 +0000 |
| 301 |
| summary: a |
| 302 |
| |
| 303 |
o changeset: 0:1715188a53c7 |
| 304 |
user: test |
| 305 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 306 |
summary: Initial commit |
| 307 |
|
| 308 |
|
| 309 |
contents of e |
| 310 |
$ hg cat e |
| 311 |
I can haz no commute |
| 312 |
|
| 313 |
manifest |
| 314 |
$ hg manifest |
| 315 |
a |
| 316 |
b |
| 317 |
c |
| 318 |
d |
| 319 |
e |
| 320 |
f |
| 321 |
|
| 322 |
description is taken from rollup target commit |
| 323 |
|
| 324 |
$ hg log --debug --rev 4 |
| 325 |
changeset: 4:317e37cb6d66c1c84628c00e5bf4c8c292831951 |
| 326 |
phase: draft |
| 327 |
parent: 3:092e4ce14829f4974399ce4316d59f64ef0b6725 |
| 328 |
parent: -1:0000000000000000000000000000000000000000 |
| 329 |
manifest: 4:b068a323d969f22af1296ec6a5ea9384cef437ac |
| 330 |
user: test |
| 331 |
date: Thu Jan 01 00:00:04 1970 +0000 |
| 332 |
files: d e |
| 333 |
extra: branch=default |
| 334 |
extra: histedit_source=ae78f4c9d74ffa4b6cb5045001c303fe9204e890,42abbb61bede6f4366fa1e74a664343e5d558a70 |
| 335 |
description: |
| 336 |
d |
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
done with repo r2 |
| 341 |
|
| 342 |
$ cd .. |