test-histedit-edit.t
224 lines
| 6.1 KiB
| text/troff
|
Tads3Lexer
/ tests / test-histedit-edit.t
|
r17085 | $ . "$TESTDIR/histedit-helpers.sh" | ||
$ cat >> $HGRCPATH <<EOF | ||||
> [extensions] | ||||
> graphlog= | ||||
> histedit= | ||||
> EOF | ||||
|
r17087 | $ EDITED="$TESTTMP/editedhistory" | ||
|
r17085 | $ cat > $EDITED <<EOF | ||
> pick 177f92b77385 c | ||||
> pick 055a42cdd887 d | ||||
> edit e860deea161a e | ||||
> pick 652413bf663e f | ||||
> EOF | ||||
$ initrepo () | ||||
> { | ||||
> hg init r | ||||
> cd r | ||||
> for x in a b c d e f ; do | ||||
> echo $x > $x | ||||
> hg add $x | ||||
> hg ci -m $x | ||||
> done | ||||
> } | ||||
$ initrepo | ||||
log before edit | ||||
$ hg log --graph | ||||
@ changeset: 5:652413bf663e | ||||
| tag: tip | ||||
| user: test | ||||
| date: Thu Jan 01 00:00:00 1970 +0000 | ||||
| summary: f | ||||
| | ||||
o changeset: 4:e860deea161a | ||||
| user: test | ||||
| date: Thu Jan 01 00:00:00 1970 +0000 | ||||
| summary: e | ||||
| | ||||
o changeset: 3:055a42cdd887 | ||||
| user: test | ||||
| date: Thu Jan 01 00:00:00 1970 +0000 | ||||
| summary: d | ||||
| | ||||
o changeset: 2:177f92b77385 | ||||
| user: test | ||||
| date: Thu Jan 01 00:00:00 1970 +0000 | ||||
| summary: c | ||||
| | ||||
o changeset: 1:d2ae7f538514 | ||||
| user: test | ||||
| date: Thu Jan 01 00:00:00 1970 +0000 | ||||
| summary: b | ||||
| | ||||
o changeset: 0:cb9a9f314b8b | ||||
user: test | ||||
date: Thu Jan 01 00:00:00 1970 +0000 | ||||
summary: a | ||||
edit the history | ||||
|
r17086 | $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle | ||
|
r17085 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | ||
abort: Make changes as needed, you may commit or record as needed now. | ||||
When you are finished, run hg histedit --continue to resume. | ||||
|
r17749 | Go at a random point and try to continue | ||
$ hg id -n | ||||
3+ | ||||
$ hg up 0 | ||||
0 files updated, 0 files merged, 3 files removed, 0 files unresolved | ||||
$ HGEDITOR='echo foobaz > ' hg histedit --continue | ||||
|
r18609 | abort: 055a42cdd887 is not an ancestor of working directory | ||
|
r17749 | (update to 055a42cdd887 or descendant and run "hg histedit --continue" again) | ||
[255] | ||||
$ hg up 3 | ||||
3 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||||
|
r17085 | commit, then edit the revision | ||
$ hg ci -m 'wat' | ||||
created new head | ||||
$ echo a > e | ||||
|
r17087 | $ HGEDITOR='echo foobaz > ' hg histedit --continue 2>&1 | fixbundle | ||
|
r17085 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||
0 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||||
$ hg log --graph | ||||
|
r18437 | @ changeset: 6:b5f70786f9b0 | ||
|
r17085 | | tag: tip | ||
| user: test | ||||
| date: Thu Jan 01 00:00:00 1970 +0000 | ||||
| summary: f | ||||
| | ||||
|
r18437 | o changeset: 5:a5e1ba2f7afb | ||
|
r17085 | | user: test | ||
| date: Thu Jan 01 00:00:00 1970 +0000 | ||||
| summary: foobaz | ||||
| | ||||
o changeset: 4:1a60820cd1f6 | ||||
| user: test | ||||
| date: Thu Jan 01 00:00:00 1970 +0000 | ||||
| summary: wat | ||||
| | ||||
o changeset: 3:055a42cdd887 | ||||
| user: test | ||||
| date: Thu Jan 01 00:00:00 1970 +0000 | ||||
| summary: d | ||||
| | ||||
o changeset: 2:177f92b77385 | ||||
| user: test | ||||
| date: Thu Jan 01 00:00:00 1970 +0000 | ||||
| summary: c | ||||
| | ||||
o changeset: 1:d2ae7f538514 | ||||
| user: test | ||||
| date: Thu Jan 01 00:00:00 1970 +0000 | ||||
| summary: b | ||||
| | ||||
o changeset: 0:cb9a9f314b8b | ||||
user: test | ||||
date: Thu Jan 01 00:00:00 1970 +0000 | ||||
summary: a | ||||
$ hg cat e | ||||
a | ||||
|
r18437 | check histedit_source | ||
$ hg log --debug --rev 5 | ||||
changeset: 5:a5e1ba2f7afb899ef1581cea528fd885d2fca70d | ||||
phase: draft | ||||
parent: 4:1a60820cd1f6004a362aa622ebc47d59bc48eb34 | ||||
parent: -1:0000000000000000000000000000000000000000 | ||||
manifest: 5:5ad3be8791f39117565557781f5464363b918a45 | ||||
user: test | ||||
date: Thu Jan 01 00:00:00 1970 +0000 | ||||
files: e | ||||
extra: branch=default | ||||
extra: histedit_source=e860deea161a2f77de56603b340ebbb4536308ae | ||||
description: | ||||
foobaz | ||||
|
r17085 | $ cat > $EDITED <<EOF | ||
|
r18437 | > edit b5f70786f9b0 f | ||
|
r17085 | > EOF | ||
|
r17086 | $ HGEDITOR="cat \"$EDITED\" > " hg histedit tip 2>&1 | fixbundle | ||
|
r17085 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | ||
abort: Make changes as needed, you may commit or record as needed now. | ||||
When you are finished, run hg histedit --continue to resume. | ||||
$ hg status | ||||
A f | ||||
$ HGEDITOR='true' hg histedit --continue | ||||
0 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||||
|
r18437 | saved backup bundle to $TESTTMP/r/.hg/strip-backup/b5f70786f9b0-backup.hg (glob) | ||
|
r17085 | $ hg status | ||
log after edit | ||||
$ hg log --limit 1 | ||||
|
r18437 | changeset: 6:a107ee126658 | ||
|
r17085 | tag: tip | ||
user: test | ||||
date: Thu Jan 01 00:00:00 1970 +0000 | ||||
summary: f | ||||
say we'll change the message, but don't. | ||||
$ cat > ../edit.sh <<EOF | ||||
|
r17086 | > cat "\$1" | sed s/pick/mess/ > tmp | ||
> mv tmp "\$1" | ||||
|
r17085 | > EOF | ||
|
r17086 | $ HGEDITOR="sh ../edit.sh" hg histedit tip 2>&1 | fixbundle | ||
|
r17085 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | ||
0 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||||
$ hg status | ||||
$ hg log --limit 1 | ||||
|
r18437 | changeset: 6:1fd3b2fe7754 | ||
|
r17085 | tag: tip | ||
user: test | ||||
date: Thu Jan 01 00:00:00 1970 +0000 | ||||
summary: f | ||||
modify the message | ||||
$ cat > $EDITED <<EOF | ||||
|
r18437 | > mess 1fd3b2fe7754 f | ||
|
r17085 | > EOF | ||
|
r17086 | $ HGEDITOR="cat \"$EDITED\" > " hg histedit tip 2>&1 | fixbundle | ||
|
r17085 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | ||
0 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||||
$ hg status | ||||
$ hg log --limit 1 | ||||
|
r18437 | changeset: 6:5585e802ef99 | ||
|
r17085 | tag: tip | ||
user: test | ||||
date: Thu Jan 01 00:00:00 1970 +0000 | ||||
|
r18437 | summary: mess 1fd3b2fe7754 f | ||
|
r17085 | |||
rollback should not work after a histedit | ||||
$ hg rollback | ||||
no rollback information available | ||||
[1] | ||||
$ cd .. | ||||
|
r18913 | $ hg clone -qr0 r r0 | ||
$ cd r0 | ||||
$ echo edit cb9a9f314b8b a > $EDITED | ||||
$ hg phase -fdr0 | ||||
$ HGEDITOR="cat \"$EDITED\" > " hg histedit 0 2>&1 | ||||
0 files updated, 0 files merged, 1 files removed, 0 files unresolved | ||||
adding a | ||||
abort: Make changes as needed, you may commit or record as needed now. | ||||
When you are finished, run hg histedit --continue to resume. | ||||
[255] | ||||
$ HGEDITOR=true hg histedit --continue | ||||
0 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||||
saved backup bundle to $TESTTMP/r0/.hg/strip-backup/cb9a9f314b8b-backup.hg (glob) | ||||