Mercurial > hg > mercurial-source
comparison tests/test-histedit-commute @ 17064:168cc52ad7c2
histedit: new extension for interactive history editing
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Wed, 27 Jun 2012 17:52:54 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
17063:3fbc6e3abdbd | 17064:168cc52ad7c2 |
---|---|
1 #!/bin/sh | |
2 | |
3 . "$TESTDIR/histedit-helpers.sh" | |
4 | |
5 cat >> $HGRCPATH <<EOF | |
6 [extensions] | |
7 graphlog= | |
8 histedit= | |
9 EOF | |
10 | |
11 EDITED=`pwd`/editedhistory | |
12 cat > $EDITED <<EOF | |
13 pick 177f92b77385 c | |
14 pick e860deea161a e | |
15 pick 652413bf663e f | |
16 pick 055a42cdd887 d | |
17 EOF | |
18 initrepo () | |
19 { | |
20 hg init r | |
21 cd r | |
22 for x in a b c d e f ; do | |
23 echo $x > $x | |
24 hg add $x | |
25 hg ci -m $x | |
26 done | |
27 } | |
28 | |
29 initrepo | |
30 | |
31 echo % log before edit | |
32 hg log --graph | |
33 | |
34 echo % show the edit commands offered | |
35 HGEDITOR=cat hg histedit 177f92b77385 | |
36 | |
37 echo % edit the history | |
38 HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle | |
39 | |
40 echo % rules should end up in .hg/histedit-last-edit.txt: | |
41 cat .hg/histedit-last-edit.txt | |
42 echo '**** end of rules file ****' | |
43 | |
44 echo % log after edit | |
45 hg log --graph | |
46 | |
47 echo % put things back | |
48 | |
49 cat > $EDITED <<EOF | |
50 pick 177f92b77385 c | |
51 pick 853c68da763f d | |
52 pick b069cc29fb22 e | |
53 pick 26f6a030ae82 f | |
54 EOF | |
55 HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle | |
56 | |
57 hg log --graph | |
58 | |
59 | |
60 echo % slightly different this time | |
61 | |
62 cat > $EDITED <<EOF | |
63 pick 055a42cdd887 d | |
64 pick 652413bf663e f | |
65 pick e860deea161a e | |
66 pick 177f92b77385 c | |
67 EOF | |
68 HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle | |
69 hg log --graph | |
70 | |
71 | |
72 echo % keep prevents stripping dead revs | |
73 cat > $EDITED <<EOF | |
74 pick bfe4a5a76b37 d | |
75 pick c4f52e213402 f | |
76 pick 99a62755c625 c | |
77 pick 7c6fdd608667 e | |
78 EOF | |
79 HGEDITOR="cat $EDITED > " hg histedit bfe4a5a76b37 --keep 2>&1 | fixbundle | |
80 hg log --graph | |
81 | |
82 echo '% try with --rev' | |
83 cat > $EDITED <<EOF | |
84 pick 7c6fdd608667 e | |
85 pick 99a62755c625 c | |
86 EOF | |
87 hg histedit --commands "$EDITED" --rev -2 2>&1 | fixbundle | |
88 hg log --graph | |
89 | |
90 echo % should also work if a commit message is missing | |
91 BUNDLE="$TESTDIR/missing-comment.hg" | |
92 hg init missing | |
93 cd missing | |
94 hg unbundle $BUNDLE | |
95 hg co tip | |
96 hg log --graph | |
97 hg histedit 0 |