Show More
@@ -1,220 +1,226 | |||
|
1 | 1 | #testcases obsstore-off obsstore-on |
|
2 | 2 | |
|
3 | 3 | $ cat << EOF >> $HGRCPATH |
|
4 | 4 | > [extensions] |
|
5 | 5 | > amend= |
|
6 | 6 | > debugdrawdag=$TESTDIR/drawdag.py |
|
7 | 7 | > [diff] |
|
8 | 8 | > git=1 |
|
9 | 9 | > EOF |
|
10 | 10 | |
|
11 | 11 | #if obsstore-on |
|
12 | 12 | $ cat << EOF >> $HGRCPATH |
|
13 | 13 | > [experimental] |
|
14 | 14 | > stabilization=createmarkers |
|
15 | 15 | > EOF |
|
16 | 16 | #endif |
|
17 | 17 | |
|
18 | 18 | Basic amend |
|
19 | 19 | |
|
20 | 20 | $ hg init repo1 |
|
21 | 21 | $ cd repo1 |
|
22 | 22 | $ hg debugdrawdag <<'EOS' |
|
23 | 23 | > B |
|
24 | 24 | > | |
|
25 | 25 | > A |
|
26 | 26 | > EOS |
|
27 | 27 | |
|
28 | 28 | $ hg update B -q |
|
29 | 29 | $ echo 2 >> B |
|
30 | 30 | |
|
31 | $ hg amend | |
|
32 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/112478962961-af2c0941-amend.hg (glob) (obsstore-off !) | |
|
31 | 33 | #if obsstore-off |
|
32 | $ hg amend | |
|
33 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/112478962961-af2c0941-amend.hg (glob) | |
|
34 | 34 | $ hg log -p -G --hidden -T '{rev} {node|short} {desc}\n' |
|
35 | 35 | @ 1 be169c7e8dbe B |
|
36 | 36 | | diff --git a/B b/B |
|
37 | 37 | | new file mode 100644 |
|
38 | 38 | | --- /dev/null |
|
39 | 39 | | +++ b/B |
|
40 | 40 | | @@ -0,0 +1,1 @@ |
|
41 | 41 | | +B2 |
|
42 | 42 | | |
|
43 | 43 | o 0 426bada5c675 A |
|
44 | 44 | diff --git a/A b/A |
|
45 | 45 | new file mode 100644 |
|
46 | 46 | --- /dev/null |
|
47 | 47 | +++ b/A |
|
48 | 48 | @@ -0,0 +1,1 @@ |
|
49 | 49 | +A |
|
50 | 50 | \ No newline at end of file |
|
51 | 51 | |
|
52 | 52 | #else |
|
53 | $ hg amend | |
|
54 | 53 | $ hg log -p -G --hidden -T '{rev} {node|short} {desc}\n' |
|
55 | 54 | @ 3 be169c7e8dbe B |
|
56 | 55 | | diff --git a/B b/B |
|
57 | 56 | | new file mode 100644 |
|
58 | 57 | | --- /dev/null |
|
59 | 58 | | +++ b/B |
|
60 | 59 | | @@ -0,0 +1,1 @@ |
|
61 | 60 | | +B2 |
|
62 | 61 | | |
|
63 | 62 | | x 2 edf08988b141 temporary amend commit for 112478962961 |
|
64 | 63 | | | diff --git a/B b/B |
|
65 | 64 | | | --- a/B |
|
66 | 65 | | | +++ b/B |
|
67 | 66 | | | @@ -1,1 +1,1 @@ |
|
68 | 67 | | | -B |
|
69 | 68 | | | \ No newline at end of file |
|
70 | 69 | | | +B2 |
|
71 | 70 | | | |
|
72 | 71 | | x 1 112478962961 B |
|
73 | 72 | |/ diff --git a/B b/B |
|
74 | 73 | | new file mode 100644 |
|
75 | 74 | | --- /dev/null |
|
76 | 75 | | +++ b/B |
|
77 | 76 | | @@ -0,0 +1,1 @@ |
|
78 | 77 | | +B |
|
79 | 78 | | \ No newline at end of file |
|
80 | 79 | | |
|
81 | 80 | o 0 426bada5c675 A |
|
82 | 81 | diff --git a/A b/A |
|
83 | 82 | new file mode 100644 |
|
84 | 83 | --- /dev/null |
|
85 | 84 | +++ b/A |
|
86 | 85 | @@ -0,0 +1,1 @@ |
|
87 | 86 | +A |
|
88 | 87 | \ No newline at end of file |
|
89 | 88 | |
|
90 | 89 | #endif |
|
91 | 90 | |
|
92 | 91 | Nothing changed |
|
93 | 92 | |
|
94 | 93 | $ hg amend |
|
95 | 94 | nothing changed |
|
96 | 95 | [1] |
|
97 | 96 | |
|
98 | 97 | Matcher and metadata options |
|
99 | 98 | |
|
100 | 99 | $ echo 3 > C |
|
101 | 100 | $ echo 4 > D |
|
102 | 101 | $ hg add C D |
|
103 |
$ hg amend -m NEWMESSAGE -I C |
|
|
102 | $ hg amend -m NEWMESSAGE -I C | |
|
103 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/be169c7e8dbe-c24d73fe-amend.hg (glob) (obsstore-off !) | |
|
104 | 104 | $ hg log -r . -T '{node|short} {desc} {files}\n' |
|
105 | 105 | c7ba14d9075b NEWMESSAGE B C |
|
106 | 106 | $ echo 5 > E |
|
107 | 107 | $ rm C |
|
108 |
$ hg amend -d '2000 1000' -u 'Foo <foo@example.com>' -A C D |
|
|
108 | $ hg amend -d '2000 1000' -u 'Foo <foo@example.com>' -A C D | |
|
109 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/c7ba14d9075b-b26ed45c-amend.hg (glob) (obsstore-off !) | |
|
109 | 110 | $ hg log -r . -T '{node|short} {desc} {files} {author} {date}\n' |
|
110 | 111 | 14f6c4bcc865 NEWMESSAGE B D Foo <foo@example.com> 2000.01000 |
|
111 | 112 | |
|
112 | 113 | Amend with editor |
|
113 | 114 | |
|
114 | 115 | $ cat > $TESTTMP/prefix.sh <<'EOF' |
|
115 | 116 | > printf 'EDITED: ' > $TESTTMP/msg |
|
116 | 117 | > cat "$1" >> $TESTTMP/msg |
|
117 | 118 | > mv $TESTTMP/msg "$1" |
|
118 | 119 | > EOF |
|
119 | 120 | $ chmod +x $TESTTMP/prefix.sh |
|
120 | 121 | |
|
121 |
$ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend --edit |
|
|
122 | $ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend --edit | |
|
123 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/14f6c4bcc865-6591f15d-amend.hg (glob) (obsstore-off !) | |
|
122 | 124 | $ hg log -r . -T '{node|short} {desc}\n' |
|
123 | 125 | 298f085230c3 EDITED: NEWMESSAGE |
|
124 |
$ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend -e -m MSG |
|
|
126 | $ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend -e -m MSG | |
|
127 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/298f085230c3-d81a6ad3-amend.hg (glob) (obsstore-off !) | |
|
125 | 128 | $ hg log -r . -T '{node|short} {desc}\n' |
|
126 | 129 | 974f07f28537 EDITED: MSG |
|
127 | 130 | |
|
128 | 131 | $ echo FOO > $TESTTMP/msg |
|
129 | 132 | $ hg amend -l $TESTTMP/msg -m BAR |
|
130 | 133 | abort: options --message and --logfile are mutually exclusive |
|
131 | 134 | [255] |
|
132 |
$ hg amend -l $TESTTMP/msg |
|
|
135 | $ hg amend -l $TESTTMP/msg | |
|
136 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/974f07f28537-edb6470a-amend.hg (glob) (obsstore-off !) | |
|
133 | 137 | $ hg log -r . -T '{node|short} {desc}\n' |
|
134 | 138 | 507be9bdac71 FOO |
|
135 | 139 | |
|
136 | 140 | Interactive mode |
|
137 | 141 | |
|
138 | 142 | $ touch F G |
|
139 | 143 | $ hg add F G |
|
140 |
$ cat <<EOS | hg amend -i --config ui.interactive=1 |
|
|
144 | $ cat <<EOS | hg amend -i --config ui.interactive=1 | |
|
141 | 145 | > y |
|
142 | 146 | > n |
|
143 | 147 | > EOS |
|
144 | 148 | diff --git a/F b/F |
|
145 | 149 | new file mode 100644 |
|
146 | 150 | examine changes to 'F'? [Ynesfdaq?] y |
|
147 | 151 | |
|
148 | 152 | diff --git a/G b/G |
|
149 | 153 | new file mode 100644 |
|
150 | 154 | examine changes to 'G'? [Ynesfdaq?] n |
|
151 | 155 | |
|
156 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/507be9bdac71-7ae43d04-amend.hg (glob) (obsstore-off !) | |
|
152 | 157 | $ hg log -r . -T '{files}\n' |
|
153 | 158 | B D F |
|
154 | 159 | |
|
155 | 160 | Amend in the middle of a stack |
|
156 | 161 | |
|
157 | 162 | $ hg init $TESTTMP/repo2 |
|
158 | 163 | $ cd $TESTTMP/repo2 |
|
159 | 164 | $ hg debugdrawdag <<'EOS' |
|
160 | 165 | > C |
|
161 | 166 | > | |
|
162 | 167 | > B |
|
163 | 168 | > | |
|
164 | 169 | > A |
|
165 | 170 | > EOS |
|
166 | 171 | |
|
167 | 172 | $ hg update -q B |
|
168 | 173 | $ echo 2 >> B |
|
169 | 174 | $ hg amend |
|
170 | 175 | abort: cannot amend changeset with children |
|
171 | 176 | [255] |
|
172 | 177 | |
|
173 | 178 | #if obsstore-on |
|
174 | 179 | |
|
175 | 180 | With allowunstable, amend could work in the middle of a stack |
|
176 | 181 | |
|
177 | 182 | $ cat >> $HGRCPATH <<EOF |
|
178 | 183 | > [experimental] |
|
179 | 184 | > stabilization=createmarkers, allowunstable |
|
180 | 185 | > EOF |
|
181 | 186 | |
|
182 | 187 | $ hg amend |
|
183 | 188 | $ hg log -T '{rev} {node|short} {desc}\n' -G |
|
184 | 189 | @ 4 be169c7e8dbe B |
|
185 | 190 | | |
|
186 | 191 | | o 2 26805aba1e60 C |
|
187 | 192 | | | |
|
188 | 193 | | x 1 112478962961 B |
|
189 | 194 | |/ |
|
190 | 195 | o 0 426bada5c675 A |
|
191 | 196 | |
|
192 | 197 | #endif |
|
193 | 198 | |
|
194 | 199 | Cannot amend public changeset |
|
195 | 200 | |
|
196 | 201 | $ hg phase -r A --public |
|
197 | 202 | $ hg update -C -q A |
|
198 |
$ hg amend -m AMEND |
|
|
203 | $ hg amend -m AMEND | |
|
199 | 204 | abort: cannot amend public changesets |
|
200 | 205 | [255] |
|
201 | 206 | |
|
202 | 207 | Amend a merge changeset |
|
203 | 208 | |
|
204 | 209 | $ hg init $TESTTMP/repo3 |
|
205 | 210 | $ cd $TESTTMP/repo3 |
|
206 | 211 | $ hg debugdrawdag <<'EOS' |
|
207 | 212 | > C |
|
208 | 213 | > /| |
|
209 | 214 | > A B |
|
210 | 215 | > EOS |
|
211 | 216 | $ hg update -q C |
|
212 |
$ hg amend -m FOO |
|
|
217 | $ hg amend -m FOO | |
|
218 | saved backup bundle to $TESTTMP/repo3/.hg/strip-backup/a35c07e8a2a4-15ff4612-amend.hg (glob) (obsstore-off !) | |
|
213 | 219 | $ rm .hg/localtags |
|
214 | 220 | $ hg log -G -T '{desc}\n' |
|
215 | 221 | @ FOO |
|
216 | 222 | |\ |
|
217 | 223 | | o B |
|
218 | 224 | | |
|
219 | 225 | o A |
|
220 | 226 |
General Comments 0
You need to be logged in to leave comments.
Login now