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