Show More
@@ -1,234 +1,234 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=True |
|
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 | $ hg amend |
|
32 | 32 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/112478962961-7e959a55-amend.hg (glob) (obsstore-off !) |
|
33 | 33 | #if obsstore-off |
|
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 log -p -G --hidden -T '{rev} {node|short} {desc}\n' |
|
54 | 54 | @ 2 be169c7e8dbe B |
|
55 | 55 | | diff --git a/B b/B |
|
56 | 56 | | new file mode 100644 |
|
57 | 57 | | --- /dev/null |
|
58 | 58 | | +++ b/B |
|
59 | 59 | | @@ -0,0 +1,1 @@ |
|
60 | 60 | | +B2 |
|
61 | 61 | | |
|
62 | 62 | | x 1 112478962961 B |
|
63 | 63 | |/ diff --git a/B b/B |
|
64 | 64 | | new file mode 100644 |
|
65 | 65 | | --- /dev/null |
|
66 | 66 | | +++ b/B |
|
67 | 67 | | @@ -0,0 +1,1 @@ |
|
68 | 68 | | +B |
|
69 | 69 | | \ No newline at end of file |
|
70 | 70 | | |
|
71 | 71 | o 0 426bada5c675 A |
|
72 | 72 | diff --git a/A b/A |
|
73 | 73 | new file mode 100644 |
|
74 | 74 | --- /dev/null |
|
75 | 75 | +++ b/A |
|
76 | 76 | @@ -0,0 +1,1 @@ |
|
77 | 77 | +A |
|
78 | 78 | \ No newline at end of file |
|
79 | 79 | |
|
80 | 80 | #endif |
|
81 | 81 | |
|
82 | 82 | Nothing changed |
|
83 | 83 | |
|
84 | 84 | $ hg amend |
|
85 | 85 | nothing changed |
|
86 | 86 | [1] |
|
87 | 87 | |
|
88 | 88 | $ hg amend -d "0 0" |
|
89 | 89 | nothing changed |
|
90 | 90 | [1] |
|
91 | 91 | |
|
92 | 92 | $ hg amend -d "Thu Jan 01 00:00:00 1970 UTC" |
|
93 | 93 | nothing changed |
|
94 | 94 | [1] |
|
95 | 95 | |
|
96 | 96 | Matcher and metadata options |
|
97 | 97 | |
|
98 | 98 | $ echo 3 > C |
|
99 | 99 | $ echo 4 > D |
|
100 | 100 | $ hg add C D |
|
101 | 101 | $ hg amend -m NEWMESSAGE -I C |
|
102 | 102 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/be169c7e8dbe-7684ddc5-amend.hg (glob) (obsstore-off !) |
|
103 | 103 | $ hg log -r . -T '{node|short} {desc} {files}\n' |
|
104 | 104 | c7ba14d9075b NEWMESSAGE B C |
|
105 | 105 | $ echo 5 > E |
|
106 | 106 | $ rm C |
|
107 | 107 | $ hg amend -d '2000 1000' -u 'Foo <foo@example.com>' -A C D |
|
108 | 108 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/c7ba14d9075b-b3e76daa-amend.hg (glob) (obsstore-off !) |
|
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 | 121 | $ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend --edit |
|
122 | 122 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/14f6c4bcc865-6591f15d-amend.hg (glob) (obsstore-off !) |
|
123 | 123 | $ hg log -r . -T '{node|short} {desc}\n' |
|
124 | 124 | 298f085230c3 EDITED: NEWMESSAGE |
|
125 | 125 | $ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend -e -m MSG |
|
126 | 126 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/298f085230c3-d81a6ad3-amend.hg (glob) (obsstore-off !) |
|
127 | 127 | $ hg log -r . -T '{node|short} {desc}\n' |
|
128 | 128 | 974f07f28537 EDITED: MSG |
|
129 | 129 | |
|
130 | 130 | $ echo FOO > $TESTTMP/msg |
|
131 | 131 | $ hg amend -l $TESTTMP/msg -m BAR |
|
132 | 132 | abort: options --message and --logfile are mutually exclusive |
|
133 | 133 | [255] |
|
134 | 134 | $ hg amend -l $TESTTMP/msg |
|
135 | 135 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/974f07f28537-edb6470a-amend.hg (glob) (obsstore-off !) |
|
136 | 136 | $ hg log -r . -T '{node|short} {desc}\n' |
|
137 | 137 | 507be9bdac71 FOO |
|
138 | 138 | |
|
139 | 139 | Interactive mode |
|
140 | 140 | |
|
141 | 141 | $ touch F G |
|
142 | 142 | $ hg add F G |
|
143 | 143 | $ cat <<EOS | hg amend -i --config ui.interactive=1 |
|
144 | 144 | > y |
|
145 | 145 | > n |
|
146 | 146 | > EOS |
|
147 | 147 | diff --git a/F b/F |
|
148 | 148 | new file mode 100644 |
|
149 | 149 | examine changes to 'F'? [Ynesfdaq?] y |
|
150 | 150 | |
|
151 | 151 | diff --git a/G b/G |
|
152 | 152 | new file mode 100644 |
|
153 | 153 | examine changes to 'G'? [Ynesfdaq?] n |
|
154 | 154 | |
|
155 | 155 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/507be9bdac71-c8077452-amend.hg (glob) (obsstore-off !) |
|
156 | 156 | $ hg log -r . -T '{files}\n' |
|
157 | 157 | B D F |
|
158 | 158 | |
|
159 | 159 | Amend in the middle of a stack |
|
160 | 160 | |
|
161 | 161 | $ hg init $TESTTMP/repo2 |
|
162 | 162 | $ cd $TESTTMP/repo2 |
|
163 | 163 | $ hg debugdrawdag <<'EOS' |
|
164 | 164 | > C |
|
165 | 165 | > | |
|
166 | 166 | > B |
|
167 | 167 | > | |
|
168 | 168 | > A |
|
169 | 169 | > EOS |
|
170 | 170 | |
|
171 | 171 | $ hg update -q B |
|
172 | 172 | $ echo 2 >> B |
|
173 | 173 | $ hg amend |
|
174 | 174 | abort: cannot amend changeset with children |
|
175 | 175 | [255] |
|
176 | 176 | |
|
177 | 177 | #if obsstore-on |
|
178 | 178 | |
|
179 | 179 | With allowunstable, amend could work in the middle of a stack |
|
180 | 180 | |
|
181 | 181 | $ cat >> $HGRCPATH <<EOF |
|
182 | 182 | > [experimental] |
|
183 | > evolution=allowunstable | |
|
184 | 183 | > evolution.createmarkers=True |
|
184 | > evolution.allowunstable=True | |
|
185 | 185 | > EOF |
|
186 | 186 | |
|
187 | 187 | $ hg amend |
|
188 | 188 | $ hg log -T '{rev} {node|short} {desc}\n' -G |
|
189 | 189 | @ 3 be169c7e8dbe B |
|
190 | 190 | | |
|
191 | 191 | | o 2 26805aba1e60 C |
|
192 | 192 | | | |
|
193 | 193 | | x 1 112478962961 B |
|
194 | 194 | |/ |
|
195 | 195 | o 0 426bada5c675 A |
|
196 | 196 | |
|
197 | 197 | Checking the note stored in the obsmarker |
|
198 | 198 | |
|
199 | 199 | $ echo foo > bar |
|
200 | 200 | $ hg add bar |
|
201 | 201 | $ hg amend --note "adding bar" |
|
202 | 202 | $ hg debugobsolete -r . |
|
203 | 203 | 112478962961147124edd43549aedd1a335e44bf be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'} |
|
204 | 204 | be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 16084da537dd8f84cfdb3055c633772269d62e1b 0 (Thu Jan 01 00:00:00 1970 +0000) {'note': 'adding bar', 'operation': 'amend', 'user': 'test'} |
|
205 | 205 | #endif |
|
206 | 206 | |
|
207 | 207 | Cannot amend public changeset |
|
208 | 208 | |
|
209 | 209 | $ hg phase -r A --public |
|
210 | 210 | $ hg update -C -q A |
|
211 | 211 | $ hg amend -m AMEND |
|
212 | 212 | abort: cannot amend public changesets |
|
213 | 213 | [255] |
|
214 | 214 | |
|
215 | 215 | Amend a merge changeset |
|
216 | 216 | |
|
217 | 217 | $ hg init $TESTTMP/repo3 |
|
218 | 218 | $ cd $TESTTMP/repo3 |
|
219 | 219 | $ hg debugdrawdag <<'EOS' |
|
220 | 220 | > C |
|
221 | 221 | > /| |
|
222 | 222 | > A B |
|
223 | 223 | > EOS |
|
224 | 224 | $ hg update -q C |
|
225 | 225 | $ hg amend -m FOO |
|
226 | 226 | saved backup bundle to $TESTTMP/repo3/.hg/strip-backup/a35c07e8a2a4-15ff4612-amend.hg (glob) (obsstore-off !) |
|
227 | 227 | $ rm .hg/localtags |
|
228 | 228 | $ hg log -G -T '{desc}\n' |
|
229 | 229 | @ FOO |
|
230 | 230 | |\ |
|
231 | 231 | | o B |
|
232 | 232 | | |
|
233 | 233 | o A |
|
234 | 234 |
@@ -1,1269 +1,1269 b'' | |||
|
1 | 1 | $ cat << EOF >> $HGRCPATH |
|
2 | 2 | > [format] |
|
3 | 3 | > usegeneraldelta=yes |
|
4 | 4 | > EOF |
|
5 | 5 | |
|
6 | 6 | $ hg init |
|
7 | 7 | |
|
8 | 8 | Setup: |
|
9 | 9 | |
|
10 | 10 | $ echo a >> a |
|
11 | 11 | $ hg ci -Am 'base' |
|
12 | 12 | adding a |
|
13 | 13 | |
|
14 | 14 | Refuse to amend public csets: |
|
15 | 15 | |
|
16 | 16 | $ hg phase -r . -p |
|
17 | 17 | $ hg ci --amend |
|
18 | 18 | abort: cannot amend public changesets |
|
19 | 19 | [255] |
|
20 | 20 | $ hg phase -r . -f -d |
|
21 | 21 | |
|
22 | 22 | $ echo a >> a |
|
23 | 23 | $ hg ci -Am 'base1' |
|
24 | 24 | |
|
25 | 25 | Nothing to amend: |
|
26 | 26 | |
|
27 | 27 | $ hg ci --amend -m 'base1' |
|
28 | 28 | nothing changed |
|
29 | 29 | [1] |
|
30 | 30 | |
|
31 | 31 | $ cat >> $HGRCPATH <<EOF |
|
32 | 32 | > [hooks] |
|
33 | 33 | > pretxncommit.foo = sh -c "echo \\"pretxncommit \$HG_NODE\\"; hg id -r \$HG_NODE" |
|
34 | 34 | > EOF |
|
35 | 35 | |
|
36 | 36 | Amending changeset with changes in working dir: |
|
37 | 37 | (and check that --message does not trigger an editor) |
|
38 | 38 | |
|
39 | 39 | $ echo a >> a |
|
40 | 40 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -m 'amend base1' |
|
41 | 41 | pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149 |
|
42 | 42 | 43f1ba15f28a tip |
|
43 | 43 | saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-5ab4f721-amend.hg (glob) |
|
44 | 44 | $ echo 'pretxncommit.foo = ' >> $HGRCPATH |
|
45 | 45 | $ hg diff -c . |
|
46 | 46 | diff -r ad120869acf0 -r 43f1ba15f28a a |
|
47 | 47 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
48 | 48 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
49 | 49 | @@ -1,1 +1,3 @@ |
|
50 | 50 | a |
|
51 | 51 | +a |
|
52 | 52 | +a |
|
53 | 53 | $ hg log |
|
54 | 54 | changeset: 1:43f1ba15f28a |
|
55 | 55 | tag: tip |
|
56 | 56 | user: test |
|
57 | 57 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
58 | 58 | summary: amend base1 |
|
59 | 59 | |
|
60 | 60 | changeset: 0:ad120869acf0 |
|
61 | 61 | user: test |
|
62 | 62 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
63 | 63 | summary: base |
|
64 | 64 | |
|
65 | 65 | |
|
66 | 66 | Check proper abort for empty message |
|
67 | 67 | |
|
68 | 68 | $ cat > editor.sh << '__EOF__' |
|
69 | 69 | > #!/bin/sh |
|
70 | 70 | > echo "" > "$1" |
|
71 | 71 | > __EOF__ |
|
72 | 72 | |
|
73 | 73 | Update the existing file to ensure that the dirstate is not in pending state |
|
74 | 74 | (where the status of some files in the working copy is not known yet). This in |
|
75 | 75 | turn ensures that when the transaction is aborted due to an empty message during |
|
76 | 76 | the amend, there should be no rollback. |
|
77 | 77 | $ echo a >> a |
|
78 | 78 | |
|
79 | 79 | $ echo b > b |
|
80 | 80 | $ hg add b |
|
81 | 81 | $ hg summary |
|
82 | 82 | parent: 1:43f1ba15f28a tip |
|
83 | 83 | amend base1 |
|
84 | 84 | branch: default |
|
85 | 85 | commit: 1 modified, 1 added, 1 unknown |
|
86 | 86 | update: (current) |
|
87 | 87 | phases: 2 draft |
|
88 | 88 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend |
|
89 | 89 | abort: empty commit message |
|
90 | 90 | [255] |
|
91 | 91 | $ hg summary |
|
92 | 92 | parent: 1:43f1ba15f28a tip |
|
93 | 93 | amend base1 |
|
94 | 94 | branch: default |
|
95 | 95 | commit: 1 modified, 1 added, 1 unknown |
|
96 | 96 | update: (current) |
|
97 | 97 | phases: 2 draft |
|
98 | 98 | |
|
99 | 99 | Add new file along with modified existing file: |
|
100 | 100 | $ hg ci --amend -m 'amend base1 new file' |
|
101 | 101 | saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-007467c2-amend.hg (glob) |
|
102 | 102 | |
|
103 | 103 | Remove file that was added in amended commit: |
|
104 | 104 | (and test logfile option) |
|
105 | 105 | (and test that logfile option do not trigger an editor) |
|
106 | 106 | |
|
107 | 107 | $ hg rm b |
|
108 | 108 | $ echo 'amend base1 remove new file' > ../logfile |
|
109 | 109 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile |
|
110 | 110 | saved backup bundle to $TESTTMP/.hg/strip-backup/c16295aaf401-1ada9901-amend.hg (glob) |
|
111 | 111 | |
|
112 | 112 | $ hg cat b |
|
113 | 113 | b: no such file in rev 47343646fa3d |
|
114 | 114 | [1] |
|
115 | 115 | |
|
116 | 116 | No changes, just a different message: |
|
117 | 117 | |
|
118 | 118 | $ hg ci -v --amend -m 'no changes, new message' |
|
119 | 119 | amending changeset 47343646fa3d |
|
120 | 120 | copying changeset 47343646fa3d to ad120869acf0 |
|
121 | 121 | committing files: |
|
122 | 122 | a |
|
123 | 123 | committing manifest |
|
124 | 124 | committing changelog |
|
125 | 125 | 1 changesets found |
|
126 | 126 | uncompressed size of bundle content: |
|
127 | 127 | 254 (changelog) |
|
128 | 128 | 163 (manifests) |
|
129 | 129 | 131 a |
|
130 | 130 | saved backup bundle to $TESTTMP/.hg/strip-backup/47343646fa3d-c2758885-amend.hg (glob) |
|
131 | 131 | 1 changesets found |
|
132 | 132 | uncompressed size of bundle content: |
|
133 | 133 | 250 (changelog) |
|
134 | 134 | 163 (manifests) |
|
135 | 135 | 131 a |
|
136 | 136 | adding branch |
|
137 | 137 | adding changesets |
|
138 | 138 | adding manifests |
|
139 | 139 | adding file changes |
|
140 | 140 | added 1 changesets with 1 changes to 1 files |
|
141 | 141 | committed changeset 1:401431e913a1 |
|
142 | 142 | $ hg diff -c . |
|
143 | 143 | diff -r ad120869acf0 -r 401431e913a1 a |
|
144 | 144 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
145 | 145 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
146 | 146 | @@ -1,1 +1,4 @@ |
|
147 | 147 | a |
|
148 | 148 | +a |
|
149 | 149 | +a |
|
150 | 150 | +a |
|
151 | 151 | $ hg log |
|
152 | 152 | changeset: 1:401431e913a1 |
|
153 | 153 | tag: tip |
|
154 | 154 | user: test |
|
155 | 155 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
156 | 156 | summary: no changes, new message |
|
157 | 157 | |
|
158 | 158 | changeset: 0:ad120869acf0 |
|
159 | 159 | user: test |
|
160 | 160 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
161 | 161 | summary: base |
|
162 | 162 | |
|
163 | 163 | |
|
164 | 164 | Disable default date on commit so when -d isn't given, the old date is preserved: |
|
165 | 165 | |
|
166 | 166 | $ echo '[defaults]' >> $HGRCPATH |
|
167 | 167 | $ echo 'commit=' >> $HGRCPATH |
|
168 | 168 | |
|
169 | 169 | Test -u/-d: |
|
170 | 170 | |
|
171 | 171 | $ cat > .hg/checkeditform.sh <<EOF |
|
172 | 172 | > env | grep HGEDITFORM |
|
173 | 173 | > true |
|
174 | 174 | > EOF |
|
175 | 175 | $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -u foo -d '1 0' |
|
176 | 176 | HGEDITFORM=commit.amend.normal |
|
177 | 177 | saved backup bundle to $TESTTMP/.hg/strip-backup/401431e913a1-5e8e532c-amend.hg (glob) |
|
178 | 178 | $ echo a >> a |
|
179 | 179 | $ hg ci --amend -u foo -d '1 0' |
|
180 | 180 | saved backup bundle to $TESTTMP/.hg/strip-backup/d96b1d28ae33-677e0afb-amend.hg (glob) |
|
181 | 181 | $ hg log -r . |
|
182 | 182 | changeset: 1:a9a13940fc03 |
|
183 | 183 | tag: tip |
|
184 | 184 | user: foo |
|
185 | 185 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
186 | 186 | summary: no changes, new message |
|
187 | 187 | |
|
188 | 188 | |
|
189 | 189 | Open editor with old commit message if a message isn't given otherwise: |
|
190 | 190 | |
|
191 | 191 | $ cat > editor.sh << '__EOF__' |
|
192 | 192 | > #!/bin/sh |
|
193 | 193 | > cat $1 |
|
194 | 194 | > echo "another precious commit message" > "$1" |
|
195 | 195 | > __EOF__ |
|
196 | 196 | |
|
197 | 197 | at first, test saving last-message.txt |
|
198 | 198 | |
|
199 | 199 | $ cat > .hg/hgrc << '__EOF__' |
|
200 | 200 | > [hooks] |
|
201 | 201 | > pretxncommit.test-saving-last-message = false |
|
202 | 202 | > __EOF__ |
|
203 | 203 | |
|
204 | 204 | $ rm -f .hg/last-message.txt |
|
205 | 205 | $ hg commit --amend -v -m "message given from command line" |
|
206 | 206 | amending changeset a9a13940fc03 |
|
207 | 207 | copying changeset a9a13940fc03 to ad120869acf0 |
|
208 | 208 | committing files: |
|
209 | 209 | a |
|
210 | 210 | committing manifest |
|
211 | 211 | committing changelog |
|
212 | 212 | running hook pretxncommit.test-saving-last-message: false |
|
213 | 213 | transaction abort! |
|
214 | 214 | rollback completed |
|
215 | 215 | abort: pretxncommit.test-saving-last-message hook exited with status 1 |
|
216 | 216 | [255] |
|
217 | 217 | $ cat .hg/last-message.txt |
|
218 | 218 | message given from command line (no-eol) |
|
219 | 219 | |
|
220 | 220 | $ rm -f .hg/last-message.txt |
|
221 | 221 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v |
|
222 | 222 | amending changeset a9a13940fc03 |
|
223 | 223 | copying changeset a9a13940fc03 to ad120869acf0 |
|
224 | 224 | no changes, new message |
|
225 | 225 | |
|
226 | 226 | |
|
227 | 227 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
228 | 228 | HG: Leave message empty to abort commit. |
|
229 | 229 | HG: -- |
|
230 | 230 | HG: user: foo |
|
231 | 231 | HG: branch 'default' |
|
232 | 232 | HG: changed a |
|
233 | 233 | committing files: |
|
234 | 234 | a |
|
235 | 235 | committing manifest |
|
236 | 236 | committing changelog |
|
237 | 237 | running hook pretxncommit.test-saving-last-message: false |
|
238 | 238 | transaction abort! |
|
239 | 239 | rollback completed |
|
240 | 240 | abort: pretxncommit.test-saving-last-message hook exited with status 1 |
|
241 | 241 | [255] |
|
242 | 242 | |
|
243 | 243 | $ cat .hg/last-message.txt |
|
244 | 244 | another precious commit message |
|
245 | 245 | |
|
246 | 246 | $ cat > .hg/hgrc << '__EOF__' |
|
247 | 247 | > [hooks] |
|
248 | 248 | > pretxncommit.test-saving-last-message = |
|
249 | 249 | > __EOF__ |
|
250 | 250 | |
|
251 | 251 | then, test editing custom commit message |
|
252 | 252 | |
|
253 | 253 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v |
|
254 | 254 | amending changeset a9a13940fc03 |
|
255 | 255 | copying changeset a9a13940fc03 to ad120869acf0 |
|
256 | 256 | no changes, new message |
|
257 | 257 | |
|
258 | 258 | |
|
259 | 259 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
260 | 260 | HG: Leave message empty to abort commit. |
|
261 | 261 | HG: -- |
|
262 | 262 | HG: user: foo |
|
263 | 263 | HG: branch 'default' |
|
264 | 264 | HG: changed a |
|
265 | 265 | committing files: |
|
266 | 266 | a |
|
267 | 267 | committing manifest |
|
268 | 268 | committing changelog |
|
269 | 269 | 1 changesets found |
|
270 | 270 | uncompressed size of bundle content: |
|
271 | 271 | 249 (changelog) |
|
272 | 272 | 163 (manifests) |
|
273 | 273 | 133 a |
|
274 | 274 | saved backup bundle to $TESTTMP/.hg/strip-backup/a9a13940fc03-7c2e8674-amend.hg (glob) |
|
275 | 275 | 1 changesets found |
|
276 | 276 | uncompressed size of bundle content: |
|
277 | 277 | 257 (changelog) |
|
278 | 278 | 163 (manifests) |
|
279 | 279 | 133 a |
|
280 | 280 | adding branch |
|
281 | 281 | adding changesets |
|
282 | 282 | adding manifests |
|
283 | 283 | adding file changes |
|
284 | 284 | added 1 changesets with 1 changes to 1 files |
|
285 | 285 | committed changeset 1:64a124ba1b44 |
|
286 | 286 | |
|
287 | 287 | Same, but with changes in working dir (different code path): |
|
288 | 288 | |
|
289 | 289 | $ echo a >> a |
|
290 | 290 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v |
|
291 | 291 | amending changeset 64a124ba1b44 |
|
292 | 292 | another precious commit message |
|
293 | 293 | |
|
294 | 294 | |
|
295 | 295 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
296 | 296 | HG: Leave message empty to abort commit. |
|
297 | 297 | HG: -- |
|
298 | 298 | HG: user: foo |
|
299 | 299 | HG: branch 'default' |
|
300 | 300 | HG: changed a |
|
301 | 301 | committing files: |
|
302 | 302 | a |
|
303 | 303 | committing manifest |
|
304 | 304 | committing changelog |
|
305 | 305 | 1 changesets found |
|
306 | 306 | uncompressed size of bundle content: |
|
307 | 307 | 257 (changelog) |
|
308 | 308 | 163 (manifests) |
|
309 | 309 | 133 a |
|
310 | 310 | saved backup bundle to $TESTTMP/.hg/strip-backup/64a124ba1b44-10374b8f-amend.hg (glob) |
|
311 | 311 | 1 changesets found |
|
312 | 312 | uncompressed size of bundle content: |
|
313 | 313 | 257 (changelog) |
|
314 | 314 | 163 (manifests) |
|
315 | 315 | 135 a |
|
316 | 316 | adding branch |
|
317 | 317 | adding changesets |
|
318 | 318 | adding manifests |
|
319 | 319 | adding file changes |
|
320 | 320 | added 1 changesets with 1 changes to 1 files |
|
321 | 321 | committed changeset 1:7892795b8e38 |
|
322 | 322 | |
|
323 | 323 | $ rm editor.sh |
|
324 | 324 | $ hg log -r . |
|
325 | 325 | changeset: 1:7892795b8e38 |
|
326 | 326 | tag: tip |
|
327 | 327 | user: foo |
|
328 | 328 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
329 | 329 | summary: another precious commit message |
|
330 | 330 | |
|
331 | 331 | |
|
332 | 332 | Moving bookmarks, preserve active bookmark: |
|
333 | 333 | |
|
334 | 334 | $ hg book book1 |
|
335 | 335 | $ hg book book2 |
|
336 | 336 | $ hg ci --amend -m 'move bookmarks' |
|
337 | 337 | saved backup bundle to $TESTTMP/.hg/strip-backup/7892795b8e38-3fb46217-amend.hg (glob) |
|
338 | 338 | $ hg book |
|
339 | 339 | book1 1:8311f17e2616 |
|
340 | 340 | * book2 1:8311f17e2616 |
|
341 | 341 | $ echo a >> a |
|
342 | 342 | $ hg ci --amend -m 'move bookmarks' |
|
343 | 343 | saved backup bundle to $TESTTMP/.hg/strip-backup/8311f17e2616-f0504fe3-amend.hg (glob) |
|
344 | 344 | $ hg book |
|
345 | 345 | book1 1:a3b65065808c |
|
346 | 346 | * book2 1:a3b65065808c |
|
347 | 347 | |
|
348 | 348 | abort does not loose bookmarks |
|
349 | 349 | |
|
350 | 350 | $ cat > editor.sh << '__EOF__' |
|
351 | 351 | > #!/bin/sh |
|
352 | 352 | > echo "" > "$1" |
|
353 | 353 | > __EOF__ |
|
354 | 354 | $ echo a >> a |
|
355 | 355 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend |
|
356 | 356 | abort: empty commit message |
|
357 | 357 | [255] |
|
358 | 358 | $ hg book |
|
359 | 359 | book1 1:a3b65065808c |
|
360 | 360 | * book2 1:a3b65065808c |
|
361 | 361 | $ hg revert -Caq |
|
362 | 362 | $ rm editor.sh |
|
363 | 363 | |
|
364 | 364 | $ echo '[defaults]' >> $HGRCPATH |
|
365 | 365 | $ echo "commit=-d '0 0'" >> $HGRCPATH |
|
366 | 366 | |
|
367 | 367 | Moving branches: |
|
368 | 368 | |
|
369 | 369 | $ hg branch foo |
|
370 | 370 | marked working directory as branch foo |
|
371 | 371 | (branches are permanent and global, did you want a bookmark?) |
|
372 | 372 | $ echo a >> a |
|
373 | 373 | $ hg ci -m 'branch foo' |
|
374 | 374 | $ hg branch default -f |
|
375 | 375 | marked working directory as branch default |
|
376 | 376 | $ hg ci --amend -m 'back to default' |
|
377 | 377 | saved backup bundle to $TESTTMP/.hg/strip-backup/f8339a38efe1-c18453c9-amend.hg (glob) |
|
378 | 378 | $ hg branches |
|
379 | 379 | default 2:9c07515f2650 |
|
380 | 380 | |
|
381 | 381 | Close branch: |
|
382 | 382 | |
|
383 | 383 | $ hg up -q 0 |
|
384 | 384 | $ echo b >> b |
|
385 | 385 | $ hg branch foo |
|
386 | 386 | marked working directory as branch foo |
|
387 | 387 | (branches are permanent and global, did you want a bookmark?) |
|
388 | 388 | $ hg ci -Am 'fork' |
|
389 | 389 | adding b |
|
390 | 390 | $ echo b >> b |
|
391 | 391 | $ hg ci -mb |
|
392 | 392 | $ hg ci --amend --close-branch -m 'closing branch foo' |
|
393 | 393 | saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-54245dc7-amend.hg (glob) |
|
394 | 394 | |
|
395 | 395 | Same thing, different code path: |
|
396 | 396 | |
|
397 | 397 | $ echo b >> b |
|
398 | 398 | $ hg ci -m 'reopen branch' |
|
399 | 399 | reopening closed branch head 4 |
|
400 | 400 | $ echo b >> b |
|
401 | 401 | $ hg ci --amend --close-branch |
|
402 | 402 | saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-b900d9fa-amend.hg (glob) |
|
403 | 403 | $ hg branches |
|
404 | 404 | default 2:9c07515f2650 |
|
405 | 405 | |
|
406 | 406 | Refuse to amend during a merge: |
|
407 | 407 | |
|
408 | 408 | $ hg up -q default |
|
409 | 409 | $ hg merge foo |
|
410 | 410 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
411 | 411 | (branch merge, don't forget to commit) |
|
412 | 412 | $ hg ci --amend |
|
413 | 413 | abort: cannot amend while merging |
|
414 | 414 | [255] |
|
415 | 415 | $ hg ci -m 'merge' |
|
416 | 416 | |
|
417 | 417 | Follow copies/renames: |
|
418 | 418 | |
|
419 | 419 | $ hg mv b c |
|
420 | 420 | $ hg ci -m 'b -> c' |
|
421 | 421 | $ hg mv c d |
|
422 | 422 | $ hg ci --amend -m 'b -> d' |
|
423 | 423 | saved backup bundle to $TESTTMP/.hg/strip-backup/42f3f27a067d-f23cc9f7-amend.hg (glob) |
|
424 | 424 | $ hg st --rev '.^' --copies d |
|
425 | 425 | A d |
|
426 | 426 | b |
|
427 | 427 | $ hg cp d e |
|
428 | 428 | $ hg ci -m 'e = d' |
|
429 | 429 | $ hg cp e f |
|
430 | 430 | $ hg ci --amend -m 'f = d' |
|
431 | 431 | saved backup bundle to $TESTTMP/.hg/strip-backup/9198f73182d5-251d584a-amend.hg (glob) |
|
432 | 432 | $ hg st --rev '.^' --copies f |
|
433 | 433 | A f |
|
434 | 434 | d |
|
435 | 435 | |
|
436 | 436 | $ mv f f.orig |
|
437 | 437 | $ hg rm -A f |
|
438 | 438 | $ hg ci -m removef |
|
439 | 439 | $ hg cp a f |
|
440 | 440 | $ mv f.orig f |
|
441 | 441 | $ hg ci --amend -m replacef |
|
442 | 442 | saved backup bundle to $TESTTMP/.hg/strip-backup/f0993ab6b482-eda301bf-amend.hg (glob) |
|
443 | 443 | $ hg st --change . --copies |
|
444 | 444 | $ hg log -r . --template "{file_copies}\n" |
|
445 | 445 | |
|
446 | 446 | |
|
447 | 447 | Move added file (issue3410): |
|
448 | 448 | |
|
449 | 449 | $ echo g >> g |
|
450 | 450 | $ hg ci -Am g |
|
451 | 451 | adding g |
|
452 | 452 | $ hg mv g h |
|
453 | 453 | $ hg ci --amend |
|
454 | 454 | saved backup bundle to $TESTTMP/.hg/strip-backup/58585e3f095c-0f5ebcda-amend.hg (glob) |
|
455 | 455 | $ hg st --change . --copies h |
|
456 | 456 | A h |
|
457 | 457 | $ hg log -r . --template "{file_copies}\n" |
|
458 | 458 | |
|
459 | 459 | |
|
460 | 460 | Can't rollback an amend: |
|
461 | 461 | |
|
462 | 462 | $ hg rollback |
|
463 | 463 | no rollback information available |
|
464 | 464 | [1] |
|
465 | 465 | |
|
466 | 466 | Preserve extra dict (issue3430): |
|
467 | 467 | |
|
468 | 468 | $ hg branch a |
|
469 | 469 | marked working directory as branch a |
|
470 | 470 | (branches are permanent and global, did you want a bookmark?) |
|
471 | 471 | $ echo a >> a |
|
472 | 472 | $ hg ci -ma |
|
473 | 473 | $ hg ci --amend -m "a'" |
|
474 | 474 | saved backup bundle to $TESTTMP/.hg/strip-backup/39a162f1d65e-9dfe13d8-amend.hg (glob) |
|
475 | 475 | $ hg log -r . --template "{branch}\n" |
|
476 | 476 | a |
|
477 | 477 | $ hg ci --amend -m "a''" |
|
478 | 478 | saved backup bundle to $TESTTMP/.hg/strip-backup/d5ca7b1ac72b-0b4c1a34-amend.hg (glob) |
|
479 | 479 | $ hg log -r . --template "{branch}\n" |
|
480 | 480 | a |
|
481 | 481 | |
|
482 | 482 | Also preserve other entries in the dict that are in the old commit, |
|
483 | 483 | first graft something so there's an additional entry: |
|
484 | 484 | |
|
485 | 485 | $ hg up 0 -q |
|
486 | 486 | $ echo z > z |
|
487 | 487 | $ hg ci -Am 'fork' |
|
488 | 488 | adding z |
|
489 | 489 | created new head |
|
490 | 490 | $ hg up 11 |
|
491 | 491 | 5 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
492 | 492 | $ hg graft 12 |
|
493 | 493 | grafting 12:2647734878ef "fork" (tip) |
|
494 | 494 | $ hg ci --amend -m 'graft amend' |
|
495 | 495 | saved backup bundle to $TESTTMP/.hg/strip-backup/fe8c6f7957ca-25638666-amend.hg (glob) |
|
496 | 496 | $ hg log -r . --debug | grep extra |
|
497 | 497 | extra: amend_source=fe8c6f7957ca1665ed77496ed7a07657d469ac60 |
|
498 | 498 | extra: branch=a |
|
499 | 499 | extra: source=2647734878ef0236dda712fae9c1651cf694ea8a |
|
500 | 500 | |
|
501 | 501 | Preserve phase |
|
502 | 502 | |
|
503 | 503 | $ hg phase '.^::.' |
|
504 | 504 | 11: draft |
|
505 | 505 | 13: draft |
|
506 | 506 | $ hg phase --secret --force . |
|
507 | 507 | $ hg phase '.^::.' |
|
508 | 508 | 11: draft |
|
509 | 509 | 13: secret |
|
510 | 510 | $ hg commit --amend -m 'amend for phase' -q |
|
511 | 511 | $ hg phase '.^::.' |
|
512 | 512 | 11: draft |
|
513 | 513 | 13: secret |
|
514 | 514 | |
|
515 | 515 | Test amend with obsolete |
|
516 | 516 | --------------------------- |
|
517 | 517 | |
|
518 | 518 | Enable obsolete |
|
519 | 519 | |
|
520 | 520 | $ cat >> $HGRCPATH << EOF |
|
521 | 521 | > [experimental] |
|
522 | > evolution=allowunstable | |
|
523 | 522 | > evolution.createmarkers=True |
|
523 | > evolution.allowunstable=True | |
|
524 | 524 | > EOF |
|
525 | 525 | |
|
526 | 526 | Amend with no files changes |
|
527 | 527 | |
|
528 | 528 | $ hg id -n |
|
529 | 529 | 13 |
|
530 | 530 | $ hg ci --amend -m 'babar' |
|
531 | 531 | $ hg id -n |
|
532 | 532 | 14 |
|
533 | 533 | $ hg log -Gl 3 --style=compact |
|
534 | 534 | @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test |
|
535 | 535 | | babar |
|
536 | 536 | | |
|
537 | 537 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test |
|
538 | 538 | | | fork |
|
539 | 539 | | ~ |
|
540 | 540 | o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test |
|
541 | 541 | | a'' |
|
542 | 542 | ~ |
|
543 | 543 | $ hg log -Gl 4 --hidden --style=compact |
|
544 | 544 | @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test |
|
545 | 545 | | babar |
|
546 | 546 | | |
|
547 | 547 | | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test |
|
548 | 548 | |/ amend for phase |
|
549 | 549 | | |
|
550 | 550 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test |
|
551 | 551 | | | fork |
|
552 | 552 | | ~ |
|
553 | 553 | o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test |
|
554 | 554 | | a'' |
|
555 | 555 | ~ |
|
556 | 556 | |
|
557 | 557 | Amend with files changes |
|
558 | 558 | |
|
559 | 559 | (note: the extra commit over 15 is a temporary junk I would be happy to get |
|
560 | 560 | ride of) |
|
561 | 561 | |
|
562 | 562 | $ echo 'babar' >> a |
|
563 | 563 | $ hg commit --amend |
|
564 | 564 | $ hg log -Gl 6 --hidden --style=compact |
|
565 | 565 | @ 15[tip]:11 a5b42b49b0d5 1970-01-01 00:00 +0000 test |
|
566 | 566 | | babar |
|
567 | 567 | | |
|
568 | 568 | | x 14:11 682950e85999 1970-01-01 00:00 +0000 test |
|
569 | 569 | |/ babar |
|
570 | 570 | | |
|
571 | 571 | | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test |
|
572 | 572 | |/ amend for phase |
|
573 | 573 | | |
|
574 | 574 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test |
|
575 | 575 | | | fork |
|
576 | 576 | | ~ |
|
577 | 577 | o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test |
|
578 | 578 | | a'' |
|
579 | 579 | | |
|
580 | 580 | o 10 5fa75032e226 1970-01-01 00:00 +0000 test |
|
581 | 581 | | g |
|
582 | 582 | ~ |
|
583 | 583 | |
|
584 | 584 | |
|
585 | 585 | Test that amend does not make it easy to create obsolescence cycle |
|
586 | 586 | --------------------------------------------------------------------- |
|
587 | 587 | |
|
588 | 588 | $ hg id -r 14 --hidden |
|
589 | 589 | 682950e85999 (a) |
|
590 | 590 | $ hg revert -ar 14 --hidden |
|
591 | 591 | reverting a |
|
592 | 592 | $ hg commit --amend |
|
593 | 593 | $ hg id |
|
594 | 594 | 37973c7e0b61 (a) tip |
|
595 | 595 | |
|
596 | 596 | Test that rewriting leaving instability behind is allowed |
|
597 | 597 | --------------------------------------------------------------------- |
|
598 | 598 | |
|
599 | 599 | $ hg up '.^' |
|
600 | 600 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
601 | 601 | $ echo 'b' >> a |
|
602 | 602 | $ hg log --style compact -r 'children(.)' |
|
603 | 603 | 16[tip]:11 37973c7e0b61 1970-01-01 00:00 +0000 test |
|
604 | 604 | babar |
|
605 | 605 | |
|
606 | 606 | $ hg commit --amend |
|
607 | 607 | $ hg log -r 'orphan()' |
|
608 | 608 | changeset: 16:37973c7e0b61 |
|
609 | 609 | branch: a |
|
610 | 610 | parent: 11:0ddb275cfad1 |
|
611 | 611 | user: test |
|
612 | 612 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
613 | 613 | instability: orphan |
|
614 | 614 | summary: babar |
|
615 | 615 | |
|
616 | 616 | |
|
617 | 617 | Amend a merge changeset (with renames and conflicts from the second parent): |
|
618 | 618 | |
|
619 | 619 | $ hg up -q default |
|
620 | 620 | $ hg branch -q bar |
|
621 | 621 | $ hg cp a aa |
|
622 | 622 | $ hg mv z zz |
|
623 | 623 | $ echo cc > cc |
|
624 | 624 | $ hg add cc |
|
625 | 625 | $ hg ci -m aazzcc |
|
626 | 626 | $ hg up -q default |
|
627 | 627 | $ echo a >> a |
|
628 | 628 | $ echo dd > cc |
|
629 | 629 | $ hg add cc |
|
630 | 630 | $ hg ci -m aa |
|
631 | 631 | $ hg merge -q bar |
|
632 | 632 | warning: conflicts while merging cc! (edit, then use 'hg resolve --mark') |
|
633 | 633 | [1] |
|
634 | 634 | $ hg resolve -m cc |
|
635 | 635 | (no more unresolved files) |
|
636 | 636 | $ hg ci -m 'merge bar' |
|
637 | 637 | $ hg log --config diff.git=1 -pr . |
|
638 | 638 | changeset: 20:163cfd7219f7 |
|
639 | 639 | tag: tip |
|
640 | 640 | parent: 19:30d96aeaf27b |
|
641 | 641 | parent: 18:1aa437659d19 |
|
642 | 642 | user: test |
|
643 | 643 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
644 | 644 | summary: merge bar |
|
645 | 645 | |
|
646 | 646 | diff --git a/a b/aa |
|
647 | 647 | copy from a |
|
648 | 648 | copy to aa |
|
649 | 649 | diff --git a/cc b/cc |
|
650 | 650 | --- a/cc |
|
651 | 651 | +++ b/cc |
|
652 | 652 | @@ -1,1 +1,5 @@ |
|
653 | 653 | +<<<<<<< working copy: 30d96aeaf27b - test: aa |
|
654 | 654 | dd |
|
655 | 655 | +======= |
|
656 | 656 | +cc |
|
657 | 657 | +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc |
|
658 | 658 | diff --git a/z b/zz |
|
659 | 659 | rename from z |
|
660 | 660 | rename to zz |
|
661 | 661 | |
|
662 | 662 | $ hg debugrename aa |
|
663 | 663 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e |
|
664 | 664 | $ hg debugrename zz |
|
665 | 665 | zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a |
|
666 | 666 | $ hg debugrename cc |
|
667 | 667 | cc not renamed |
|
668 | 668 | $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit |
|
669 | 669 | HGEDITFORM=commit.amend.merge |
|
670 | 670 | $ hg log --config diff.git=1 -pr . |
|
671 | 671 | changeset: 21:bca52d4ed186 |
|
672 | 672 | tag: tip |
|
673 | 673 | parent: 19:30d96aeaf27b |
|
674 | 674 | parent: 18:1aa437659d19 |
|
675 | 675 | user: test |
|
676 | 676 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
677 | 677 | summary: merge bar (amend message) |
|
678 | 678 | |
|
679 | 679 | diff --git a/a b/aa |
|
680 | 680 | copy from a |
|
681 | 681 | copy to aa |
|
682 | 682 | diff --git a/cc b/cc |
|
683 | 683 | --- a/cc |
|
684 | 684 | +++ b/cc |
|
685 | 685 | @@ -1,1 +1,5 @@ |
|
686 | 686 | +<<<<<<< working copy: 30d96aeaf27b - test: aa |
|
687 | 687 | dd |
|
688 | 688 | +======= |
|
689 | 689 | +cc |
|
690 | 690 | +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc |
|
691 | 691 | diff --git a/z b/zz |
|
692 | 692 | rename from z |
|
693 | 693 | rename to zz |
|
694 | 694 | |
|
695 | 695 | $ hg debugrename aa |
|
696 | 696 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e |
|
697 | 697 | $ hg debugrename zz |
|
698 | 698 | zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a |
|
699 | 699 | $ hg debugrename cc |
|
700 | 700 | cc not renamed |
|
701 | 701 | $ hg mv zz z |
|
702 | 702 | $ hg ci --amend -m 'merge bar (undo rename)' |
|
703 | 703 | $ hg log --config diff.git=1 -pr . |
|
704 | 704 | changeset: 22:12594a98ca3f |
|
705 | 705 | tag: tip |
|
706 | 706 | parent: 19:30d96aeaf27b |
|
707 | 707 | parent: 18:1aa437659d19 |
|
708 | 708 | user: test |
|
709 | 709 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
710 | 710 | summary: merge bar (undo rename) |
|
711 | 711 | |
|
712 | 712 | diff --git a/a b/aa |
|
713 | 713 | copy from a |
|
714 | 714 | copy to aa |
|
715 | 715 | diff --git a/cc b/cc |
|
716 | 716 | --- a/cc |
|
717 | 717 | +++ b/cc |
|
718 | 718 | @@ -1,1 +1,5 @@ |
|
719 | 719 | +<<<<<<< working copy: 30d96aeaf27b - test: aa |
|
720 | 720 | dd |
|
721 | 721 | +======= |
|
722 | 722 | +cc |
|
723 | 723 | +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc |
|
724 | 724 | |
|
725 | 725 | $ hg debugrename z |
|
726 | 726 | z not renamed |
|
727 | 727 | |
|
728 | 728 | Amend a merge changeset (with renames during the merge): |
|
729 | 729 | |
|
730 | 730 | $ hg up -q bar |
|
731 | 731 | $ echo x > x |
|
732 | 732 | $ hg add x |
|
733 | 733 | $ hg ci -m x |
|
734 | 734 | $ hg up -q default |
|
735 | 735 | $ hg merge -q bar |
|
736 | 736 | $ hg mv aa aaa |
|
737 | 737 | $ echo aa >> aaa |
|
738 | 738 | $ hg ci -m 'merge bar again' |
|
739 | 739 | $ hg log --config diff.git=1 -pr . |
|
740 | 740 | changeset: 24:dffde028b388 |
|
741 | 741 | tag: tip |
|
742 | 742 | parent: 22:12594a98ca3f |
|
743 | 743 | parent: 23:4c94d5bc65f5 |
|
744 | 744 | user: test |
|
745 | 745 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
746 | 746 | summary: merge bar again |
|
747 | 747 | |
|
748 | 748 | diff --git a/aa b/aa |
|
749 | 749 | deleted file mode 100644 |
|
750 | 750 | --- a/aa |
|
751 | 751 | +++ /dev/null |
|
752 | 752 | @@ -1,2 +0,0 @@ |
|
753 | 753 | -a |
|
754 | 754 | -a |
|
755 | 755 | diff --git a/aaa b/aaa |
|
756 | 756 | new file mode 100644 |
|
757 | 757 | --- /dev/null |
|
758 | 758 | +++ b/aaa |
|
759 | 759 | @@ -0,0 +1,3 @@ |
|
760 | 760 | +a |
|
761 | 761 | +a |
|
762 | 762 | +aa |
|
763 | 763 | diff --git a/x b/x |
|
764 | 764 | new file mode 100644 |
|
765 | 765 | --- /dev/null |
|
766 | 766 | +++ b/x |
|
767 | 767 | @@ -0,0 +1,1 @@ |
|
768 | 768 | +x |
|
769 | 769 | |
|
770 | 770 | $ hg debugrename aaa |
|
771 | 771 | aaa renamed from aa:37d9b5d994eab34eda9c16b195ace52c7b129980 |
|
772 | 772 | $ hg mv aaa aa |
|
773 | 773 | $ hg ci --amend -m 'merge bar again (undo rename)' |
|
774 | 774 | $ hg log --config diff.git=1 -pr . |
|
775 | 775 | changeset: 25:18e3ba160489 |
|
776 | 776 | tag: tip |
|
777 | 777 | parent: 22:12594a98ca3f |
|
778 | 778 | parent: 23:4c94d5bc65f5 |
|
779 | 779 | user: test |
|
780 | 780 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
781 | 781 | summary: merge bar again (undo rename) |
|
782 | 782 | |
|
783 | 783 | diff --git a/aa b/aa |
|
784 | 784 | --- a/aa |
|
785 | 785 | +++ b/aa |
|
786 | 786 | @@ -1,2 +1,3 @@ |
|
787 | 787 | a |
|
788 | 788 | a |
|
789 | 789 | +aa |
|
790 | 790 | diff --git a/x b/x |
|
791 | 791 | new file mode 100644 |
|
792 | 792 | --- /dev/null |
|
793 | 793 | +++ b/x |
|
794 | 794 | @@ -0,0 +1,1 @@ |
|
795 | 795 | +x |
|
796 | 796 | |
|
797 | 797 | $ hg debugrename aa |
|
798 | 798 | aa not renamed |
|
799 | 799 | $ hg debugrename -r '.^' aa |
|
800 | 800 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e |
|
801 | 801 | |
|
802 | 802 | Amend a merge changeset (with manifest-level conflicts): |
|
803 | 803 | |
|
804 | 804 | $ hg up -q bar |
|
805 | 805 | $ hg rm aa |
|
806 | 806 | $ hg ci -m 'rm aa' |
|
807 | 807 | $ hg up -q default |
|
808 | 808 | $ echo aa >> aa |
|
809 | 809 | $ hg ci -m aa |
|
810 | 810 | $ hg merge -q bar --config ui.interactive=True << EOF |
|
811 | 811 | > c |
|
812 | 812 | > EOF |
|
813 | 813 | local [working copy] changed aa which other [merge rev] deleted |
|
814 | 814 | use (c)hanged version, (d)elete, or leave (u)nresolved? c |
|
815 | 815 | $ hg ci -m 'merge bar (with conflicts)' |
|
816 | 816 | $ hg log --config diff.git=1 -pr . |
|
817 | 817 | changeset: 28:b4c3035e2544 |
|
818 | 818 | tag: tip |
|
819 | 819 | parent: 27:4b216ca5ba97 |
|
820 | 820 | parent: 26:67db8847a540 |
|
821 | 821 | user: test |
|
822 | 822 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
823 | 823 | summary: merge bar (with conflicts) |
|
824 | 824 | |
|
825 | 825 | |
|
826 | 826 | $ hg rm aa |
|
827 | 827 | $ hg ci --amend -m 'merge bar (with conflicts, amended)' |
|
828 | 828 | $ hg log --config diff.git=1 -pr . |
|
829 | 829 | changeset: 29:1205ed810051 |
|
830 | 830 | tag: tip |
|
831 | 831 | parent: 27:4b216ca5ba97 |
|
832 | 832 | parent: 26:67db8847a540 |
|
833 | 833 | user: test |
|
834 | 834 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
835 | 835 | summary: merge bar (with conflicts, amended) |
|
836 | 836 | |
|
837 | 837 | diff --git a/aa b/aa |
|
838 | 838 | deleted file mode 100644 |
|
839 | 839 | --- a/aa |
|
840 | 840 | +++ /dev/null |
|
841 | 841 | @@ -1,4 +0,0 @@ |
|
842 | 842 | -a |
|
843 | 843 | -a |
|
844 | 844 | -aa |
|
845 | 845 | -aa |
|
846 | 846 | |
|
847 | 847 | Issue 3445: amending with --close-branch a commit that created a new head should fail |
|
848 | 848 | This shouldn't be possible: |
|
849 | 849 | |
|
850 | 850 | $ hg up -q default |
|
851 | 851 | $ hg branch closewithamend |
|
852 | 852 | marked working directory as branch closewithamend |
|
853 | 853 | $ echo foo > foo |
|
854 | 854 | $ hg add foo |
|
855 | 855 | $ hg ci -m.. |
|
856 | 856 | $ hg ci --amend --close-branch -m 'closing' |
|
857 | 857 | abort: can only close branch heads |
|
858 | 858 | [255] |
|
859 | 859 | |
|
860 | 860 | This silliness fails: |
|
861 | 861 | |
|
862 | 862 | $ hg branch silliness |
|
863 | 863 | marked working directory as branch silliness |
|
864 | 864 | $ echo b >> b |
|
865 | 865 | $ hg ci --close-branch -m'open and close' |
|
866 | 866 | abort: can only close branch heads |
|
867 | 867 | [255] |
|
868 | 868 | |
|
869 | 869 | Test that amend with --secret creates new secret changeset forcibly |
|
870 | 870 | --------------------------------------------------------------------- |
|
871 | 871 | |
|
872 | 872 | $ hg phase '.^::.' |
|
873 | 873 | 29: draft |
|
874 | 874 | 30: draft |
|
875 | 875 | $ hg commit --amend --secret -m 'amend as secret' -q |
|
876 | 876 | $ hg phase '.^::.' |
|
877 | 877 | 29: draft |
|
878 | 878 | 31: secret |
|
879 | 879 | |
|
880 | 880 | Test that amend with --edit invokes editor forcibly |
|
881 | 881 | --------------------------------------------------- |
|
882 | 882 | |
|
883 | 883 | $ hg parents --template "{desc}\n" |
|
884 | 884 | amend as secret |
|
885 | 885 | $ HGEDITOR=cat hg commit --amend -m "editor should be suppressed" |
|
886 | 886 | $ hg parents --template "{desc}\n" |
|
887 | 887 | editor should be suppressed |
|
888 | 888 | |
|
889 | 889 | $ hg status --rev '.^1::.' |
|
890 | 890 | A foo |
|
891 | 891 | $ HGEDITOR=cat hg commit --amend -m "editor should be invoked" --edit |
|
892 | 892 | editor should be invoked |
|
893 | 893 | |
|
894 | 894 | |
|
895 | 895 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
896 | 896 | HG: Leave message empty to abort commit. |
|
897 | 897 | HG: -- |
|
898 | 898 | HG: user: test |
|
899 | 899 | HG: branch 'silliness' |
|
900 | 900 | HG: added foo |
|
901 | 901 | $ hg parents --template "{desc}\n" |
|
902 | 902 | editor should be invoked |
|
903 | 903 | |
|
904 | 904 | Test that "diff()" in committemplate works correctly for amending |
|
905 | 905 | ----------------------------------------------------------------- |
|
906 | 906 | |
|
907 | 907 | $ cat >> .hg/hgrc <<EOF |
|
908 | 908 | > [committemplate] |
|
909 | 909 | > changeset.commit.amend = {desc}\n |
|
910 | 910 | > HG: M: {file_mods} |
|
911 | 911 | > HG: A: {file_adds} |
|
912 | 912 | > HG: R: {file_dels} |
|
913 | 913 | > {splitlines(diff()) % 'HG: {line}\n'} |
|
914 | 914 | > EOF |
|
915 | 915 | |
|
916 | 916 | $ hg parents --template "M: {file_mods}\nA: {file_adds}\nR: {file_dels}\n" |
|
917 | 917 | M: |
|
918 | 918 | A: foo |
|
919 | 919 | R: |
|
920 | 920 | $ hg status -amr |
|
921 | 921 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo" |
|
922 | 922 | expecting diff of foo |
|
923 | 923 | |
|
924 | 924 | HG: M: |
|
925 | 925 | HG: A: foo |
|
926 | 926 | HG: R: |
|
927 | 927 | HG: diff -r 1205ed810051 foo |
|
928 | 928 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
929 | 929 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
930 | 930 | HG: @@ -0,0 +1,1 @@ |
|
931 | 931 | HG: +foo |
|
932 | 932 | |
|
933 | 933 | $ echo y > y |
|
934 | 934 | $ hg add y |
|
935 | 935 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo and y" |
|
936 | 936 | expecting diff of foo and y |
|
937 | 937 | |
|
938 | 938 | HG: M: |
|
939 | 939 | HG: A: foo y |
|
940 | 940 | HG: R: |
|
941 | 941 | HG: diff -r 1205ed810051 foo |
|
942 | 942 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
943 | 943 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
944 | 944 | HG: @@ -0,0 +1,1 @@ |
|
945 | 945 | HG: +foo |
|
946 | 946 | HG: diff -r 1205ed810051 y |
|
947 | 947 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
948 | 948 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 |
|
949 | 949 | HG: @@ -0,0 +1,1 @@ |
|
950 | 950 | HG: +y |
|
951 | 951 | |
|
952 | 952 | $ hg rm a |
|
953 | 953 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo and y" |
|
954 | 954 | expecting diff of a, foo and y |
|
955 | 955 | |
|
956 | 956 | HG: M: |
|
957 | 957 | HG: A: foo y |
|
958 | 958 | HG: R: a |
|
959 | 959 | HG: diff -r 1205ed810051 a |
|
960 | 960 | HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
961 | 961 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
962 | 962 | HG: @@ -1,2 +0,0 @@ |
|
963 | 963 | HG: -a |
|
964 | 964 | HG: -a |
|
965 | 965 | HG: diff -r 1205ed810051 foo |
|
966 | 966 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
967 | 967 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
968 | 968 | HG: @@ -0,0 +1,1 @@ |
|
969 | 969 | HG: +foo |
|
970 | 970 | HG: diff -r 1205ed810051 y |
|
971 | 971 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
972 | 972 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 |
|
973 | 973 | HG: @@ -0,0 +1,1 @@ |
|
974 | 974 | HG: +y |
|
975 | 975 | |
|
976 | 976 | $ hg rm x |
|
977 | 977 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo, x and y" |
|
978 | 978 | expecting diff of a, foo, x and y |
|
979 | 979 | |
|
980 | 980 | HG: M: |
|
981 | 981 | HG: A: foo y |
|
982 | 982 | HG: R: a x |
|
983 | 983 | HG: diff -r 1205ed810051 a |
|
984 | 984 | HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
985 | 985 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
986 | 986 | HG: @@ -1,2 +0,0 @@ |
|
987 | 987 | HG: -a |
|
988 | 988 | HG: -a |
|
989 | 989 | HG: diff -r 1205ed810051 foo |
|
990 | 990 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
991 | 991 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
992 | 992 | HG: @@ -0,0 +1,1 @@ |
|
993 | 993 | HG: +foo |
|
994 | 994 | HG: diff -r 1205ed810051 x |
|
995 | 995 | HG: --- a/x Thu Jan 01 00:00:00 1970 +0000 |
|
996 | 996 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
997 | 997 | HG: @@ -1,1 +0,0 @@ |
|
998 | 998 | HG: -x |
|
999 | 999 | HG: diff -r 1205ed810051 y |
|
1000 | 1000 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1001 | 1001 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 |
|
1002 | 1002 | HG: @@ -0,0 +1,1 @@ |
|
1003 | 1003 | HG: +y |
|
1004 | 1004 | |
|
1005 | 1005 | $ echo cccc >> cc |
|
1006 | 1006 | $ hg status -amr |
|
1007 | 1007 | M cc |
|
1008 | 1008 | $ HGEDITOR=cat hg commit --amend -e -m "cc should be excluded" -X cc |
|
1009 | 1009 | cc should be excluded |
|
1010 | 1010 | |
|
1011 | 1011 | HG: M: |
|
1012 | 1012 | HG: A: foo y |
|
1013 | 1013 | HG: R: a x |
|
1014 | 1014 | HG: diff -r 1205ed810051 a |
|
1015 | 1015 | HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
1016 | 1016 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1017 | 1017 | HG: @@ -1,2 +0,0 @@ |
|
1018 | 1018 | HG: -a |
|
1019 | 1019 | HG: -a |
|
1020 | 1020 | HG: diff -r 1205ed810051 foo |
|
1021 | 1021 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1022 | 1022 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
1023 | 1023 | HG: @@ -0,0 +1,1 @@ |
|
1024 | 1024 | HG: +foo |
|
1025 | 1025 | HG: diff -r 1205ed810051 x |
|
1026 | 1026 | HG: --- a/x Thu Jan 01 00:00:00 1970 +0000 |
|
1027 | 1027 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1028 | 1028 | HG: @@ -1,1 +0,0 @@ |
|
1029 | 1029 | HG: -x |
|
1030 | 1030 | HG: diff -r 1205ed810051 y |
|
1031 | 1031 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1032 | 1032 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 |
|
1033 | 1033 | HG: @@ -0,0 +1,1 @@ |
|
1034 | 1034 | HG: +y |
|
1035 | 1035 | |
|
1036 | 1036 | Check for issue4405 |
|
1037 | 1037 | ------------------- |
|
1038 | 1038 | |
|
1039 | 1039 | Setup the repo with a file that gets moved in a second commit. |
|
1040 | 1040 | $ hg init repo |
|
1041 | 1041 | $ cd repo |
|
1042 | 1042 | $ touch a0 |
|
1043 | 1043 | $ hg add a0 |
|
1044 | 1044 | $ hg commit -m a0 |
|
1045 | 1045 | $ hg mv a0 a1 |
|
1046 | 1046 | $ hg commit -m a1 |
|
1047 | 1047 | $ hg up -q 0 |
|
1048 | 1048 | $ hg log -G --template '{rev} {desc}' |
|
1049 | 1049 | o 1 a1 |
|
1050 | 1050 | | |
|
1051 | 1051 | @ 0 a0 |
|
1052 | 1052 | |
|
1053 | 1053 | |
|
1054 | 1054 | Now we branch the repro, but re-use the file contents, so we have a divergence |
|
1055 | 1055 | in the file revlog topology and the changelog topology. |
|
1056 | 1056 | $ hg revert --rev 1 --all |
|
1057 | 1057 | removing a0 |
|
1058 | 1058 | adding a1 |
|
1059 | 1059 | $ hg ci -qm 'a1-amend' |
|
1060 | 1060 | $ hg log -G --template '{rev} {desc}' |
|
1061 | 1061 | @ 2 a1-amend |
|
1062 | 1062 | | |
|
1063 | 1063 | | o 1 a1 |
|
1064 | 1064 | |/ |
|
1065 | 1065 | o 0 a0 |
|
1066 | 1066 | |
|
1067 | 1067 | |
|
1068 | 1068 | The way mercurial does amends is by folding the working copy and old commit |
|
1069 | 1069 | together into another commit (rev 3). During this process, _findlimit is called |
|
1070 | 1070 | to check how far back to look for the transitive closure of file copy |
|
1071 | 1071 | information, but due to the divergence of the filelog and changelog graph |
|
1072 | 1072 | topologies, before _findlimit was fixed, it returned a rev which was not far |
|
1073 | 1073 | enough back in this case. |
|
1074 | 1074 | $ hg mv a1 a2 |
|
1075 | 1075 | $ hg status --copies --rev 0 |
|
1076 | 1076 | A a2 |
|
1077 | 1077 | a0 |
|
1078 | 1078 | R a0 |
|
1079 | 1079 | $ hg ci --amend -q |
|
1080 | 1080 | $ hg log -G --template '{rev} {desc}' |
|
1081 | 1081 | @ 3 a1-amend |
|
1082 | 1082 | | |
|
1083 | 1083 | | o 1 a1 |
|
1084 | 1084 | |/ |
|
1085 | 1085 | o 0 a0 |
|
1086 | 1086 | |
|
1087 | 1087 | |
|
1088 | 1088 | Before the fix, the copy information was lost. |
|
1089 | 1089 | $ hg status --copies --rev 0 |
|
1090 | 1090 | A a2 |
|
1091 | 1091 | a0 |
|
1092 | 1092 | R a0 |
|
1093 | 1093 | $ cd .. |
|
1094 | 1094 | |
|
1095 | 1095 | Check that amend properly preserve rename from directory rename (issue-4516) |
|
1096 | 1096 | |
|
1097 | 1097 | If a parent of the merge renames a full directory, any files added to the old |
|
1098 | 1098 | directory in the other parent will be renamed to the new directory. For some |
|
1099 | 1099 | reason, the rename metadata was when amending such merge. This test ensure we |
|
1100 | 1100 | do not regress. We have a dedicated repo because it needs a setup with renamed |
|
1101 | 1101 | directory) |
|
1102 | 1102 | |
|
1103 | 1103 | $ hg init issue4516 |
|
1104 | 1104 | $ cd issue4516 |
|
1105 | 1105 | $ mkdir olddirname |
|
1106 | 1106 | $ echo line1 > olddirname/commonfile.py |
|
1107 | 1107 | $ hg add olddirname/commonfile.py |
|
1108 | 1108 | $ hg ci -m first |
|
1109 | 1109 | |
|
1110 | 1110 | $ hg branch newdirname |
|
1111 | 1111 | marked working directory as branch newdirname |
|
1112 | 1112 | (branches are permanent and global, did you want a bookmark?) |
|
1113 | 1113 | $ hg mv olddirname newdirname |
|
1114 | 1114 | moving olddirname/commonfile.py to newdirname/commonfile.py (glob) |
|
1115 | 1115 | $ hg ci -m rename |
|
1116 | 1116 | |
|
1117 | 1117 | $ hg update default |
|
1118 | 1118 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1119 | 1119 | $ echo line1 > olddirname/newfile.py |
|
1120 | 1120 | $ hg add olddirname/newfile.py |
|
1121 | 1121 | $ hg ci -m log |
|
1122 | 1122 | |
|
1123 | 1123 | $ hg up newdirname |
|
1124 | 1124 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
1125 | 1125 | $ # create newdirname/newfile.py |
|
1126 | 1126 | $ hg merge default |
|
1127 | 1127 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1128 | 1128 | (branch merge, don't forget to commit) |
|
1129 | 1129 | $ hg ci -m add |
|
1130 | 1130 | $ |
|
1131 | 1131 | $ hg debugrename newdirname/newfile.py |
|
1132 | 1132 | newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def (glob) |
|
1133 | 1133 | $ hg status -C --change . |
|
1134 | 1134 | A newdirname/newfile.py |
|
1135 | 1135 | $ hg status -C --rev 1 |
|
1136 | 1136 | A newdirname/newfile.py |
|
1137 | 1137 | $ hg status -C --rev 2 |
|
1138 | 1138 | A newdirname/commonfile.py |
|
1139 | 1139 | olddirname/commonfile.py |
|
1140 | 1140 | A newdirname/newfile.py |
|
1141 | 1141 | olddirname/newfile.py |
|
1142 | 1142 | R olddirname/commonfile.py |
|
1143 | 1143 | R olddirname/newfile.py |
|
1144 | 1144 | $ hg debugindex newdirname/newfile.py |
|
1145 | 1145 | rev offset length delta linkrev nodeid p1 p2 |
|
1146 | 1146 | 0 0 89 -1 3 34a4d536c0c0 000000000000 000000000000 |
|
1147 | 1147 | |
|
1148 | 1148 | $ echo a >> newdirname/commonfile.py |
|
1149 | 1149 | $ hg ci --amend -m bug |
|
1150 | 1150 | $ hg debugrename newdirname/newfile.py |
|
1151 | 1151 | newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def (glob) |
|
1152 | 1152 | $ hg debugindex newdirname/newfile.py |
|
1153 | 1153 | rev offset length delta linkrev nodeid p1 p2 |
|
1154 | 1154 | 0 0 89 -1 3 34a4d536c0c0 000000000000 000000000000 |
|
1155 | 1155 | |
|
1156 | 1156 | #if execbit |
|
1157 | 1157 | |
|
1158 | 1158 | Test if amend preserves executable bit changes |
|
1159 | 1159 | $ chmod +x newdirname/commonfile.py |
|
1160 | 1160 | $ hg ci -m chmod |
|
1161 | 1161 | $ hg ci --amend -m "chmod amended" |
|
1162 | 1162 | $ hg ci --amend -m "chmod amended second time" |
|
1163 | 1163 | $ hg log -p --git -r . |
|
1164 | 1164 | changeset: 7:b1326f52dddf |
|
1165 | 1165 | branch: newdirname |
|
1166 | 1166 | tag: tip |
|
1167 | 1167 | parent: 4:7fd235f7cb2f |
|
1168 | 1168 | user: test |
|
1169 | 1169 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1170 | 1170 | summary: chmod amended second time |
|
1171 | 1171 | |
|
1172 | 1172 | diff --git a/newdirname/commonfile.py b/newdirname/commonfile.py |
|
1173 | 1173 | old mode 100644 |
|
1174 | 1174 | new mode 100755 |
|
1175 | 1175 | |
|
1176 | 1176 | #endif |
|
1177 | 1177 | |
|
1178 | 1178 | Test amend with file inclusion options |
|
1179 | 1179 | -------------------------------------- |
|
1180 | 1180 | |
|
1181 | 1181 | These tests ensure that we are always amending some files that were part of the |
|
1182 | 1182 | pre-amend commit. We want to test that the remaining files in the pre-amend |
|
1183 | 1183 | commit were not changed in the amended commit. We do so by performing a diff of |
|
1184 | 1184 | the amended commit against its parent commit. |
|
1185 | 1185 | $ cd .. |
|
1186 | 1186 | $ hg init testfileinclusions |
|
1187 | 1187 | $ cd testfileinclusions |
|
1188 | 1188 | $ echo a > a |
|
1189 | 1189 | $ echo b > b |
|
1190 | 1190 | $ hg commit -Aqm "Adding a and b" |
|
1191 | 1191 | |
|
1192 | 1192 | Only add changes to a particular file |
|
1193 | 1193 | $ echo a >> a |
|
1194 | 1194 | $ echo b >> b |
|
1195 | 1195 | $ hg commit --amend -I a |
|
1196 | 1196 | $ hg diff --git -r null -r . |
|
1197 | 1197 | diff --git a/a b/a |
|
1198 | 1198 | new file mode 100644 |
|
1199 | 1199 | --- /dev/null |
|
1200 | 1200 | +++ b/a |
|
1201 | 1201 | @@ -0,0 +1,2 @@ |
|
1202 | 1202 | +a |
|
1203 | 1203 | +a |
|
1204 | 1204 | diff --git a/b b/b |
|
1205 | 1205 | new file mode 100644 |
|
1206 | 1206 | --- /dev/null |
|
1207 | 1207 | +++ b/b |
|
1208 | 1208 | @@ -0,0 +1,1 @@ |
|
1209 | 1209 | +b |
|
1210 | 1210 | |
|
1211 | 1211 | $ echo a >> a |
|
1212 | 1212 | $ hg commit --amend b |
|
1213 | 1213 | $ hg diff --git -r null -r . |
|
1214 | 1214 | diff --git a/a b/a |
|
1215 | 1215 | new file mode 100644 |
|
1216 | 1216 | --- /dev/null |
|
1217 | 1217 | +++ b/a |
|
1218 | 1218 | @@ -0,0 +1,2 @@ |
|
1219 | 1219 | +a |
|
1220 | 1220 | +a |
|
1221 | 1221 | diff --git a/b b/b |
|
1222 | 1222 | new file mode 100644 |
|
1223 | 1223 | --- /dev/null |
|
1224 | 1224 | +++ b/b |
|
1225 | 1225 | @@ -0,0 +1,2 @@ |
|
1226 | 1226 | +b |
|
1227 | 1227 | +b |
|
1228 | 1228 | |
|
1229 | 1229 | Exclude changes to a particular file |
|
1230 | 1230 | $ echo b >> b |
|
1231 | 1231 | $ hg commit --amend -X a |
|
1232 | 1232 | $ hg diff --git -r null -r . |
|
1233 | 1233 | diff --git a/a b/a |
|
1234 | 1234 | new file mode 100644 |
|
1235 | 1235 | --- /dev/null |
|
1236 | 1236 | +++ b/a |
|
1237 | 1237 | @@ -0,0 +1,2 @@ |
|
1238 | 1238 | +a |
|
1239 | 1239 | +a |
|
1240 | 1240 | diff --git a/b b/b |
|
1241 | 1241 | new file mode 100644 |
|
1242 | 1242 | --- /dev/null |
|
1243 | 1243 | +++ b/b |
|
1244 | 1244 | @@ -0,0 +1,3 @@ |
|
1245 | 1245 | +b |
|
1246 | 1246 | +b |
|
1247 | 1247 | +b |
|
1248 | 1248 | |
|
1249 | 1249 | Check the addremove flag |
|
1250 | 1250 | $ echo c > c |
|
1251 | 1251 | $ rm a |
|
1252 | 1252 | $ hg commit --amend -A |
|
1253 | 1253 | removing a |
|
1254 | 1254 | adding c |
|
1255 | 1255 | $ hg diff --git -r null -r . |
|
1256 | 1256 | diff --git a/b b/b |
|
1257 | 1257 | new file mode 100644 |
|
1258 | 1258 | --- /dev/null |
|
1259 | 1259 | +++ b/b |
|
1260 | 1260 | @@ -0,0 +1,3 @@ |
|
1261 | 1261 | +b |
|
1262 | 1262 | +b |
|
1263 | 1263 | +b |
|
1264 | 1264 | diff --git a/c b/c |
|
1265 | 1265 | new file mode 100644 |
|
1266 | 1266 | --- /dev/null |
|
1267 | 1267 | +++ b/c |
|
1268 | 1268 | @@ -0,0 +1,1 @@ |
|
1269 | 1269 | +c |
@@ -1,553 +1,553 b'' | |||
|
1 | 1 | Test argument handling and various data parsing |
|
2 | 2 | ================================================== |
|
3 | 3 | |
|
4 | 4 | |
|
5 | 5 | Enable extensions used by this test. |
|
6 | 6 | $ cat >>$HGRCPATH <<EOF |
|
7 | 7 | > [extensions] |
|
8 | 8 | > histedit= |
|
9 | 9 | > EOF |
|
10 | 10 | |
|
11 | 11 | Repo setup. |
|
12 | 12 | $ hg init foo |
|
13 | 13 | $ cd foo |
|
14 | 14 | $ echo alpha >> alpha |
|
15 | 15 | $ hg addr |
|
16 | 16 | adding alpha |
|
17 | 17 | $ hg ci -m one |
|
18 | 18 | $ echo alpha >> alpha |
|
19 | 19 | $ hg ci -m two |
|
20 | 20 | $ echo alpha >> alpha |
|
21 | 21 | $ hg ci -m three |
|
22 | 22 | $ echo alpha >> alpha |
|
23 | 23 | $ hg ci -m four |
|
24 | 24 | $ echo alpha >> alpha |
|
25 | 25 | $ hg ci -m five |
|
26 | 26 | |
|
27 | 27 | $ hg log --style compact --graph |
|
28 | 28 | @ 4[tip] 08d98a8350f3 1970-01-01 00:00 +0000 test |
|
29 | 29 | | five |
|
30 | 30 | | |
|
31 | 31 | o 3 c8e68270e35a 1970-01-01 00:00 +0000 test |
|
32 | 32 | | four |
|
33 | 33 | | |
|
34 | 34 | o 2 eb57da33312f 1970-01-01 00:00 +0000 test |
|
35 | 35 | | three |
|
36 | 36 | | |
|
37 | 37 | o 1 579e40513370 1970-01-01 00:00 +0000 test |
|
38 | 38 | | two |
|
39 | 39 | | |
|
40 | 40 | o 0 6058cbb6cfd7 1970-01-01 00:00 +0000 test |
|
41 | 41 | one |
|
42 | 42 | |
|
43 | 43 | |
|
44 | 44 | histedit --continue/--abort with no existing state |
|
45 | 45 | -------------------------------------------------- |
|
46 | 46 | |
|
47 | 47 | $ hg histedit --continue |
|
48 | 48 | abort: no histedit in progress |
|
49 | 49 | [255] |
|
50 | 50 | $ hg histedit --abort |
|
51 | 51 | abort: no histedit in progress |
|
52 | 52 | [255] |
|
53 | 53 | |
|
54 | 54 | Run a dummy edit to make sure we get tip^^ correctly via revsingle. |
|
55 | 55 | -------------------------------------------------------------------- |
|
56 | 56 | |
|
57 | 57 | $ HGEDITOR=cat hg histedit "tip^^" |
|
58 | 58 | pick eb57da33312f 2 three |
|
59 | 59 | pick c8e68270e35a 3 four |
|
60 | 60 | pick 08d98a8350f3 4 five |
|
61 | 61 | |
|
62 | 62 | # Edit history between eb57da33312f and 08d98a8350f3 |
|
63 | 63 | # |
|
64 | 64 | # Commits are listed from least to most recent |
|
65 | 65 | # |
|
66 | 66 | # You can reorder changesets by reordering the lines |
|
67 | 67 | # |
|
68 | 68 | # Commands: |
|
69 | 69 | # |
|
70 | 70 | # e, edit = use commit, but stop for amending |
|
71 | 71 | # m, mess = edit commit message without changing commit content |
|
72 | 72 | # p, pick = use commit |
|
73 | 73 | # b, base = checkout changeset and apply further changesets from there |
|
74 | 74 | # d, drop = remove commit from history |
|
75 | 75 | # f, fold = use commit, but combine it with the one above |
|
76 | 76 | # r, roll = like fold, but discard this commit's description and date |
|
77 | 77 | # |
|
78 | 78 | |
|
79 | 79 | Run on a revision not ancestors of the current working directory. |
|
80 | 80 | -------------------------------------------------------------------- |
|
81 | 81 | |
|
82 | 82 | $ hg up 2 |
|
83 | 83 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
84 | 84 | $ hg histedit -r 4 |
|
85 | 85 | abort: 08d98a8350f3 is not an ancestor of working directory |
|
86 | 86 | [255] |
|
87 | 87 | $ hg up --quiet |
|
88 | 88 | |
|
89 | 89 | |
|
90 | 90 | Test that we pick the minimum of a revrange |
|
91 | 91 | --------------------------------------- |
|
92 | 92 | |
|
93 | 93 | $ HGEDITOR=cat hg histedit '2::' --commands - << EOF |
|
94 | 94 | > pick eb57da33312f 2 three |
|
95 | 95 | > pick c8e68270e35a 3 four |
|
96 | 96 | > pick 08d98a8350f3 4 five |
|
97 | 97 | > EOF |
|
98 | 98 | $ hg up --quiet |
|
99 | 99 | |
|
100 | 100 | $ HGEDITOR=cat hg histedit 'tip:2' --commands - << EOF |
|
101 | 101 | > pick eb57da33312f 2 three |
|
102 | 102 | > pick c8e68270e35a 3 four |
|
103 | 103 | > pick 08d98a8350f3 4 five |
|
104 | 104 | > EOF |
|
105 | 105 | $ hg up --quiet |
|
106 | 106 | |
|
107 | 107 | Test config specified default |
|
108 | 108 | ----------------------------- |
|
109 | 109 | |
|
110 | 110 | $ HGEDITOR=cat hg histedit --config "histedit.defaultrev=only(.) - ::eb57da33312f" --commands - << EOF |
|
111 | 111 | > pick c8e68270e35a 3 four |
|
112 | 112 | > pick 08d98a8350f3 4 five |
|
113 | 113 | > EOF |
|
114 | 114 | |
|
115 | 115 | Run on a revision not descendants of the initial parent |
|
116 | 116 | -------------------------------------------------------------------- |
|
117 | 117 | |
|
118 | 118 | Test the message shown for inconsistent histedit state, which may be |
|
119 | 119 | created (and forgotten) by Mercurial earlier than 2.7. This emulates |
|
120 | 120 | Mercurial earlier than 2.7 by renaming ".hg/histedit-state" |
|
121 | 121 | temporarily. |
|
122 | 122 | |
|
123 | 123 | $ hg log -G -T '{rev} {shortest(node)} {desc}\n' -r 2:: |
|
124 | 124 | @ 4 08d9 five |
|
125 | 125 | | |
|
126 | 126 | o 3 c8e6 four |
|
127 | 127 | | |
|
128 | 128 | o 2 eb57 three |
|
129 | 129 | | |
|
130 | 130 | ~ |
|
131 | 131 | $ HGEDITOR=cat hg histedit -r 4 --commands - << EOF |
|
132 | 132 | > edit 08d98a8350f3 4 five |
|
133 | 133 | > EOF |
|
134 | 134 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
135 | 135 | reverting alpha |
|
136 | 136 | Editing (08d98a8350f3), you may commit or record as needed now. |
|
137 | 137 | (hg histedit --continue to resume) |
|
138 | 138 | [1] |
|
139 | 139 | |
|
140 | 140 | $ hg graft --continue |
|
141 | 141 | abort: no graft in progress |
|
142 | 142 | (continue: hg histedit --continue) |
|
143 | 143 | [255] |
|
144 | 144 | |
|
145 | 145 | $ mv .hg/histedit-state .hg/histedit-state.back |
|
146 | 146 | $ hg update --quiet --clean 2 |
|
147 | 147 | $ echo alpha >> alpha |
|
148 | 148 | $ mv .hg/histedit-state.back .hg/histedit-state |
|
149 | 149 | |
|
150 | 150 | $ hg histedit --continue |
|
151 | 151 | saved backup bundle to $TESTTMP/foo/.hg/strip-backup/08d98a8350f3-02594089-histedit.hg (glob) |
|
152 | 152 | $ hg log -G -T '{rev} {shortest(node)} {desc}\n' -r 2:: |
|
153 | 153 | @ 4 f5ed five |
|
154 | 154 | | |
|
155 | 155 | | o 3 c8e6 four |
|
156 | 156 | |/ |
|
157 | 157 | o 2 eb57 three |
|
158 | 158 | | |
|
159 | 159 | ~ |
|
160 | 160 | |
|
161 | 161 | $ hg unbundle -q $TESTTMP/foo/.hg/strip-backup/08d98a8350f3-02594089-histedit.hg |
|
162 | 162 | $ hg strip -q -r f5ed --config extensions.strip= |
|
163 | 163 | $ hg up -q 08d98a8350f3 |
|
164 | 164 | |
|
165 | 165 | Test that missing revisions are detected |
|
166 | 166 | --------------------------------------- |
|
167 | 167 | |
|
168 | 168 | $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF |
|
169 | 169 | > pick eb57da33312f 2 three |
|
170 | 170 | > pick 08d98a8350f3 4 five |
|
171 | 171 | > EOF |
|
172 | 172 | hg: parse error: missing rules for changeset c8e68270e35a |
|
173 | 173 | (use "drop c8e68270e35a" to discard, see also: 'hg help -e histedit.config') |
|
174 | 174 | [255] |
|
175 | 175 | |
|
176 | 176 | Test that extra revisions are detected |
|
177 | 177 | --------------------------------------- |
|
178 | 178 | |
|
179 | 179 | $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF |
|
180 | 180 | > pick 6058cbb6cfd7 0 one |
|
181 | 181 | > pick c8e68270e35a 3 four |
|
182 | 182 | > pick 08d98a8350f3 4 five |
|
183 | 183 | > EOF |
|
184 | 184 | hg: parse error: pick "6058cbb6cfd7" changeset was not a candidate |
|
185 | 185 | (only use listed changesets) |
|
186 | 186 | [255] |
|
187 | 187 | |
|
188 | 188 | Test malformed line |
|
189 | 189 | --------------------------------------- |
|
190 | 190 | |
|
191 | 191 | $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF |
|
192 | 192 | > pickeb57da33312f2three |
|
193 | 193 | > pick c8e68270e35a 3 four |
|
194 | 194 | > pick 08d98a8350f3 4 five |
|
195 | 195 | > EOF |
|
196 | 196 | hg: parse error: malformed line "pickeb57da33312f2three" |
|
197 | 197 | [255] |
|
198 | 198 | |
|
199 | 199 | Test unknown changeset |
|
200 | 200 | --------------------------------------- |
|
201 | 201 | |
|
202 | 202 | $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF |
|
203 | 203 | > pick 0123456789ab 2 three |
|
204 | 204 | > pick c8e68270e35a 3 four |
|
205 | 205 | > pick 08d98a8350f3 4 five |
|
206 | 206 | > EOF |
|
207 | 207 | hg: parse error: unknown changeset 0123456789ab listed |
|
208 | 208 | [255] |
|
209 | 209 | |
|
210 | 210 | Test unknown command |
|
211 | 211 | --------------------------------------- |
|
212 | 212 | |
|
213 | 213 | $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF |
|
214 | 214 | > coin eb57da33312f 2 three |
|
215 | 215 | > pick c8e68270e35a 3 four |
|
216 | 216 | > pick 08d98a8350f3 4 five |
|
217 | 217 | > EOF |
|
218 | 218 | hg: parse error: unknown action "coin" |
|
219 | 219 | [255] |
|
220 | 220 | |
|
221 | 221 | Test duplicated changeset |
|
222 | 222 | --------------------------------------- |
|
223 | 223 | |
|
224 | 224 | So one is missing and one appear twice. |
|
225 | 225 | |
|
226 | 226 | $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF |
|
227 | 227 | > pick eb57da33312f 2 three |
|
228 | 228 | > pick eb57da33312f 2 three |
|
229 | 229 | > pick 08d98a8350f3 4 five |
|
230 | 230 | > EOF |
|
231 | 231 | hg: parse error: duplicated command for changeset eb57da33312f |
|
232 | 232 | [255] |
|
233 | 233 | |
|
234 | 234 | Test bogus rev |
|
235 | 235 | --------------------------------------- |
|
236 | 236 | |
|
237 | 237 | $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF |
|
238 | 238 | > pick eb57da33312f 2 three |
|
239 | 239 | > pick 0 |
|
240 | 240 | > pick 08d98a8350f3 4 five |
|
241 | 241 | > EOF |
|
242 | 242 | hg: parse error: invalid changeset 0 |
|
243 | 243 | [255] |
|
244 | 244 | |
|
245 | 245 | Test short version of command |
|
246 | 246 | --------------------------------------- |
|
247 | 247 | |
|
248 | 248 | Note: we use varying amounts of white space between command name and changeset |
|
249 | 249 | short hash. This tests issue3893. |
|
250 | 250 | |
|
251 | 251 | $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF |
|
252 | 252 | > pick eb57da33312f 2 three |
|
253 | 253 | > p c8e68270e35a 3 four |
|
254 | 254 | > f 08d98a8350f3 4 five |
|
255 | 255 | > EOF |
|
256 | 256 | four |
|
257 | 257 | *** |
|
258 | 258 | five |
|
259 | 259 | |
|
260 | 260 | |
|
261 | 261 | |
|
262 | 262 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
263 | 263 | HG: Leave message empty to abort commit. |
|
264 | 264 | HG: -- |
|
265 | 265 | HG: user: test |
|
266 | 266 | HG: branch 'default' |
|
267 | 267 | HG: changed alpha |
|
268 | 268 | saved backup bundle to $TESTTMP/foo/.hg/strip-backup/c8e68270e35a-63d8b8d8-histedit.hg (glob) |
|
269 | 269 | |
|
270 | 270 | $ hg update -q 2 |
|
271 | 271 | $ echo x > x |
|
272 | 272 | $ hg add x |
|
273 | 273 | $ hg commit -m'x' x |
|
274 | 274 | created new head |
|
275 | 275 | $ hg histedit -r 'heads(all())' |
|
276 | 276 | abort: The specified revisions must have exactly one common root |
|
277 | 277 | [255] |
|
278 | 278 | |
|
279 | 279 | Test that trimming description using multi-byte characters |
|
280 | 280 | -------------------------------------------------------------------- |
|
281 | 281 | |
|
282 | 282 | $ $PYTHON <<EOF |
|
283 | 283 | > fp = open('logfile', 'w') |
|
284 | 284 | > fp.write('12345678901234567890123456789012345678901234567890' + |
|
285 | 285 | > '12345') # there are 5 more columns for 80 columns |
|
286 | 286 | > |
|
287 | 287 | > # 2 x 4 = 8 columns, but 3 x 4 = 12 bytes |
|
288 | 288 | > fp.write(u'\u3042\u3044\u3046\u3048'.encode('utf-8')) |
|
289 | 289 | > |
|
290 | 290 | > fp.close() |
|
291 | 291 | > EOF |
|
292 | 292 | $ echo xx >> x |
|
293 | 293 | $ hg --encoding utf-8 commit --logfile logfile |
|
294 | 294 | |
|
295 | 295 | $ HGEDITOR=cat hg --encoding utf-8 histedit tip |
|
296 | 296 | pick 3d3ea1f3a10b 5 1234567890123456789012345678901234567890123456789012345\xe3\x81\x82... (esc) |
|
297 | 297 | |
|
298 | 298 | # Edit history between 3d3ea1f3a10b and 3d3ea1f3a10b |
|
299 | 299 | # |
|
300 | 300 | # Commits are listed from least to most recent |
|
301 | 301 | # |
|
302 | 302 | # You can reorder changesets by reordering the lines |
|
303 | 303 | # |
|
304 | 304 | # Commands: |
|
305 | 305 | # |
|
306 | 306 | # e, edit = use commit, but stop for amending |
|
307 | 307 | # m, mess = edit commit message without changing commit content |
|
308 | 308 | # p, pick = use commit |
|
309 | 309 | # b, base = checkout changeset and apply further changesets from there |
|
310 | 310 | # d, drop = remove commit from history |
|
311 | 311 | # f, fold = use commit, but combine it with the one above |
|
312 | 312 | # r, roll = like fold, but discard this commit's description and date |
|
313 | 313 | # |
|
314 | 314 | |
|
315 | 315 | Test --continue with --keep |
|
316 | 316 | |
|
317 | 317 | $ hg strip -q -r . --config extensions.strip= |
|
318 | 318 | $ hg histedit '.^' -q --keep --commands - << EOF |
|
319 | 319 | > edit eb57da33312f 2 three |
|
320 | 320 | > pick f3cfcca30c44 4 x |
|
321 | 321 | > EOF |
|
322 | 322 | Editing (eb57da33312f), you may commit or record as needed now. |
|
323 | 323 | (hg histedit --continue to resume) |
|
324 | 324 | [1] |
|
325 | 325 | $ echo edit >> alpha |
|
326 | 326 | $ hg histedit -q --continue |
|
327 | 327 | $ hg log -G -T '{rev}:{node|short} {desc}' |
|
328 | 328 | @ 6:8fda0c726bf2 x |
|
329 | 329 | | |
|
330 | 330 | o 5:63379946892c three |
|
331 | 331 | | |
|
332 | 332 | | o 4:f3cfcca30c44 x |
|
333 | 333 | | | |
|
334 | 334 | | | o 3:2a30f3cfee78 four |
|
335 | 335 | | |/ *** |
|
336 | 336 | | | five |
|
337 | 337 | | o 2:eb57da33312f three |
|
338 | 338 | |/ |
|
339 | 339 | o 1:579e40513370 two |
|
340 | 340 | | |
|
341 | 341 | o 0:6058cbb6cfd7 one |
|
342 | 342 | |
|
343 | 343 | |
|
344 | 344 | Test that abort fails gracefully on exception |
|
345 | 345 | ---------------------------------------------- |
|
346 | 346 | $ hg histedit . -q --commands - << EOF |
|
347 | 347 | > edit 8fda0c726bf2 6 x |
|
348 | 348 | > EOF |
|
349 | 349 | Editing (8fda0c726bf2), you may commit or record as needed now. |
|
350 | 350 | (hg histedit --continue to resume) |
|
351 | 351 | [1] |
|
352 | 352 | Corrupt histedit state file |
|
353 | 353 | $ sed 's/8fda0c726bf2/123456789012/' .hg/histedit-state > ../corrupt-histedit |
|
354 | 354 | $ mv ../corrupt-histedit .hg/histedit-state |
|
355 | 355 | $ hg histedit --abort |
|
356 | 356 | warning: encountered an exception during histedit --abort; the repository may not have been completely cleaned up |
|
357 | 357 | abort: .*(No such file or directory:|The system cannot find the file specified).* (re) |
|
358 | 358 | [255] |
|
359 | 359 | Histedit state has been exited |
|
360 | 360 | $ hg summary -q |
|
361 | 361 | parent: 5:63379946892c |
|
362 | 362 | commit: 1 added, 1 unknown (new branch head) |
|
363 | 363 | update: 4 new changesets (update) |
|
364 | 364 | |
|
365 | 365 | $ cd .. |
|
366 | 366 | |
|
367 | 367 | Set up default base revision tests |
|
368 | 368 | |
|
369 | 369 | $ hg init defaultbase |
|
370 | 370 | $ cd defaultbase |
|
371 | 371 | $ touch foo |
|
372 | 372 | $ hg -q commit -A -m root |
|
373 | 373 | $ echo 1 > foo |
|
374 | 374 | $ hg commit -m 'public 1' |
|
375 | 375 | $ hg phase --force --public -r . |
|
376 | 376 | $ echo 2 > foo |
|
377 | 377 | $ hg commit -m 'draft after public' |
|
378 | 378 | $ hg -q up -r 1 |
|
379 | 379 | $ echo 3 > foo |
|
380 | 380 | $ hg commit -m 'head 1 public' |
|
381 | 381 | created new head |
|
382 | 382 | $ hg phase --force --public -r . |
|
383 | 383 | $ echo 4 > foo |
|
384 | 384 | $ hg commit -m 'head 1 draft 1' |
|
385 | 385 | $ echo 5 > foo |
|
386 | 386 | $ hg commit -m 'head 1 draft 2' |
|
387 | 387 | $ hg -q up -r 2 |
|
388 | 388 | $ echo 6 > foo |
|
389 | 389 | $ hg commit -m 'head 2 commit 1' |
|
390 | 390 | $ echo 7 > foo |
|
391 | 391 | $ hg commit -m 'head 2 commit 2' |
|
392 | 392 | $ hg -q up -r 2 |
|
393 | 393 | $ echo 8 > foo |
|
394 | 394 | $ hg commit -m 'head 3' |
|
395 | 395 | created new head |
|
396 | 396 | $ hg -q up -r 2 |
|
397 | 397 | $ echo 9 > foo |
|
398 | 398 | $ hg commit -m 'head 4' |
|
399 | 399 | created new head |
|
400 | 400 | $ hg merge --tool :local -r 8 |
|
401 | 401 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
402 | 402 | (branch merge, don't forget to commit) |
|
403 | 403 | $ hg commit -m 'merge head 3 into head 4' |
|
404 | 404 | $ echo 11 > foo |
|
405 | 405 | $ hg commit -m 'commit 1 after merge' |
|
406 | 406 | $ echo 12 > foo |
|
407 | 407 | $ hg commit -m 'commit 2 after merge' |
|
408 | 408 | |
|
409 | 409 | $ hg log -G -T '{rev}:{node|short} {phase} {desc}\n' |
|
410 | 410 | @ 12:8cde254db839 draft commit 2 after merge |
|
411 | 411 | | |
|
412 | 412 | o 11:6f2f0241f119 draft commit 1 after merge |
|
413 | 413 | | |
|
414 | 414 | o 10:90506cc76b00 draft merge head 3 into head 4 |
|
415 | 415 | |\ |
|
416 | 416 | | o 9:f8607a373a97 draft head 4 |
|
417 | 417 | | | |
|
418 | 418 | o | 8:0da92be05148 draft head 3 |
|
419 | 419 | |/ |
|
420 | 420 | | o 7:4c35cdf97d5e draft head 2 commit 2 |
|
421 | 421 | | | |
|
422 | 422 | | o 6:931820154288 draft head 2 commit 1 |
|
423 | 423 | |/ |
|
424 | 424 | | o 5:8cdc02b9bc63 draft head 1 draft 2 |
|
425 | 425 | | | |
|
426 | 426 | | o 4:463b8c0d2973 draft head 1 draft 1 |
|
427 | 427 | | | |
|
428 | 428 | | o 3:23a0c4eefcbf public head 1 public |
|
429 | 429 | | | |
|
430 | 430 | o | 2:4117331c3abb draft draft after public |
|
431 | 431 | |/ |
|
432 | 432 | o 1:4426d359ea59 public public 1 |
|
433 | 433 | | |
|
434 | 434 | o 0:54136a8ddf32 public root |
|
435 | 435 | |
|
436 | 436 | |
|
437 | 437 | Default base revision should stop at public changesets |
|
438 | 438 | |
|
439 | 439 | $ hg -q up 8cdc02b9bc63 |
|
440 | 440 | $ hg histedit --commands - <<EOF |
|
441 | 441 | > pick 463b8c0d2973 |
|
442 | 442 | > pick 8cdc02b9bc63 |
|
443 | 443 | > EOF |
|
444 | 444 | |
|
445 | 445 | Default base revision should stop at branchpoint |
|
446 | 446 | |
|
447 | 447 | $ hg -q up 4c35cdf97d5e |
|
448 | 448 | $ hg histedit --commands - <<EOF |
|
449 | 449 | > pick 931820154288 |
|
450 | 450 | > pick 4c35cdf97d5e |
|
451 | 451 | > EOF |
|
452 | 452 | |
|
453 | 453 | Default base revision should stop at merge commit |
|
454 | 454 | |
|
455 | 455 | $ hg -q up 8cde254db839 |
|
456 | 456 | $ hg histedit --commands - <<EOF |
|
457 | 457 | > pick 6f2f0241f119 |
|
458 | 458 | > pick 8cde254db839 |
|
459 | 459 | > EOF |
|
460 | 460 | |
|
461 | 461 | commit --amend should abort if histedit is in progress |
|
462 | 462 | (issue4800) and markers are not being created. |
|
463 | 463 | Eventually, histedit could perhaps look at `source` extra, |
|
464 | 464 | in which case this test should be revisited. |
|
465 | 465 | |
|
466 | 466 | $ hg -q up 8cde254db839 |
|
467 | 467 | $ hg histedit 6f2f0241f119 --commands - <<EOF |
|
468 | 468 | > pick 8cde254db839 |
|
469 | 469 | > edit 6f2f0241f119 |
|
470 | 470 | > EOF |
|
471 | 471 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
472 | 472 | merging foo |
|
473 | 473 | warning: conflicts while merging foo! (edit, then use 'hg resolve --mark') |
|
474 | 474 | Fix up the change (pick 8cde254db839) |
|
475 | 475 | (hg histedit --continue to resume) |
|
476 | 476 | [1] |
|
477 | 477 | $ hg resolve -m --all |
|
478 | 478 | (no more unresolved files) |
|
479 | 479 | continue: hg histedit --continue |
|
480 | 480 | $ hg histedit --cont |
|
481 | 481 | merging foo |
|
482 | 482 | warning: conflicts while merging foo! (edit, then use 'hg resolve --mark') |
|
483 | 483 | Editing (6f2f0241f119), you may commit or record as needed now. |
|
484 | 484 | (hg histedit --continue to resume) |
|
485 | 485 | [1] |
|
486 | 486 | $ hg resolve -m --all |
|
487 | 487 | (no more unresolved files) |
|
488 | 488 | continue: hg histedit --continue |
|
489 | 489 | $ hg commit --amend -m 'reject this fold' |
|
490 | 490 | abort: histedit in progress |
|
491 | 491 | (use 'hg histedit --continue' or 'hg histedit --abort') |
|
492 | 492 | [255] |
|
493 | 493 | |
|
494 | 494 | With markers enabled, histedit does not get confused, and |
|
495 | 495 | amend should not be blocked by the ongoing histedit. |
|
496 | 496 | |
|
497 | 497 | $ cat >>$HGRCPATH <<EOF |
|
498 | 498 | > [experimental] |
|
499 | > evolution=allowunstable | |
|
500 | 499 | > evolution.createmarkers=True |
|
500 | > evolution.allowunstable=True | |
|
501 | 501 | > EOF |
|
502 | 502 | $ hg commit --amend -m 'allow this fold' |
|
503 | 503 | $ hg histedit --continue |
|
504 | 504 | |
|
505 | 505 | $ cd .. |
|
506 | 506 | |
|
507 | 507 | Test autoverb feature |
|
508 | 508 | |
|
509 | 509 | $ hg init autoverb |
|
510 | 510 | $ cd autoverb |
|
511 | 511 | $ echo alpha >> alpha |
|
512 | 512 | $ hg ci -qAm one |
|
513 | 513 | $ echo alpha >> alpha |
|
514 | 514 | $ hg ci -qm two |
|
515 | 515 | $ echo beta >> beta |
|
516 | 516 | $ hg ci -qAm "roll! one" |
|
517 | 517 | |
|
518 | 518 | $ hg log --style compact --graph |
|
519 | 519 | @ 2[tip] 4f34d0f8b5fa 1970-01-01 00:00 +0000 test |
|
520 | 520 | | roll! one |
|
521 | 521 | | |
|
522 | 522 | o 1 579e40513370 1970-01-01 00:00 +0000 test |
|
523 | 523 | | two |
|
524 | 524 | | |
|
525 | 525 | o 0 6058cbb6cfd7 1970-01-01 00:00 +0000 test |
|
526 | 526 | one |
|
527 | 527 | |
|
528 | 528 | |
|
529 | 529 | Check that 'roll' is selected by default |
|
530 | 530 | |
|
531 | 531 | $ HGEDITOR=cat hg histedit 0 --config experimental.histedit.autoverb=True |
|
532 | 532 | pick 6058cbb6cfd7 0 one |
|
533 | 533 | roll 4f34d0f8b5fa 2 roll! one |
|
534 | 534 | pick 579e40513370 1 two |
|
535 | 535 | |
|
536 | 536 | # Edit history between 6058cbb6cfd7 and 4f34d0f8b5fa |
|
537 | 537 | # |
|
538 | 538 | # Commits are listed from least to most recent |
|
539 | 539 | # |
|
540 | 540 | # You can reorder changesets by reordering the lines |
|
541 | 541 | # |
|
542 | 542 | # Commands: |
|
543 | 543 | # |
|
544 | 544 | # e, edit = use commit, but stop for amending |
|
545 | 545 | # m, mess = edit commit message without changing commit content |
|
546 | 546 | # p, pick = use commit |
|
547 | 547 | # b, base = checkout changeset and apply further changesets from there |
|
548 | 548 | # d, drop = remove commit from history |
|
549 | 549 | # f, fold = use commit, but combine it with the one above |
|
550 | 550 | # r, roll = like fold, but discard this commit's description and date |
|
551 | 551 | # |
|
552 | 552 | |
|
553 | 553 | $ cd .. |
@@ -1,578 +1,578 b'' | |||
|
1 | 1 | $ . "$TESTDIR/histedit-helpers.sh" |
|
2 | 2 | |
|
3 | 3 | Enable obsolete |
|
4 | 4 | |
|
5 | 5 | $ cat >> $HGRCPATH << EOF |
|
6 | 6 | > [ui] |
|
7 | 7 | > logtemplate= {rev}:{node|short} {desc|firstline} |
|
8 | 8 | > [phases] |
|
9 | 9 | > publish=False |
|
10 | 10 | > [experimental] |
|
11 | > evolution=allowunstable | |
|
12 | 11 | > evolution.createmarkers=True |
|
12 | > evolution.allowunstable=True | |
|
13 | 13 | > [extensions] |
|
14 | 14 | > histedit= |
|
15 | 15 | > rebase= |
|
16 | 16 | > EOF |
|
17 | 17 | |
|
18 | 18 | Test that histedit learns about obsolescence not stored in histedit state |
|
19 | 19 | $ hg init boo |
|
20 | 20 | $ cd boo |
|
21 | 21 | $ echo a > a |
|
22 | 22 | $ hg ci -Am a |
|
23 | 23 | adding a |
|
24 | 24 | $ echo a > b |
|
25 | 25 | $ echo a > c |
|
26 | 26 | $ echo a > c |
|
27 | 27 | $ hg ci -Am b |
|
28 | 28 | adding b |
|
29 | 29 | adding c |
|
30 | 30 | $ echo a > d |
|
31 | 31 | $ hg ci -Am c |
|
32 | 32 | adding d |
|
33 | 33 | $ echo "pick `hg log -r 0 -T '{node|short}'`" > plan |
|
34 | 34 | $ echo "pick `hg log -r 2 -T '{node|short}'`" >> plan |
|
35 | 35 | $ echo "edit `hg log -r 1 -T '{node|short}'`" >> plan |
|
36 | 36 | $ hg histedit -r 'all()' --commands plan |
|
37 | 37 | Editing (1b2d564fad96), you may commit or record as needed now. |
|
38 | 38 | (hg histedit --continue to resume) |
|
39 | 39 | [1] |
|
40 | 40 | $ hg st |
|
41 | 41 | A b |
|
42 | 42 | A c |
|
43 | 43 | ? plan |
|
44 | 44 | $ hg commit --amend b |
|
45 | 45 | $ hg histedit --continue |
|
46 | 46 | $ hg log -G |
|
47 | 47 | @ 5:46abc7c4d873 b |
|
48 | 48 | | |
|
49 | 49 | o 4:49d44ab2be1b c |
|
50 | 50 | | |
|
51 | 51 | o 0:cb9a9f314b8b a |
|
52 | 52 | |
|
53 | 53 | $ hg debugobsolete |
|
54 | 54 | e72d22b19f8ecf4150ab4f91d0973fd9955d3ddf 49d44ab2be1b67a79127568a67c9c99430633b48 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'} |
|
55 | 55 | 1b2d564fad96311b45362f17c2aa855150efb35f 46abc7c4d8738e8563e577f7889e1b6db3da4199 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'histedit', 'user': 'test'} |
|
56 | 56 | 114f4176969ef342759a8a57e6bccefc4234829b 49d44ab2be1b67a79127568a67c9c99430633b48 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'histedit', 'user': 'test'} |
|
57 | 57 | |
|
58 | 58 | With some node gone missing during the edit. |
|
59 | 59 | |
|
60 | 60 | $ echo "pick `hg log -r 0 -T '{node|short}'`" > plan |
|
61 | 61 | $ echo "pick `hg log -r 5 -T '{node|short}'`" >> plan |
|
62 | 62 | $ echo "edit `hg log -r 4 -T '{node|short}'`" >> plan |
|
63 | 63 | $ hg histedit -r 'all()' --commands plan |
|
64 | 64 | Editing (49d44ab2be1b), you may commit or record as needed now. |
|
65 | 65 | (hg histedit --continue to resume) |
|
66 | 66 | [1] |
|
67 | 67 | $ hg st |
|
68 | 68 | A b |
|
69 | 69 | A d |
|
70 | 70 | ? plan |
|
71 | 71 | $ hg commit --amend -X . -m XXXXXX |
|
72 | 72 | $ hg commit --amend -X . -m b2 |
|
73 | 73 | $ hg --hidden --config extensions.strip= strip 'desc(XXXXXX)' --no-backup |
|
74 | 74 | $ hg histedit --continue |
|
75 | 75 | $ hg log -G |
|
76 | 76 | @ 8:273c1f3b8626 c |
|
77 | 77 | | |
|
78 | 78 | o 7:aba7da937030 b2 |
|
79 | 79 | | |
|
80 | 80 | o 0:cb9a9f314b8b a |
|
81 | 81 | |
|
82 | 82 | $ hg debugobsolete |
|
83 | 83 | e72d22b19f8ecf4150ab4f91d0973fd9955d3ddf 49d44ab2be1b67a79127568a67c9c99430633b48 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'} |
|
84 | 84 | 1b2d564fad96311b45362f17c2aa855150efb35f 46abc7c4d8738e8563e577f7889e1b6db3da4199 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'histedit', 'user': 'test'} |
|
85 | 85 | 114f4176969ef342759a8a57e6bccefc4234829b 49d44ab2be1b67a79127568a67c9c99430633b48 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'histedit', 'user': 'test'} |
|
86 | 86 | 76f72745eac0643d16530e56e2f86e36e40631f1 2ca853e48edbd6453a0674dc0fe28a0974c51b9c 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'} |
|
87 | 87 | 2ca853e48edbd6453a0674dc0fe28a0974c51b9c aba7da93703075eec9fb1dbaf143ff2bc1c49d46 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'} |
|
88 | 88 | 49d44ab2be1b67a79127568a67c9c99430633b48 273c1f3b86267ed3ec684bb13af1fa4d6ba56e02 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'histedit', 'user': 'test'} |
|
89 | 89 | 46abc7c4d8738e8563e577f7889e1b6db3da4199 aba7da93703075eec9fb1dbaf143ff2bc1c49d46 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'histedit', 'user': 'test'} |
|
90 | 90 | $ cd .. |
|
91 | 91 | |
|
92 | 92 | Base setup for the rest of the testing |
|
93 | 93 | ====================================== |
|
94 | 94 | |
|
95 | 95 | $ hg init base |
|
96 | 96 | $ cd base |
|
97 | 97 | |
|
98 | 98 | $ for x in a b c d e f ; do |
|
99 | 99 | > echo $x > $x |
|
100 | 100 | > hg add $x |
|
101 | 101 | > hg ci -m $x |
|
102 | 102 | > done |
|
103 | 103 | |
|
104 | 104 | $ hg log --graph |
|
105 | 105 | @ 5:652413bf663e f |
|
106 | 106 | | |
|
107 | 107 | o 4:e860deea161a e |
|
108 | 108 | | |
|
109 | 109 | o 3:055a42cdd887 d |
|
110 | 110 | | |
|
111 | 111 | o 2:177f92b77385 c |
|
112 | 112 | | |
|
113 | 113 | o 1:d2ae7f538514 b |
|
114 | 114 | | |
|
115 | 115 | o 0:cb9a9f314b8b a |
|
116 | 116 | |
|
117 | 117 | |
|
118 | 118 | $ HGEDITOR=cat hg histedit 1 |
|
119 | 119 | pick d2ae7f538514 1 b |
|
120 | 120 | pick 177f92b77385 2 c |
|
121 | 121 | pick 055a42cdd887 3 d |
|
122 | 122 | pick e860deea161a 4 e |
|
123 | 123 | pick 652413bf663e 5 f |
|
124 | 124 | |
|
125 | 125 | # Edit history between d2ae7f538514 and 652413bf663e |
|
126 | 126 | # |
|
127 | 127 | # Commits are listed from least to most recent |
|
128 | 128 | # |
|
129 | 129 | # You can reorder changesets by reordering the lines |
|
130 | 130 | # |
|
131 | 131 | # Commands: |
|
132 | 132 | # |
|
133 | 133 | # e, edit = use commit, but stop for amending |
|
134 | 134 | # m, mess = edit commit message without changing commit content |
|
135 | 135 | # p, pick = use commit |
|
136 | 136 | # b, base = checkout changeset and apply further changesets from there |
|
137 | 137 | # d, drop = remove commit from history |
|
138 | 138 | # f, fold = use commit, but combine it with the one above |
|
139 | 139 | # r, roll = like fold, but discard this commit's description and date |
|
140 | 140 | # |
|
141 | 141 | $ hg histedit 1 --commands - --verbose <<EOF | grep histedit |
|
142 | 142 | > pick 177f92b77385 2 c |
|
143 | 143 | > drop d2ae7f538514 1 b |
|
144 | 144 | > pick 055a42cdd887 3 d |
|
145 | 145 | > fold e860deea161a 4 e |
|
146 | 146 | > pick 652413bf663e 5 f |
|
147 | 147 | > EOF |
|
148 | 148 | [1] |
|
149 | 149 | $ hg log --graph --hidden |
|
150 | 150 | @ 10:cacdfd884a93 f |
|
151 | 151 | | |
|
152 | 152 | o 9:59d9f330561f d |
|
153 | 153 | | |
|
154 | 154 | | x 8:b558abc46d09 fold-temp-revision e860deea161a |
|
155 | 155 | | | |
|
156 | 156 | | x 7:96e494a2d553 d |
|
157 | 157 | |/ |
|
158 | 158 | o 6:b346ab9a313d c |
|
159 | 159 | | |
|
160 | 160 | | x 5:652413bf663e f |
|
161 | 161 | | | |
|
162 | 162 | | x 4:e860deea161a e |
|
163 | 163 | | | |
|
164 | 164 | | x 3:055a42cdd887 d |
|
165 | 165 | | | |
|
166 | 166 | | x 2:177f92b77385 c |
|
167 | 167 | | | |
|
168 | 168 | | x 1:d2ae7f538514 b |
|
169 | 169 | |/ |
|
170 | 170 | o 0:cb9a9f314b8b a |
|
171 | 171 | |
|
172 | 172 | $ hg debugobsolete |
|
173 | 173 | d2ae7f538514cd87c17547b0de4cea71fe1af9fb 0 {cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b} (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'histedit', 'user': 'test'} |
|
174 | 174 | 177f92b773850b59254aa5e923436f921b55483b b346ab9a313db8537ecf96fca3ca3ca984ef3bd7 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'histedit', 'user': 'test'} |
|
175 | 175 | 055a42cdd88768532f9cf79daa407fc8d138de9b 59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'histedit', 'user': 'test'} |
|
176 | 176 | e860deea161a2f77de56603b340ebbb4536308ae 59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'histedit', 'user': 'test'} |
|
177 | 177 | 652413bf663ef2a641cab26574e46d5f5a64a55a cacdfd884a9321ec4e1de275ef3949fa953a1f83 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'histedit', 'user': 'test'} |
|
178 | 178 | 96e494a2d553dd05902ba1cee1d94d4cb7b8faed 0 {b346ab9a313db8537ecf96fca3ca3ca984ef3bd7} (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'histedit', 'user': 'test'} |
|
179 | 179 | b558abc46d09c30f57ac31e85a8a3d64d2e906e4 0 {96e494a2d553dd05902ba1cee1d94d4cb7b8faed} (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'histedit', 'user': 'test'} |
|
180 | 180 | |
|
181 | 181 | |
|
182 | 182 | Ensure hidden revision does not prevent histedit |
|
183 | 183 | ------------------------------------------------- |
|
184 | 184 | |
|
185 | 185 | create an hidden revision |
|
186 | 186 | |
|
187 | 187 | $ hg histedit 6 --commands - << EOF |
|
188 | 188 | > pick b346ab9a313d 6 c |
|
189 | 189 | > drop 59d9f330561f 7 d |
|
190 | 190 | > pick cacdfd884a93 8 f |
|
191 | 191 | > EOF |
|
192 | 192 | $ hg log --graph |
|
193 | 193 | @ 11:c13eb81022ca f |
|
194 | 194 | | |
|
195 | 195 | o 6:b346ab9a313d c |
|
196 | 196 | | |
|
197 | 197 | o 0:cb9a9f314b8b a |
|
198 | 198 | |
|
199 | 199 | check hidden revision are ignored (6 have hidden children 7 and 8) |
|
200 | 200 | |
|
201 | 201 | $ hg histedit 6 --commands - << EOF |
|
202 | 202 | > pick b346ab9a313d 6 c |
|
203 | 203 | > pick c13eb81022ca 8 f |
|
204 | 204 | > EOF |
|
205 | 205 | |
|
206 | 206 | |
|
207 | 207 | |
|
208 | 208 | Test that rewriting leaving instability behind is allowed |
|
209 | 209 | --------------------------------------------------------------------- |
|
210 | 210 | |
|
211 | 211 | $ hg up '.^' |
|
212 | 212 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
213 | 213 | $ hg log -r 'children(.)' |
|
214 | 214 | 11:c13eb81022ca f (no-eol) |
|
215 | 215 | $ hg histedit -r '.' --commands - <<EOF |
|
216 | 216 | > edit b346ab9a313d 6 c |
|
217 | 217 | > EOF |
|
218 | 218 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
219 | 219 | adding c |
|
220 | 220 | Editing (b346ab9a313d), you may commit or record as needed now. |
|
221 | 221 | (hg histedit --continue to resume) |
|
222 | 222 | [1] |
|
223 | 223 | $ echo c >> c |
|
224 | 224 | $ hg histedit --continue |
|
225 | 225 | |
|
226 | 226 | $ hg log -r 'orphan()' |
|
227 | 227 | 11:c13eb81022ca f (no-eol) |
|
228 | 228 | |
|
229 | 229 | stabilise |
|
230 | 230 | |
|
231 | 231 | $ hg rebase -r 'orphan()' -d . |
|
232 | 232 | rebasing 11:c13eb81022ca "f" |
|
233 | 233 | $ hg up tip -q |
|
234 | 234 | |
|
235 | 235 | Test dropping of changeset on the top of the stack |
|
236 | 236 | ------------------------------------------------------- |
|
237 | 237 | |
|
238 | 238 | Nothing is rewritten below, the working directory parent must be change for the |
|
239 | 239 | dropped changeset to be hidden. |
|
240 | 240 | |
|
241 | 241 | $ cd .. |
|
242 | 242 | $ hg clone base droplast |
|
243 | 243 | updating to branch default |
|
244 | 244 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
245 | 245 | $ cd droplast |
|
246 | 246 | $ hg histedit -r '40db8afa467b' --commands - << EOF |
|
247 | 247 | > pick 40db8afa467b 10 c |
|
248 | 248 | > drop b449568bf7fc 11 f |
|
249 | 249 | > EOF |
|
250 | 250 | $ hg log -G |
|
251 | 251 | @ 12:40db8afa467b c |
|
252 | 252 | | |
|
253 | 253 | o 0:cb9a9f314b8b a |
|
254 | 254 | |
|
255 | 255 | |
|
256 | 256 | With rewritten ancestors |
|
257 | 257 | |
|
258 | 258 | $ echo e > e |
|
259 | 259 | $ hg add e |
|
260 | 260 | $ hg commit -m g |
|
261 | 261 | $ echo f > f |
|
262 | 262 | $ hg add f |
|
263 | 263 | $ hg commit -m h |
|
264 | 264 | $ hg histedit -r '40db8afa467b' --commands - << EOF |
|
265 | 265 | > pick 47a8561c0449 12 g |
|
266 | 266 | > pick 40db8afa467b 10 c |
|
267 | 267 | > drop 1b3b05f35ff0 13 h |
|
268 | 268 | > EOF |
|
269 | 269 | $ hg log -G |
|
270 | 270 | @ 17:ee6544123ab8 c |
|
271 | 271 | | |
|
272 | 272 | o 16:269e713e9eae g |
|
273 | 273 | | |
|
274 | 274 | o 0:cb9a9f314b8b a |
|
275 | 275 | |
|
276 | 276 | $ cd ../base |
|
277 | 277 | |
|
278 | 278 | |
|
279 | 279 | |
|
280 | 280 | Test phases support |
|
281 | 281 | =========================================== |
|
282 | 282 | |
|
283 | 283 | Check that histedit respect immutability |
|
284 | 284 | ------------------------------------------- |
|
285 | 285 | |
|
286 | 286 | $ cat >> $HGRCPATH << EOF |
|
287 | 287 | > [ui] |
|
288 | 288 | > logtemplate= {rev}:{node|short} ({phase}) {desc|firstline}\n |
|
289 | 289 | > EOF |
|
290 | 290 | |
|
291 | 291 | $ hg ph -pv '.^' |
|
292 | 292 | phase changed for 2 changesets |
|
293 | 293 | $ hg log -G |
|
294 | 294 | @ 13:b449568bf7fc (draft) f |
|
295 | 295 | | |
|
296 | 296 | o 12:40db8afa467b (public) c |
|
297 | 297 | | |
|
298 | 298 | o 0:cb9a9f314b8b (public) a |
|
299 | 299 | |
|
300 | 300 | $ hg histedit -r '.~2' |
|
301 | 301 | abort: cannot edit public changeset: cb9a9f314b8b |
|
302 | 302 | (see 'hg help phases' for details) |
|
303 | 303 | [255] |
|
304 | 304 | |
|
305 | 305 | |
|
306 | 306 | Prepare further testing |
|
307 | 307 | ------------------------------------------- |
|
308 | 308 | |
|
309 | 309 | $ for x in g h i j k ; do |
|
310 | 310 | > echo $x > $x |
|
311 | 311 | > hg add $x |
|
312 | 312 | > hg ci -m $x |
|
313 | 313 | > done |
|
314 | 314 | $ hg phase --force --secret .~2 |
|
315 | 315 | $ hg log -G |
|
316 | 316 | @ 18:ee118ab9fa44 (secret) k |
|
317 | 317 | | |
|
318 | 318 | o 17:3a6c53ee7f3d (secret) j |
|
319 | 319 | | |
|
320 | 320 | o 16:b605fb7503f2 (secret) i |
|
321 | 321 | | |
|
322 | 322 | o 15:7395e1ff83bd (draft) h |
|
323 | 323 | | |
|
324 | 324 | o 14:6b70183d2492 (draft) g |
|
325 | 325 | | |
|
326 | 326 | o 13:b449568bf7fc (draft) f |
|
327 | 327 | | |
|
328 | 328 | o 12:40db8afa467b (public) c |
|
329 | 329 | | |
|
330 | 330 | o 0:cb9a9f314b8b (public) a |
|
331 | 331 | |
|
332 | 332 | $ cd .. |
|
333 | 333 | |
|
334 | 334 | simple phase conservation |
|
335 | 335 | ------------------------------------------- |
|
336 | 336 | |
|
337 | 337 | Resulting changeset should conserve the phase of the original one whatever the |
|
338 | 338 | phases.new-commit option is. |
|
339 | 339 | |
|
340 | 340 | New-commit as draft (default) |
|
341 | 341 | |
|
342 | 342 | $ cp -R base simple-draft |
|
343 | 343 | $ cd simple-draft |
|
344 | 344 | $ hg histedit -r 'b449568bf7fc' --commands - << EOF |
|
345 | 345 | > edit b449568bf7fc 11 f |
|
346 | 346 | > pick 6b70183d2492 12 g |
|
347 | 347 | > pick 7395e1ff83bd 13 h |
|
348 | 348 | > pick b605fb7503f2 14 i |
|
349 | 349 | > pick 3a6c53ee7f3d 15 j |
|
350 | 350 | > pick ee118ab9fa44 16 k |
|
351 | 351 | > EOF |
|
352 | 352 | 0 files updated, 0 files merged, 6 files removed, 0 files unresolved |
|
353 | 353 | adding f |
|
354 | 354 | Editing (b449568bf7fc), you may commit or record as needed now. |
|
355 | 355 | (hg histedit --continue to resume) |
|
356 | 356 | [1] |
|
357 | 357 | $ echo f >> f |
|
358 | 358 | $ hg histedit --continue |
|
359 | 359 | $ hg log -G |
|
360 | 360 | @ 24:12e89af74238 (secret) k |
|
361 | 361 | | |
|
362 | 362 | o 23:636a8687b22e (secret) j |
|
363 | 363 | | |
|
364 | 364 | o 22:ccaf0a38653f (secret) i |
|
365 | 365 | | |
|
366 | 366 | o 21:11a89d1c2613 (draft) h |
|
367 | 367 | | |
|
368 | 368 | o 20:c1dec7ca82ea (draft) g |
|
369 | 369 | | |
|
370 | 370 | o 19:087281e68428 (draft) f |
|
371 | 371 | | |
|
372 | 372 | o 12:40db8afa467b (public) c |
|
373 | 373 | | |
|
374 | 374 | o 0:cb9a9f314b8b (public) a |
|
375 | 375 | |
|
376 | 376 | $ cd .. |
|
377 | 377 | |
|
378 | 378 | |
|
379 | 379 | New-commit as secret (config) |
|
380 | 380 | |
|
381 | 381 | $ cp -R base simple-secret |
|
382 | 382 | $ cd simple-secret |
|
383 | 383 | $ cat >> .hg/hgrc << EOF |
|
384 | 384 | > [phases] |
|
385 | 385 | > new-commit=secret |
|
386 | 386 | > EOF |
|
387 | 387 | $ hg histedit -r 'b449568bf7fc' --commands - << EOF |
|
388 | 388 | > edit b449568bf7fc 11 f |
|
389 | 389 | > pick 6b70183d2492 12 g |
|
390 | 390 | > pick 7395e1ff83bd 13 h |
|
391 | 391 | > pick b605fb7503f2 14 i |
|
392 | 392 | > pick 3a6c53ee7f3d 15 j |
|
393 | 393 | > pick ee118ab9fa44 16 k |
|
394 | 394 | > EOF |
|
395 | 395 | 0 files updated, 0 files merged, 6 files removed, 0 files unresolved |
|
396 | 396 | adding f |
|
397 | 397 | Editing (b449568bf7fc), you may commit or record as needed now. |
|
398 | 398 | (hg histedit --continue to resume) |
|
399 | 399 | [1] |
|
400 | 400 | $ echo f >> f |
|
401 | 401 | $ hg histedit --continue |
|
402 | 402 | $ hg log -G |
|
403 | 403 | @ 24:12e89af74238 (secret) k |
|
404 | 404 | | |
|
405 | 405 | o 23:636a8687b22e (secret) j |
|
406 | 406 | | |
|
407 | 407 | o 22:ccaf0a38653f (secret) i |
|
408 | 408 | | |
|
409 | 409 | o 21:11a89d1c2613 (draft) h |
|
410 | 410 | | |
|
411 | 411 | o 20:c1dec7ca82ea (draft) g |
|
412 | 412 | | |
|
413 | 413 | o 19:087281e68428 (draft) f |
|
414 | 414 | | |
|
415 | 415 | o 12:40db8afa467b (public) c |
|
416 | 416 | | |
|
417 | 417 | o 0:cb9a9f314b8b (public) a |
|
418 | 418 | |
|
419 | 419 | $ cd .. |
|
420 | 420 | |
|
421 | 421 | |
|
422 | 422 | Changeset reordering |
|
423 | 423 | ------------------------------------------- |
|
424 | 424 | |
|
425 | 425 | If a secret changeset is put before a draft one, all descendant should be secret. |
|
426 | 426 | It seems more important to present the secret phase. |
|
427 | 427 | |
|
428 | 428 | $ cp -R base reorder |
|
429 | 429 | $ cd reorder |
|
430 | 430 | $ hg histedit -r 'b449568bf7fc' --commands - << EOF |
|
431 | 431 | > pick b449568bf7fc 11 f |
|
432 | 432 | > pick 3a6c53ee7f3d 15 j |
|
433 | 433 | > pick 6b70183d2492 12 g |
|
434 | 434 | > pick b605fb7503f2 14 i |
|
435 | 435 | > pick 7395e1ff83bd 13 h |
|
436 | 436 | > pick ee118ab9fa44 16 k |
|
437 | 437 | > EOF |
|
438 | 438 | $ hg log -G |
|
439 | 439 | @ 23:558246857888 (secret) k |
|
440 | 440 | | |
|
441 | 441 | o 22:28bd44768535 (secret) h |
|
442 | 442 | | |
|
443 | 443 | o 21:d5395202aeb9 (secret) i |
|
444 | 444 | | |
|
445 | 445 | o 20:21edda8e341b (secret) g |
|
446 | 446 | | |
|
447 | 447 | o 19:5ab64f3a4832 (secret) j |
|
448 | 448 | | |
|
449 | 449 | o 13:b449568bf7fc (draft) f |
|
450 | 450 | | |
|
451 | 451 | o 12:40db8afa467b (public) c |
|
452 | 452 | | |
|
453 | 453 | o 0:cb9a9f314b8b (public) a |
|
454 | 454 | |
|
455 | 455 | $ cd .. |
|
456 | 456 | |
|
457 | 457 | Changeset folding |
|
458 | 458 | ------------------------------------------- |
|
459 | 459 | |
|
460 | 460 | Folding a secret changeset with a draft one turn the result secret (again, |
|
461 | 461 | better safe than sorry). Folding between same phase changeset still works |
|
462 | 462 | |
|
463 | 463 | Note that there is a few reordering in this series for more extensive test |
|
464 | 464 | |
|
465 | 465 | $ cp -R base folding |
|
466 | 466 | $ cd folding |
|
467 | 467 | $ cat >> .hg/hgrc << EOF |
|
468 | 468 | > [phases] |
|
469 | 469 | > new-commit=secret |
|
470 | 470 | > EOF |
|
471 | 471 | $ hg histedit -r 'b449568bf7fc' --commands - << EOF |
|
472 | 472 | > pick 7395e1ff83bd 13 h |
|
473 | 473 | > fold b449568bf7fc 11 f |
|
474 | 474 | > pick 6b70183d2492 12 g |
|
475 | 475 | > fold 3a6c53ee7f3d 15 j |
|
476 | 476 | > pick b605fb7503f2 14 i |
|
477 | 477 | > fold ee118ab9fa44 16 k |
|
478 | 478 | > EOF |
|
479 | 479 | $ hg log -G |
|
480 | 480 | @ 27:f9daec13fb98 (secret) i |
|
481 | 481 | | |
|
482 | 482 | o 24:49807617f46a (secret) g |
|
483 | 483 | | |
|
484 | 484 | o 21:050280826e04 (draft) h |
|
485 | 485 | | |
|
486 | 486 | o 12:40db8afa467b (public) c |
|
487 | 487 | | |
|
488 | 488 | o 0:cb9a9f314b8b (public) a |
|
489 | 489 | |
|
490 | 490 | $ hg co 49807617f46a |
|
491 | 491 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
492 | 492 | $ echo wat >> wat |
|
493 | 493 | $ hg add wat |
|
494 | 494 | $ hg ci -m 'add wat' |
|
495 | 495 | created new head |
|
496 | 496 | $ hg merge f9daec13fb98 |
|
497 | 497 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
498 | 498 | (branch merge, don't forget to commit) |
|
499 | 499 | $ hg ci -m 'merge' |
|
500 | 500 | $ echo not wat > wat |
|
501 | 501 | $ hg ci -m 'modify wat' |
|
502 | 502 | $ hg histedit 050280826e04 |
|
503 | 503 | abort: cannot edit history that contains merges |
|
504 | 504 | [255] |
|
505 | 505 | $ cd .. |
|
506 | 506 | |
|
507 | 507 | Check abort behavior |
|
508 | 508 | ------------------------------------------- |
|
509 | 509 | |
|
510 | 510 | We checks that abort properly clean the repository so the same histedit can be |
|
511 | 511 | attempted later. |
|
512 | 512 | |
|
513 | 513 | $ cp -R base abort |
|
514 | 514 | $ cd abort |
|
515 | 515 | $ hg histedit -r 'b449568bf7fc' --commands - << EOF |
|
516 | 516 | > pick b449568bf7fc 13 f |
|
517 | 517 | > pick 7395e1ff83bd 15 h |
|
518 | 518 | > pick 6b70183d2492 14 g |
|
519 | 519 | > pick b605fb7503f2 16 i |
|
520 | 520 | > roll 3a6c53ee7f3d 17 j |
|
521 | 521 | > edit ee118ab9fa44 18 k |
|
522 | 522 | > EOF |
|
523 | 523 | Editing (ee118ab9fa44), you may commit or record as needed now. |
|
524 | 524 | (hg histedit --continue to resume) |
|
525 | 525 | [1] |
|
526 | 526 | |
|
527 | 527 | $ hg histedit --abort |
|
528 | 528 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
529 | 529 | saved backup bundle to $TESTTMP/abort/.hg/strip-backup/4dc06258baa6-dff4ef05-backup.hg (glob) |
|
530 | 530 | |
|
531 | 531 | $ hg log -G |
|
532 | 532 | @ 18:ee118ab9fa44 (secret) k |
|
533 | 533 | | |
|
534 | 534 | o 17:3a6c53ee7f3d (secret) j |
|
535 | 535 | | |
|
536 | 536 | o 16:b605fb7503f2 (secret) i |
|
537 | 537 | | |
|
538 | 538 | o 15:7395e1ff83bd (draft) h |
|
539 | 539 | | |
|
540 | 540 | o 14:6b70183d2492 (draft) g |
|
541 | 541 | | |
|
542 | 542 | o 13:b449568bf7fc (draft) f |
|
543 | 543 | | |
|
544 | 544 | o 12:40db8afa467b (public) c |
|
545 | 545 | | |
|
546 | 546 | o 0:cb9a9f314b8b (public) a |
|
547 | 547 | |
|
548 | 548 | $ hg histedit -r 'b449568bf7fc' --commands - << EOF --config experimental.stabilization.track-operation=1 |
|
549 | 549 | > pick b449568bf7fc 13 f |
|
550 | 550 | > pick 7395e1ff83bd 15 h |
|
551 | 551 | > pick 6b70183d2492 14 g |
|
552 | 552 | > pick b605fb7503f2 16 i |
|
553 | 553 | > pick 3a6c53ee7f3d 17 j |
|
554 | 554 | > edit ee118ab9fa44 18 k |
|
555 | 555 | > EOF |
|
556 | 556 | Editing (ee118ab9fa44), you may commit or record as needed now. |
|
557 | 557 | (hg histedit --continue to resume) |
|
558 | 558 | [1] |
|
559 | 559 | $ hg histedit --continue --config experimental.stabilization.track-operation=1 |
|
560 | 560 | $ hg log -G |
|
561 | 561 | @ 23:175d6b286a22 (secret) k |
|
562 | 562 | | |
|
563 | 563 | o 22:44ca09d59ae4 (secret) j |
|
564 | 564 | | |
|
565 | 565 | o 21:31747692a644 (secret) i |
|
566 | 566 | | |
|
567 | 567 | o 20:9985cd4f21fa (draft) g |
|
568 | 568 | | |
|
569 | 569 | o 19:4dc06258baa6 (draft) h |
|
570 | 570 | | |
|
571 | 571 | o 13:b449568bf7fc (draft) f |
|
572 | 572 | | |
|
573 | 573 | o 12:40db8afa467b (public) c |
|
574 | 574 | | |
|
575 | 575 | o 0:cb9a9f314b8b (public) a |
|
576 | 576 | |
|
577 | 577 | $ hg debugobsolete --rev . |
|
578 | 578 | ee118ab9fa44ebb86be85996548b5517a39e5093 175d6b286a224c23f192e79a581ce83131a53fa2 0 (*) {'operation': 'histedit', 'user': 'test'} (glob) |
@@ -1,56 +1,56 b'' | |||
|
1 | 1 | $ cat >> $HGRCPATH <<EOF |
|
2 | 2 | > [extensions] |
|
3 | 3 | > drawdag=$TESTDIR/drawdag.py |
|
4 | 4 | > bruterebase=$TESTDIR/bruterebase.py |
|
5 | 5 | > [experimental] |
|
6 | > evolution=allowunstable | |
|
7 | 6 | > evolution.createmarkers=True |
|
7 | > evolution.allowunstable=True | |
|
8 | 8 | > EOF |
|
9 | 9 | $ init() { |
|
10 | 10 | > N=`expr ${N:-0} + 1` |
|
11 | 11 | > cd $TESTTMP && hg init repo$N && cd repo$N |
|
12 | 12 | > hg debugdrawdag |
|
13 | 13 | > } |
|
14 | 14 | |
|
15 | 15 | Source looks like "N" |
|
16 | 16 | |
|
17 | 17 | $ init <<'EOS' |
|
18 | 18 | > C D |
|
19 | 19 | > |\| |
|
20 | 20 | > A B Z |
|
21 | 21 | > EOS |
|
22 | 22 | |
|
23 | 23 | $ hg debugbruterebase 'all()-Z' Z |
|
24 | 24 | A: A':Z |
|
25 | 25 | B: B':Z |
|
26 | 26 | AB: A':Z B':Z |
|
27 | 27 | C: ABORT: cannot rebase 3:a35c07e8a2a4 without moving at least one of its parents |
|
28 | 28 | AC: A':Z C':A'B |
|
29 | 29 | BC: B':Z C':B'A |
|
30 | 30 | ABC: A':Z B':Z C':A'B' |
|
31 | 31 | D: D':Z |
|
32 | 32 | AD: A':Z D':Z |
|
33 | 33 | BD: B':Z D':B' |
|
34 | 34 | ABD: A':Z B':Z D':B' |
|
35 | 35 | CD: ABORT: cannot rebase 3:a35c07e8a2a4 without moving at least one of its parents |
|
36 | 36 | ACD: A':Z C':A'B D':Z |
|
37 | 37 | BCD: B':Z C':B'A D':B' |
|
38 | 38 | ABCD: A':Z B':Z C':A'B' D':B' |
|
39 | 39 | |
|
40 | 40 | Moving backwards |
|
41 | 41 | |
|
42 | 42 | $ init <<'EOS' |
|
43 | 43 | > C |
|
44 | 44 | > |\ |
|
45 | 45 | > A B |
|
46 | 46 | > | |
|
47 | 47 | > Z |
|
48 | 48 | > EOS |
|
49 | 49 | $ hg debugbruterebase 'all()-Z' Z |
|
50 | 50 | B: B':Z |
|
51 | 51 | A: |
|
52 | 52 | BA: B':Z |
|
53 | 53 | C: ABORT: cannot rebase 3:b8d7149b562b without moving at least one of its parents |
|
54 | 54 | BC: B':Z C':B'A |
|
55 | 55 | AC: |
|
56 | 56 | BAC: B':Z C':B'A |
@@ -1,1376 +1,1376 b'' | |||
|
1 | 1 | ========================== |
|
2 | 2 | Test rebase with obsolete |
|
3 | 3 | ========================== |
|
4 | 4 | |
|
5 | 5 | Enable obsolete |
|
6 | 6 | |
|
7 | 7 | $ cat >> $HGRCPATH << EOF |
|
8 | 8 | > [ui] |
|
9 | 9 | > logtemplate= {rev}:{node|short} {desc|firstline} |
|
10 | 10 | > [experimental] |
|
11 | > evolution=allowunstable | |
|
12 | 11 | > evolution.createmarkers=True |
|
12 | > evolution.allowunstable=True | |
|
13 | 13 | > [phases] |
|
14 | 14 | > publish=False |
|
15 | 15 | > [extensions] |
|
16 | 16 | > rebase= |
|
17 | 17 | > drawdag=$TESTDIR/drawdag.py |
|
18 | 18 | > EOF |
|
19 | 19 | |
|
20 | 20 | Setup rebase canonical repo |
|
21 | 21 | |
|
22 | 22 | $ hg init base |
|
23 | 23 | $ cd base |
|
24 | 24 | $ hg unbundle "$TESTDIR/bundles/rebase.hg" |
|
25 | 25 | adding changesets |
|
26 | 26 | adding manifests |
|
27 | 27 | adding file changes |
|
28 | 28 | added 8 changesets with 7 changes to 7 files (+2 heads) |
|
29 | 29 | new changesets cd010b8cd998:02de42196ebe |
|
30 | 30 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
31 | 31 | $ hg up tip |
|
32 | 32 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
33 | 33 | $ hg log -G |
|
34 | 34 | @ 7:02de42196ebe H |
|
35 | 35 | | |
|
36 | 36 | | o 6:eea13746799a G |
|
37 | 37 | |/| |
|
38 | 38 | o | 5:24b6387c8c8c F |
|
39 | 39 | | | |
|
40 | 40 | | o 4:9520eea781bc E |
|
41 | 41 | |/ |
|
42 | 42 | | o 3:32af7686d403 D |
|
43 | 43 | | | |
|
44 | 44 | | o 2:5fddd98957c8 C |
|
45 | 45 | | | |
|
46 | 46 | | o 1:42ccdea3bb16 B |
|
47 | 47 | |/ |
|
48 | 48 | o 0:cd010b8cd998 A |
|
49 | 49 | |
|
50 | 50 | $ cd .. |
|
51 | 51 | |
|
52 | 52 | simple rebase |
|
53 | 53 | --------------------------------- |
|
54 | 54 | |
|
55 | 55 | $ hg clone base simple |
|
56 | 56 | updating to branch default |
|
57 | 57 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
58 | 58 | $ cd simple |
|
59 | 59 | $ hg up 32af7686d403 |
|
60 | 60 | 3 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
61 | 61 | $ hg rebase -d eea13746799a |
|
62 | 62 | rebasing 1:42ccdea3bb16 "B" |
|
63 | 63 | rebasing 2:5fddd98957c8 "C" |
|
64 | 64 | rebasing 3:32af7686d403 "D" |
|
65 | 65 | $ hg log -G |
|
66 | 66 | @ 10:8eeb3c33ad33 D |
|
67 | 67 | | |
|
68 | 68 | o 9:2327fea05063 C |
|
69 | 69 | | |
|
70 | 70 | o 8:e4e5be0395b2 B |
|
71 | 71 | | |
|
72 | 72 | | o 7:02de42196ebe H |
|
73 | 73 | | | |
|
74 | 74 | o | 6:eea13746799a G |
|
75 | 75 | |\| |
|
76 | 76 | | o 5:24b6387c8c8c F |
|
77 | 77 | | | |
|
78 | 78 | o | 4:9520eea781bc E |
|
79 | 79 | |/ |
|
80 | 80 | o 0:cd010b8cd998 A |
|
81 | 81 | |
|
82 | 82 | $ hg log --hidden -G |
|
83 | 83 | @ 10:8eeb3c33ad33 D |
|
84 | 84 | | |
|
85 | 85 | o 9:2327fea05063 C |
|
86 | 86 | | |
|
87 | 87 | o 8:e4e5be0395b2 B |
|
88 | 88 | | |
|
89 | 89 | | o 7:02de42196ebe H |
|
90 | 90 | | | |
|
91 | 91 | o | 6:eea13746799a G |
|
92 | 92 | |\| |
|
93 | 93 | | o 5:24b6387c8c8c F |
|
94 | 94 | | | |
|
95 | 95 | o | 4:9520eea781bc E |
|
96 | 96 | |/ |
|
97 | 97 | | x 3:32af7686d403 D |
|
98 | 98 | | | |
|
99 | 99 | | x 2:5fddd98957c8 C |
|
100 | 100 | | | |
|
101 | 101 | | x 1:42ccdea3bb16 B |
|
102 | 102 | |/ |
|
103 | 103 | o 0:cd010b8cd998 A |
|
104 | 104 | |
|
105 | 105 | $ hg debugobsolete |
|
106 | 106 | 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 e4e5be0395b2cbd471ed22a26b1b6a1a0658a794 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'} |
|
107 | 107 | 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 2327fea05063f39961b14cb69435a9898dc9a245 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'} |
|
108 | 108 | 32af7686d403cf45b5d95f2d70cebea587ac806a 8eeb3c33ad33d452c89e5dcf611c347f978fb42b 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'} |
|
109 | 109 | |
|
110 | 110 | |
|
111 | 111 | $ cd .. |
|
112 | 112 | |
|
113 | 113 | empty changeset |
|
114 | 114 | --------------------------------- |
|
115 | 115 | |
|
116 | 116 | $ hg clone base empty |
|
117 | 117 | updating to branch default |
|
118 | 118 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
119 | 119 | $ cd empty |
|
120 | 120 | $ hg up eea13746799a |
|
121 | 121 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
122 | 122 | |
|
123 | 123 | We make a copy of both the first changeset in the rebased and some other in the |
|
124 | 124 | set. |
|
125 | 125 | |
|
126 | 126 | $ hg graft 42ccdea3bb16 32af7686d403 |
|
127 | 127 | grafting 1:42ccdea3bb16 "B" |
|
128 | 128 | grafting 3:32af7686d403 "D" |
|
129 | 129 | $ hg rebase -s 42ccdea3bb16 -d . |
|
130 | 130 | rebasing 1:42ccdea3bb16 "B" |
|
131 | 131 | note: rebase of 1:42ccdea3bb16 created no changes to commit |
|
132 | 132 | rebasing 2:5fddd98957c8 "C" |
|
133 | 133 | rebasing 3:32af7686d403 "D" |
|
134 | 134 | note: rebase of 3:32af7686d403 created no changes to commit |
|
135 | 135 | $ hg log -G |
|
136 | 136 | o 10:5ae4c968c6ac C |
|
137 | 137 | | |
|
138 | 138 | @ 9:08483444fef9 D |
|
139 | 139 | | |
|
140 | 140 | o 8:8877864f1edb B |
|
141 | 141 | | |
|
142 | 142 | | o 7:02de42196ebe H |
|
143 | 143 | | | |
|
144 | 144 | o | 6:eea13746799a G |
|
145 | 145 | |\| |
|
146 | 146 | | o 5:24b6387c8c8c F |
|
147 | 147 | | | |
|
148 | 148 | o | 4:9520eea781bc E |
|
149 | 149 | |/ |
|
150 | 150 | o 0:cd010b8cd998 A |
|
151 | 151 | |
|
152 | 152 | $ hg log --hidden -G |
|
153 | 153 | o 10:5ae4c968c6ac C |
|
154 | 154 | | |
|
155 | 155 | @ 9:08483444fef9 D |
|
156 | 156 | | |
|
157 | 157 | o 8:8877864f1edb B |
|
158 | 158 | | |
|
159 | 159 | | o 7:02de42196ebe H |
|
160 | 160 | | | |
|
161 | 161 | o | 6:eea13746799a G |
|
162 | 162 | |\| |
|
163 | 163 | | o 5:24b6387c8c8c F |
|
164 | 164 | | | |
|
165 | 165 | o | 4:9520eea781bc E |
|
166 | 166 | |/ |
|
167 | 167 | | x 3:32af7686d403 D |
|
168 | 168 | | | |
|
169 | 169 | | x 2:5fddd98957c8 C |
|
170 | 170 | | | |
|
171 | 171 | | x 1:42ccdea3bb16 B |
|
172 | 172 | |/ |
|
173 | 173 | o 0:cd010b8cd998 A |
|
174 | 174 | |
|
175 | 175 | $ hg debugobsolete |
|
176 | 176 | 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'} |
|
177 | 177 | 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'} |
|
178 | 178 | 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'} |
|
179 | 179 | |
|
180 | 180 | |
|
181 | 181 | More complex case where part of the rebase set were already rebased |
|
182 | 182 | |
|
183 | 183 | $ hg rebase --rev 'desc(D)' --dest 'desc(H)' |
|
184 | 184 | rebasing 9:08483444fef9 "D" |
|
185 | 185 | $ hg debugobsolete |
|
186 | 186 | 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'} |
|
187 | 187 | 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'} |
|
188 | 188 | 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'} |
|
189 | 189 | 08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'} |
|
190 | 190 | $ hg log -G |
|
191 | 191 | @ 11:4596109a6a43 D |
|
192 | 192 | | |
|
193 | 193 | | o 10:5ae4c968c6ac C |
|
194 | 194 | | | |
|
195 | 195 | | x 9:08483444fef9 D |
|
196 | 196 | | | |
|
197 | 197 | | o 8:8877864f1edb B |
|
198 | 198 | | | |
|
199 | 199 | o | 7:02de42196ebe H |
|
200 | 200 | | | |
|
201 | 201 | | o 6:eea13746799a G |
|
202 | 202 | |/| |
|
203 | 203 | o | 5:24b6387c8c8c F |
|
204 | 204 | | | |
|
205 | 205 | | o 4:9520eea781bc E |
|
206 | 206 | |/ |
|
207 | 207 | o 0:cd010b8cd998 A |
|
208 | 208 | |
|
209 | 209 | $ hg rebase --source 'desc(B)' --dest 'tip' --config experimental.rebaseskipobsolete=True |
|
210 | 210 | rebasing 8:8877864f1edb "B" |
|
211 | 211 | note: not rebasing 9:08483444fef9 "D", already in destination as 11:4596109a6a43 "D" (tip) |
|
212 | 212 | rebasing 10:5ae4c968c6ac "C" |
|
213 | 213 | $ hg debugobsolete |
|
214 | 214 | 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'} |
|
215 | 215 | 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'} |
|
216 | 216 | 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'} |
|
217 | 217 | 08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'} |
|
218 | 218 | 8877864f1edb05d0e07dc4ba77b67a80a7b86672 462a34d07e599b87ea08676a449373fe4e2e1347 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'} |
|
219 | 219 | 5ae4c968c6aca831df823664e706c9d4aa34473d 98f6af4ee9539e14da4465128f894c274900b6e5 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'} |
|
220 | 220 | $ hg log --rev 'contentdivergent()' |
|
221 | 221 | $ hg log -G |
|
222 | 222 | o 13:98f6af4ee953 C |
|
223 | 223 | | |
|
224 | 224 | o 12:462a34d07e59 B |
|
225 | 225 | | |
|
226 | 226 | @ 11:4596109a6a43 D |
|
227 | 227 | | |
|
228 | 228 | o 7:02de42196ebe H |
|
229 | 229 | | |
|
230 | 230 | | o 6:eea13746799a G |
|
231 | 231 | |/| |
|
232 | 232 | o | 5:24b6387c8c8c F |
|
233 | 233 | | | |
|
234 | 234 | | o 4:9520eea781bc E |
|
235 | 235 | |/ |
|
236 | 236 | o 0:cd010b8cd998 A |
|
237 | 237 | |
|
238 | 238 | $ hg log --style default --debug -r 4596109a6a4328c398bde3a4a3b6737cfade3003 |
|
239 | 239 | changeset: 11:4596109a6a4328c398bde3a4a3b6737cfade3003 |
|
240 | 240 | phase: draft |
|
241 | 241 | parent: 7:02de42196ebee42ef284b6780a87cdc96e8eaab6 |
|
242 | 242 | parent: -1:0000000000000000000000000000000000000000 |
|
243 | 243 | manifest: 11:a91006e3a02f1edf631f7018e6e5684cf27dd905 |
|
244 | 244 | user: Nicolas Dumazet <nicdumz.commits@gmail.com> |
|
245 | 245 | date: Sat Apr 30 15:24:48 2011 +0200 |
|
246 | 246 | files+: D |
|
247 | 247 | extra: branch=default |
|
248 | 248 | extra: rebase_source=08483444fef91d6224f6655ee586a65d263ad34c |
|
249 | 249 | extra: source=32af7686d403cf45b5d95f2d70cebea587ac806a |
|
250 | 250 | description: |
|
251 | 251 | D |
|
252 | 252 | |
|
253 | 253 | |
|
254 | 254 | $ hg up -qr 'desc(G)' |
|
255 | 255 | $ hg graft 4596109a6a4328c398bde3a4a3b6737cfade3003 |
|
256 | 256 | grafting 11:4596109a6a43 "D" |
|
257 | 257 | $ hg up -qr 'desc(E)' |
|
258 | 258 | $ hg rebase -s tip -d . |
|
259 | 259 | rebasing 14:9e36056a46e3 "D" (tip) |
|
260 | 260 | $ hg log --style default --debug -r tip |
|
261 | 261 | changeset: 15:627d4614809036ba22b9e7cb31638ddc06ab99ab |
|
262 | 262 | tag: tip |
|
263 | 263 | phase: draft |
|
264 | 264 | parent: 4:9520eea781bcca16c1e15acc0ba14335a0e8e5ba |
|
265 | 265 | parent: -1:0000000000000000000000000000000000000000 |
|
266 | 266 | manifest: 15:648e8ede73ae3e497d093d3a4c8fcc2daa864f42 |
|
267 | 267 | user: Nicolas Dumazet <nicdumz.commits@gmail.com> |
|
268 | 268 | date: Sat Apr 30 15:24:48 2011 +0200 |
|
269 | 269 | files+: D |
|
270 | 270 | extra: branch=default |
|
271 | 271 | extra: intermediate-source=4596109a6a4328c398bde3a4a3b6737cfade3003 |
|
272 | 272 | extra: rebase_source=9e36056a46e37c9776168c7375734eebc70e294f |
|
273 | 273 | extra: source=32af7686d403cf45b5d95f2d70cebea587ac806a |
|
274 | 274 | description: |
|
275 | 275 | D |
|
276 | 276 | |
|
277 | 277 | |
|
278 | 278 | Start rebase from a commit that is obsolete but not hidden only because it's |
|
279 | 279 | a working copy parent. We should be moved back to the starting commit as usual |
|
280 | 280 | even though it is hidden (until we're moved there). |
|
281 | 281 | |
|
282 | 282 | $ hg --hidden up -qr 'first(hidden())' |
|
283 | 283 | $ hg rebase --rev 13 --dest 15 |
|
284 | 284 | rebasing 13:98f6af4ee953 "C" |
|
285 | 285 | $ hg log -G |
|
286 | 286 | o 16:294a2b93eb4d C |
|
287 | 287 | | |
|
288 | 288 | o 15:627d46148090 D |
|
289 | 289 | | |
|
290 | 290 | | o 12:462a34d07e59 B |
|
291 | 291 | | | |
|
292 | 292 | | o 11:4596109a6a43 D |
|
293 | 293 | | | |
|
294 | 294 | | o 7:02de42196ebe H |
|
295 | 295 | | | |
|
296 | 296 | +---o 6:eea13746799a G |
|
297 | 297 | | |/ |
|
298 | 298 | | o 5:24b6387c8c8c F |
|
299 | 299 | | | |
|
300 | 300 | o | 4:9520eea781bc E |
|
301 | 301 | |/ |
|
302 | 302 | | @ 1:42ccdea3bb16 B |
|
303 | 303 | |/ |
|
304 | 304 | o 0:cd010b8cd998 A |
|
305 | 305 | |
|
306 | 306 | |
|
307 | 307 | $ cd .. |
|
308 | 308 | |
|
309 | 309 | collapse rebase |
|
310 | 310 | --------------------------------- |
|
311 | 311 | |
|
312 | 312 | $ hg clone base collapse |
|
313 | 313 | updating to branch default |
|
314 | 314 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
315 | 315 | $ cd collapse |
|
316 | 316 | $ hg rebase -s 42ccdea3bb16 -d eea13746799a --collapse |
|
317 | 317 | rebasing 1:42ccdea3bb16 "B" |
|
318 | 318 | rebasing 2:5fddd98957c8 "C" |
|
319 | 319 | rebasing 3:32af7686d403 "D" |
|
320 | 320 | $ hg log -G |
|
321 | 321 | o 8:4dc2197e807b Collapsed revision |
|
322 | 322 | | |
|
323 | 323 | | @ 7:02de42196ebe H |
|
324 | 324 | | | |
|
325 | 325 | o | 6:eea13746799a G |
|
326 | 326 | |\| |
|
327 | 327 | | o 5:24b6387c8c8c F |
|
328 | 328 | | | |
|
329 | 329 | o | 4:9520eea781bc E |
|
330 | 330 | |/ |
|
331 | 331 | o 0:cd010b8cd998 A |
|
332 | 332 | |
|
333 | 333 | $ hg log --hidden -G |
|
334 | 334 | o 8:4dc2197e807b Collapsed revision |
|
335 | 335 | | |
|
336 | 336 | | @ 7:02de42196ebe H |
|
337 | 337 | | | |
|
338 | 338 | o | 6:eea13746799a G |
|
339 | 339 | |\| |
|
340 | 340 | | o 5:24b6387c8c8c F |
|
341 | 341 | | | |
|
342 | 342 | o | 4:9520eea781bc E |
|
343 | 343 | |/ |
|
344 | 344 | | x 3:32af7686d403 D |
|
345 | 345 | | | |
|
346 | 346 | | x 2:5fddd98957c8 C |
|
347 | 347 | | | |
|
348 | 348 | | x 1:42ccdea3bb16 B |
|
349 | 349 | |/ |
|
350 | 350 | o 0:cd010b8cd998 A |
|
351 | 351 | |
|
352 | 352 | $ hg id --debug -r tip |
|
353 | 353 | 4dc2197e807bae9817f09905b50ab288be2dbbcf tip |
|
354 | 354 | $ hg debugobsolete |
|
355 | 355 | 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'} |
|
356 | 356 | 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'} |
|
357 | 357 | 32af7686d403cf45b5d95f2d70cebea587ac806a 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'} |
|
358 | 358 | |
|
359 | 359 | $ cd .. |
|
360 | 360 | |
|
361 | 361 | Rebase set has hidden descendants |
|
362 | 362 | --------------------------------- |
|
363 | 363 | |
|
364 | 364 | We rebase a changeset which has a hidden changeset. The hidden changeset must |
|
365 | 365 | not be rebased. |
|
366 | 366 | |
|
367 | 367 | $ hg clone base hidden |
|
368 | 368 | updating to branch default |
|
369 | 369 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
370 | 370 | $ cd hidden |
|
371 | 371 | $ hg rebase -s 5fddd98957c8 -d eea13746799a |
|
372 | 372 | rebasing 2:5fddd98957c8 "C" |
|
373 | 373 | rebasing 3:32af7686d403 "D" |
|
374 | 374 | $ hg rebase -s 42ccdea3bb16 -d 02de42196ebe |
|
375 | 375 | rebasing 1:42ccdea3bb16 "B" |
|
376 | 376 | $ hg log -G |
|
377 | 377 | o 10:7c6027df6a99 B |
|
378 | 378 | | |
|
379 | 379 | | o 9:cf44d2f5a9f4 D |
|
380 | 380 | | | |
|
381 | 381 | | o 8:e273c5e7d2d2 C |
|
382 | 382 | | | |
|
383 | 383 | @ | 7:02de42196ebe H |
|
384 | 384 | | | |
|
385 | 385 | | o 6:eea13746799a G |
|
386 | 386 | |/| |
|
387 | 387 | o | 5:24b6387c8c8c F |
|
388 | 388 | | | |
|
389 | 389 | | o 4:9520eea781bc E |
|
390 | 390 | |/ |
|
391 | 391 | o 0:cd010b8cd998 A |
|
392 | 392 | |
|
393 | 393 | $ hg log --hidden -G |
|
394 | 394 | o 10:7c6027df6a99 B |
|
395 | 395 | | |
|
396 | 396 | | o 9:cf44d2f5a9f4 D |
|
397 | 397 | | | |
|
398 | 398 | | o 8:e273c5e7d2d2 C |
|
399 | 399 | | | |
|
400 | 400 | @ | 7:02de42196ebe H |
|
401 | 401 | | | |
|
402 | 402 | | o 6:eea13746799a G |
|
403 | 403 | |/| |
|
404 | 404 | o | 5:24b6387c8c8c F |
|
405 | 405 | | | |
|
406 | 406 | | o 4:9520eea781bc E |
|
407 | 407 | |/ |
|
408 | 408 | | x 3:32af7686d403 D |
|
409 | 409 | | | |
|
410 | 410 | | x 2:5fddd98957c8 C |
|
411 | 411 | | | |
|
412 | 412 | | x 1:42ccdea3bb16 B |
|
413 | 413 | |/ |
|
414 | 414 | o 0:cd010b8cd998 A |
|
415 | 415 | |
|
416 | 416 | $ hg debugobsolete |
|
417 | 417 | 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b e273c5e7d2d29df783dce9f9eaa3ac4adc69c15d 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'} |
|
418 | 418 | 32af7686d403cf45b5d95f2d70cebea587ac806a cf44d2f5a9f4297a62be94cbdd3dff7c7dc54258 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'} |
|
419 | 419 | 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 7c6027df6a99d93f461868e5433f63bde20b6dfb 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'} |
|
420 | 420 | |
|
421 | 421 | Test that rewriting leaving instability behind is allowed |
|
422 | 422 | --------------------------------------------------------------------- |
|
423 | 423 | |
|
424 | 424 | $ hg log -r 'children(8)' |
|
425 | 425 | 9:cf44d2f5a9f4 D (no-eol) |
|
426 | 426 | $ hg rebase -r 8 |
|
427 | 427 | rebasing 8:e273c5e7d2d2 "C" |
|
428 | 428 | $ hg log -G |
|
429 | 429 | o 11:0d8f238b634c C |
|
430 | 430 | | |
|
431 | 431 | o 10:7c6027df6a99 B |
|
432 | 432 | | |
|
433 | 433 | | o 9:cf44d2f5a9f4 D |
|
434 | 434 | | | |
|
435 | 435 | | x 8:e273c5e7d2d2 C |
|
436 | 436 | | | |
|
437 | 437 | @ | 7:02de42196ebe H |
|
438 | 438 | | | |
|
439 | 439 | | o 6:eea13746799a G |
|
440 | 440 | |/| |
|
441 | 441 | o | 5:24b6387c8c8c F |
|
442 | 442 | | | |
|
443 | 443 | | o 4:9520eea781bc E |
|
444 | 444 | |/ |
|
445 | 445 | o 0:cd010b8cd998 A |
|
446 | 446 | |
|
447 | 447 | |
|
448 | 448 | |
|
449 | 449 | Test multiple root handling |
|
450 | 450 | ------------------------------------ |
|
451 | 451 | |
|
452 | 452 | $ hg rebase --dest 4 --rev '7+11+9' |
|
453 | 453 | rebasing 9:cf44d2f5a9f4 "D" |
|
454 | 454 | rebasing 7:02de42196ebe "H" |
|
455 | 455 | rebasing 11:0d8f238b634c "C" (tip) |
|
456 | 456 | $ hg log -G |
|
457 | 457 | o 14:1e8370e38cca C |
|
458 | 458 | | |
|
459 | 459 | @ 13:bfe264faf697 H |
|
460 | 460 | | |
|
461 | 461 | | o 12:102b4c1d889b D |
|
462 | 462 | |/ |
|
463 | 463 | | o 10:7c6027df6a99 B |
|
464 | 464 | | | |
|
465 | 465 | | x 7:02de42196ebe H |
|
466 | 466 | | | |
|
467 | 467 | +---o 6:eea13746799a G |
|
468 | 468 | | |/ |
|
469 | 469 | | o 5:24b6387c8c8c F |
|
470 | 470 | | | |
|
471 | 471 | o | 4:9520eea781bc E |
|
472 | 472 | |/ |
|
473 | 473 | o 0:cd010b8cd998 A |
|
474 | 474 | |
|
475 | 475 | $ cd .. |
|
476 | 476 | |
|
477 | 477 | Detach both parents |
|
478 | 478 | |
|
479 | 479 | $ hg init double-detach |
|
480 | 480 | $ cd double-detach |
|
481 | 481 | |
|
482 | 482 | $ hg debugdrawdag <<EOF |
|
483 | 483 | > F |
|
484 | 484 | > /| |
|
485 | 485 | > C E |
|
486 | 486 | > | | |
|
487 | 487 | > B D G |
|
488 | 488 | > \|/ |
|
489 | 489 | > A |
|
490 | 490 | > EOF |
|
491 | 491 | |
|
492 | 492 | $ hg rebase -d G -r 'B + D + F' |
|
493 | 493 | rebasing 1:112478962961 "B" (B) |
|
494 | 494 | rebasing 2:b18e25de2cf5 "D" (D) |
|
495 | 495 | rebasing 6:f15c3adaf214 "F" (F tip) |
|
496 | 496 | abort: cannot rebase 6:f15c3adaf214 without moving at least one of its parents |
|
497 | 497 | [255] |
|
498 | 498 | |
|
499 | 499 | $ cd .. |
|
500 | 500 | |
|
501 | 501 | test on rebase dropping a merge |
|
502 | 502 | |
|
503 | 503 | (setup) |
|
504 | 504 | |
|
505 | 505 | $ hg init dropmerge |
|
506 | 506 | $ cd dropmerge |
|
507 | 507 | $ hg unbundle "$TESTDIR/bundles/rebase.hg" |
|
508 | 508 | adding changesets |
|
509 | 509 | adding manifests |
|
510 | 510 | adding file changes |
|
511 | 511 | added 8 changesets with 7 changes to 7 files (+2 heads) |
|
512 | 512 | new changesets cd010b8cd998:02de42196ebe |
|
513 | 513 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
514 | 514 | $ hg up 3 |
|
515 | 515 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
516 | 516 | $ hg merge 7 |
|
517 | 517 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
518 | 518 | (branch merge, don't forget to commit) |
|
519 | 519 | $ hg ci -m 'M' |
|
520 | 520 | $ echo I > I |
|
521 | 521 | $ hg add I |
|
522 | 522 | $ hg ci -m I |
|
523 | 523 | $ hg log -G |
|
524 | 524 | @ 9:4bde274eefcf I |
|
525 | 525 | | |
|
526 | 526 | o 8:53a6a128b2b7 M |
|
527 | 527 | |\ |
|
528 | 528 | | o 7:02de42196ebe H |
|
529 | 529 | | | |
|
530 | 530 | | | o 6:eea13746799a G |
|
531 | 531 | | |/| |
|
532 | 532 | | o | 5:24b6387c8c8c F |
|
533 | 533 | | | | |
|
534 | 534 | | | o 4:9520eea781bc E |
|
535 | 535 | | |/ |
|
536 | 536 | o | 3:32af7686d403 D |
|
537 | 537 | | | |
|
538 | 538 | o | 2:5fddd98957c8 C |
|
539 | 539 | | | |
|
540 | 540 | o | 1:42ccdea3bb16 B |
|
541 | 541 | |/ |
|
542 | 542 | o 0:cd010b8cd998 A |
|
543 | 543 | |
|
544 | 544 | (actual test) |
|
545 | 545 | |
|
546 | 546 | $ hg rebase --dest 6 --rev '((desc(H) + desc(D))::) - desc(M)' |
|
547 | 547 | rebasing 3:32af7686d403 "D" |
|
548 | 548 | rebasing 7:02de42196ebe "H" |
|
549 | 549 | rebasing 9:4bde274eefcf "I" (tip) |
|
550 | 550 | $ hg log -G |
|
551 | 551 | @ 12:acd174b7ab39 I |
|
552 | 552 | | |
|
553 | 553 | o 11:6c11a6218c97 H |
|
554 | 554 | | |
|
555 | 555 | | o 10:b5313c85b22e D |
|
556 | 556 | |/ |
|
557 | 557 | | o 8:53a6a128b2b7 M |
|
558 | 558 | | |\ |
|
559 | 559 | | | x 7:02de42196ebe H |
|
560 | 560 | | | | |
|
561 | 561 | o---+ 6:eea13746799a G |
|
562 | 562 | | | | |
|
563 | 563 | | | o 5:24b6387c8c8c F |
|
564 | 564 | | | | |
|
565 | 565 | o---+ 4:9520eea781bc E |
|
566 | 566 | / / |
|
567 | 567 | x | 3:32af7686d403 D |
|
568 | 568 | | | |
|
569 | 569 | o | 2:5fddd98957c8 C |
|
570 | 570 | | | |
|
571 | 571 | o | 1:42ccdea3bb16 B |
|
572 | 572 | |/ |
|
573 | 573 | o 0:cd010b8cd998 A |
|
574 | 574 | |
|
575 | 575 | |
|
576 | 576 | Test hidden changesets in the rebase set (issue4504) |
|
577 | 577 | |
|
578 | 578 | $ hg up --hidden 9 |
|
579 | 579 | 3 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
580 | 580 | $ echo J > J |
|
581 | 581 | $ hg add J |
|
582 | 582 | $ hg commit -m J |
|
583 | 583 | $ hg debugobsolete `hg log --rev . -T '{node}'` |
|
584 | 584 | obsoleted 1 changesets |
|
585 | 585 | |
|
586 | 586 | $ hg rebase --rev .~1::. --dest 'max(desc(D))' --traceback --config experimental.rebaseskipobsolete=off |
|
587 | 587 | rebasing 9:4bde274eefcf "I" |
|
588 | 588 | rebasing 13:06edfc82198f "J" (tip) |
|
589 | 589 | $ hg log -G |
|
590 | 590 | @ 15:5ae8a643467b J |
|
591 | 591 | | |
|
592 | 592 | o 14:9ad579b4a5de I |
|
593 | 593 | | |
|
594 | 594 | | o 12:acd174b7ab39 I |
|
595 | 595 | | | |
|
596 | 596 | | o 11:6c11a6218c97 H |
|
597 | 597 | | | |
|
598 | 598 | o | 10:b5313c85b22e D |
|
599 | 599 | |/ |
|
600 | 600 | | o 8:53a6a128b2b7 M |
|
601 | 601 | | |\ |
|
602 | 602 | | | x 7:02de42196ebe H |
|
603 | 603 | | | | |
|
604 | 604 | o---+ 6:eea13746799a G |
|
605 | 605 | | | | |
|
606 | 606 | | | o 5:24b6387c8c8c F |
|
607 | 607 | | | | |
|
608 | 608 | o---+ 4:9520eea781bc E |
|
609 | 609 | / / |
|
610 | 610 | x | 3:32af7686d403 D |
|
611 | 611 | | | |
|
612 | 612 | o | 2:5fddd98957c8 C |
|
613 | 613 | | | |
|
614 | 614 | o | 1:42ccdea3bb16 B |
|
615 | 615 | |/ |
|
616 | 616 | o 0:cd010b8cd998 A |
|
617 | 617 | |
|
618 | 618 | $ hg up 14 -C |
|
619 | 619 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
620 | 620 | $ echo "K" > K |
|
621 | 621 | $ hg add K |
|
622 | 622 | $ hg commit --amend -m "K" |
|
623 | 623 | $ echo "L" > L |
|
624 | 624 | $ hg add L |
|
625 | 625 | $ hg commit -m "L" |
|
626 | 626 | $ hg up '.^' |
|
627 | 627 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
628 | 628 | $ echo "M" > M |
|
629 | 629 | $ hg add M |
|
630 | 630 | $ hg commit --amend -m "M" |
|
631 | 631 | $ hg log -G |
|
632 | 632 | @ 18:bfaedf8eb73b M |
|
633 | 633 | | |
|
634 | 634 | | o 17:97219452e4bd L |
|
635 | 635 | | | |
|
636 | 636 | | x 16:fc37a630c901 K |
|
637 | 637 | |/ |
|
638 | 638 | | o 15:5ae8a643467b J |
|
639 | 639 | | | |
|
640 | 640 | | x 14:9ad579b4a5de I |
|
641 | 641 | |/ |
|
642 | 642 | | o 12:acd174b7ab39 I |
|
643 | 643 | | | |
|
644 | 644 | | o 11:6c11a6218c97 H |
|
645 | 645 | | | |
|
646 | 646 | o | 10:b5313c85b22e D |
|
647 | 647 | |/ |
|
648 | 648 | | o 8:53a6a128b2b7 M |
|
649 | 649 | | |\ |
|
650 | 650 | | | x 7:02de42196ebe H |
|
651 | 651 | | | | |
|
652 | 652 | o---+ 6:eea13746799a G |
|
653 | 653 | | | | |
|
654 | 654 | | | o 5:24b6387c8c8c F |
|
655 | 655 | | | | |
|
656 | 656 | o---+ 4:9520eea781bc E |
|
657 | 657 | / / |
|
658 | 658 | x | 3:32af7686d403 D |
|
659 | 659 | | | |
|
660 | 660 | o | 2:5fddd98957c8 C |
|
661 | 661 | | | |
|
662 | 662 | o | 1:42ccdea3bb16 B |
|
663 | 663 | |/ |
|
664 | 664 | o 0:cd010b8cd998 A |
|
665 | 665 | |
|
666 | 666 | $ hg rebase -s 14 -d 17 --config experimental.rebaseskipobsolete=True |
|
667 | 667 | note: not rebasing 14:9ad579b4a5de "I", already in destination as 16:fc37a630c901 "K" |
|
668 | 668 | rebasing 15:5ae8a643467b "J" |
|
669 | 669 | |
|
670 | 670 | $ cd .. |
|
671 | 671 | |
|
672 | 672 | Skip obsolete changeset even with multiple hops |
|
673 | 673 | ----------------------------------------------- |
|
674 | 674 | |
|
675 | 675 | setup |
|
676 | 676 | |
|
677 | 677 | $ hg init obsskip |
|
678 | 678 | $ cd obsskip |
|
679 | 679 | $ cat << EOF >> .hg/hgrc |
|
680 | 680 | > [experimental] |
|
681 | 681 | > rebaseskipobsolete = True |
|
682 | 682 | > [extensions] |
|
683 | 683 | > strip = |
|
684 | 684 | > EOF |
|
685 | 685 | $ echo A > A |
|
686 | 686 | $ hg add A |
|
687 | 687 | $ hg commit -m A |
|
688 | 688 | $ echo B > B |
|
689 | 689 | $ hg add B |
|
690 | 690 | $ hg commit -m B0 |
|
691 | 691 | $ hg commit --amend -m B1 |
|
692 | 692 | $ hg commit --amend -m B2 |
|
693 | 693 | $ hg up --hidden 'desc(B0)' |
|
694 | 694 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
695 | 695 | $ echo C > C |
|
696 | 696 | $ hg add C |
|
697 | 697 | $ hg commit -m C |
|
698 | 698 | |
|
699 | 699 | Rebase finds its way in a chain of marker |
|
700 | 700 | |
|
701 | 701 | $ hg rebase -d 'desc(B2)' |
|
702 | 702 | note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 3:261e70097290 "B2" |
|
703 | 703 | rebasing 4:212cb178bcbb "C" (tip) |
|
704 | 704 | |
|
705 | 705 | Even when the chain include missing node |
|
706 | 706 | |
|
707 | 707 | $ hg up --hidden 'desc(B0)' |
|
708 | 708 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
709 | 709 | $ echo D > D |
|
710 | 710 | $ hg add D |
|
711 | 711 | $ hg commit -m D |
|
712 | 712 | $ hg --hidden strip -r 'desc(B1)' |
|
713 | 713 | saved backup bundle to $TESTTMP/obsskip/.hg/strip-backup/86f6414ccda7-b1c452ee-backup.hg (glob) |
|
714 | 714 | |
|
715 | 715 | $ hg rebase -d 'desc(B2)' |
|
716 | 716 | note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 2:261e70097290 "B2" |
|
717 | 717 | rebasing 5:1a79b7535141 "D" (tip) |
|
718 | 718 | $ hg up 4 |
|
719 | 719 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
720 | 720 | $ echo "O" > O |
|
721 | 721 | $ hg add O |
|
722 | 722 | $ hg commit -m O |
|
723 | 723 | $ echo "P" > P |
|
724 | 724 | $ hg add P |
|
725 | 725 | $ hg commit -m P |
|
726 | 726 | $ hg log -G |
|
727 | 727 | @ 8:8d47583e023f P |
|
728 | 728 | | |
|
729 | 729 | o 7:360bbaa7d3ce O |
|
730 | 730 | | |
|
731 | 731 | | o 6:9c48361117de D |
|
732 | 732 | | | |
|
733 | 733 | o | 4:ff2c4d47b71d C |
|
734 | 734 | |/ |
|
735 | 735 | o 2:261e70097290 B2 |
|
736 | 736 | | |
|
737 | 737 | o 0:4a2df7238c3b A |
|
738 | 738 | |
|
739 | 739 | $ hg debugobsolete `hg log -r 7 -T '{node}\n'` --config experimental.evolution=true |
|
740 | 740 | obsoleted 1 changesets |
|
741 | 741 | $ hg rebase -d 6 -r "4::" |
|
742 | 742 | rebasing 4:ff2c4d47b71d "C" |
|
743 | 743 | note: not rebasing 7:360bbaa7d3ce "O", it has no successor |
|
744 | 744 | rebasing 8:8d47583e023f "P" (tip) |
|
745 | 745 | |
|
746 | 746 | If all the changeset to be rebased are obsolete and present in the destination, we |
|
747 | 747 | should display a friendly error message |
|
748 | 748 | |
|
749 | 749 | $ hg log -G |
|
750 | 750 | @ 10:121d9e3bc4c6 P |
|
751 | 751 | | |
|
752 | 752 | o 9:4be60e099a77 C |
|
753 | 753 | | |
|
754 | 754 | o 6:9c48361117de D |
|
755 | 755 | | |
|
756 | 756 | o 2:261e70097290 B2 |
|
757 | 757 | | |
|
758 | 758 | o 0:4a2df7238c3b A |
|
759 | 759 | |
|
760 | 760 | |
|
761 | 761 | $ hg up 9 |
|
762 | 762 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
763 | 763 | $ echo "non-relevant change" > nonrelevant |
|
764 | 764 | $ hg add nonrelevant |
|
765 | 765 | $ hg commit -m nonrelevant |
|
766 | 766 | created new head |
|
767 | 767 | $ hg debugobsolete `hg log -r 11 -T '{node}\n'` --config experimental.evolution=true |
|
768 | 768 | obsoleted 1 changesets |
|
769 | 769 | $ hg rebase -r . -d 10 |
|
770 | 770 | note: not rebasing 11:f44da1f4954c "nonrelevant" (tip), it has no successor |
|
771 | 771 | |
|
772 | 772 | If a rebase is going to create divergence, it should abort |
|
773 | 773 | |
|
774 | 774 | $ hg log -G |
|
775 | 775 | @ 10:121d9e3bc4c6 P |
|
776 | 776 | | |
|
777 | 777 | o 9:4be60e099a77 C |
|
778 | 778 | | |
|
779 | 779 | o 6:9c48361117de D |
|
780 | 780 | | |
|
781 | 781 | o 2:261e70097290 B2 |
|
782 | 782 | | |
|
783 | 783 | o 0:4a2df7238c3b A |
|
784 | 784 | |
|
785 | 785 | |
|
786 | 786 | $ hg up 9 |
|
787 | 787 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
788 | 788 | $ echo "john" > doe |
|
789 | 789 | $ hg add doe |
|
790 | 790 | $ hg commit -m "john doe" |
|
791 | 791 | created new head |
|
792 | 792 | $ hg up 10 |
|
793 | 793 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
794 | 794 | $ echo "foo" > bar |
|
795 | 795 | $ hg add bar |
|
796 | 796 | $ hg commit --amend -m "10'" |
|
797 | 797 | $ hg up 10 --hidden |
|
798 | 798 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
799 | 799 | $ echo "bar" > foo |
|
800 | 800 | $ hg add foo |
|
801 | 801 | $ hg commit -m "bar foo" |
|
802 | 802 | $ hg log -G |
|
803 | 803 | @ 14:73568ab6879d bar foo |
|
804 | 804 | | |
|
805 | 805 | | o 13:77d874d096a2 10' |
|
806 | 806 | | | |
|
807 | 807 | | | o 12:3eb461388009 john doe |
|
808 | 808 | | |/ |
|
809 | 809 | x | 10:121d9e3bc4c6 P |
|
810 | 810 | |/ |
|
811 | 811 | o 9:4be60e099a77 C |
|
812 | 812 | | |
|
813 | 813 | o 6:9c48361117de D |
|
814 | 814 | | |
|
815 | 815 | o 2:261e70097290 B2 |
|
816 | 816 | | |
|
817 | 817 | o 0:4a2df7238c3b A |
|
818 | 818 | |
|
819 | 819 | $ hg summary |
|
820 | 820 | parent: 14:73568ab6879d tip (orphan) |
|
821 | 821 | bar foo |
|
822 | 822 | branch: default |
|
823 | 823 | commit: (clean) |
|
824 | 824 | update: 2 new changesets, 3 branch heads (merge) |
|
825 | 825 | phases: 8 draft |
|
826 | 826 | orphan: 1 changesets |
|
827 | 827 | $ hg rebase -s 10 -d 12 |
|
828 | 828 | abort: this rebase will cause divergences from: 121d9e3bc4c6 |
|
829 | 829 | (to force the rebase please set experimental.allowdivergence=True) |
|
830 | 830 | [255] |
|
831 | 831 | $ hg log -G |
|
832 | 832 | @ 14:73568ab6879d bar foo |
|
833 | 833 | | |
|
834 | 834 | | o 13:77d874d096a2 10' |
|
835 | 835 | | | |
|
836 | 836 | | | o 12:3eb461388009 john doe |
|
837 | 837 | | |/ |
|
838 | 838 | x | 10:121d9e3bc4c6 P |
|
839 | 839 | |/ |
|
840 | 840 | o 9:4be60e099a77 C |
|
841 | 841 | | |
|
842 | 842 | o 6:9c48361117de D |
|
843 | 843 | | |
|
844 | 844 | o 2:261e70097290 B2 |
|
845 | 845 | | |
|
846 | 846 | o 0:4a2df7238c3b A |
|
847 | 847 | |
|
848 | 848 | With experimental.allowdivergence=True, rebase can create divergence |
|
849 | 849 | |
|
850 | 850 | $ hg rebase -s 10 -d 12 --config experimental.allowdivergence=True |
|
851 | 851 | rebasing 10:121d9e3bc4c6 "P" |
|
852 | 852 | rebasing 14:73568ab6879d "bar foo" (tip) |
|
853 | 853 | $ hg summary |
|
854 | 854 | parent: 16:61bd55f69bc4 tip |
|
855 | 855 | bar foo |
|
856 | 856 | branch: default |
|
857 | 857 | commit: (clean) |
|
858 | 858 | update: 1 new changesets, 2 branch heads (merge) |
|
859 | 859 | phases: 8 draft |
|
860 | 860 | content-divergent: 2 changesets |
|
861 | 861 | |
|
862 | 862 | rebase --continue + skipped rev because their successors are in destination |
|
863 | 863 | we make a change in trunk and work on conflicting changes to make rebase abort. |
|
864 | 864 | |
|
865 | 865 | $ hg log -G -r 16:: |
|
866 | 866 | @ 16:61bd55f69bc4 bar foo |
|
867 | 867 | | |
|
868 | 868 | ~ |
|
869 | 869 | |
|
870 | 870 | Create the two changes in trunk |
|
871 | 871 | $ printf "a" > willconflict |
|
872 | 872 | $ hg add willconflict |
|
873 | 873 | $ hg commit -m "willconflict first version" |
|
874 | 874 | |
|
875 | 875 | $ printf "dummy" > C |
|
876 | 876 | $ hg commit -m "dummy change successor" |
|
877 | 877 | |
|
878 | 878 | Create the changes that we will rebase |
|
879 | 879 | $ hg update -C 16 -q |
|
880 | 880 | $ printf "b" > willconflict |
|
881 | 881 | $ hg add willconflict |
|
882 | 882 | $ hg commit -m "willconflict second version" |
|
883 | 883 | created new head |
|
884 | 884 | $ printf "dummy" > K |
|
885 | 885 | $ hg add K |
|
886 | 886 | $ hg commit -m "dummy change" |
|
887 | 887 | $ printf "dummy" > L |
|
888 | 888 | $ hg add L |
|
889 | 889 | $ hg commit -m "dummy change" |
|
890 | 890 | $ hg debugobsolete `hg log -r ".^" -T '{node}'` `hg log -r 18 -T '{node}'` --config experimental.evolution=true |
|
891 | 891 | obsoleted 1 changesets |
|
892 | 892 | |
|
893 | 893 | $ hg log -G -r 16:: |
|
894 | 894 | @ 21:7bdc8a87673d dummy change |
|
895 | 895 | | |
|
896 | 896 | x 20:8b31da3c4919 dummy change |
|
897 | 897 | | |
|
898 | 898 | o 19:b82fb57ea638 willconflict second version |
|
899 | 899 | | |
|
900 | 900 | | o 18:601db7a18f51 dummy change successor |
|
901 | 901 | | | |
|
902 | 902 | | o 17:357ddf1602d5 willconflict first version |
|
903 | 903 | |/ |
|
904 | 904 | o 16:61bd55f69bc4 bar foo |
|
905 | 905 | | |
|
906 | 906 | ~ |
|
907 | 907 | $ hg rebase -r ".^^ + .^ + ." -d 18 |
|
908 | 908 | rebasing 19:b82fb57ea638 "willconflict second version" |
|
909 | 909 | merging willconflict |
|
910 | 910 | warning: conflicts while merging willconflict! (edit, then use 'hg resolve --mark') |
|
911 | 911 | unresolved conflicts (see hg resolve, then hg rebase --continue) |
|
912 | 912 | [1] |
|
913 | 913 | |
|
914 | 914 | $ hg resolve --mark willconflict |
|
915 | 915 | (no more unresolved files) |
|
916 | 916 | continue: hg rebase --continue |
|
917 | 917 | $ hg rebase --continue |
|
918 | 918 | rebasing 19:b82fb57ea638 "willconflict second version" |
|
919 | 919 | note: not rebasing 20:8b31da3c4919 "dummy change", already in destination as 18:601db7a18f51 "dummy change successor" |
|
920 | 920 | rebasing 21:7bdc8a87673d "dummy change" (tip) |
|
921 | 921 | $ cd .. |
|
922 | 922 | |
|
923 | 923 | Rebase merge where successor of one parent is equal to destination (issue5198) |
|
924 | 924 | |
|
925 | 925 | $ hg init p1-succ-is-dest |
|
926 | 926 | $ cd p1-succ-is-dest |
|
927 | 927 | |
|
928 | 928 | $ hg debugdrawdag <<EOF |
|
929 | 929 | > F |
|
930 | 930 | > /| |
|
931 | 931 | > E D B # replace: D -> B |
|
932 | 932 | > \|/ |
|
933 | 933 | > A |
|
934 | 934 | > EOF |
|
935 | 935 | |
|
936 | 936 | $ hg rebase -d B -s D |
|
937 | 937 | note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B) |
|
938 | 938 | rebasing 4:66f1a38021c9 "F" (F tip) |
|
939 | 939 | $ hg log -G |
|
940 | 940 | o 5:50e9d60b99c6 F |
|
941 | 941 | |\ |
|
942 | 942 | | | x 4:66f1a38021c9 F |
|
943 | 943 | | |/| |
|
944 | 944 | | o | 3:7fb047a69f22 E |
|
945 | 945 | | | | |
|
946 | 946 | | | x 2:b18e25de2cf5 D |
|
947 | 947 | | |/ |
|
948 | 948 | o | 1:112478962961 B |
|
949 | 949 | |/ |
|
950 | 950 | o 0:426bada5c675 A |
|
951 | 951 | |
|
952 | 952 | $ cd .. |
|
953 | 953 | |
|
954 | 954 | Rebase merge where successor of other parent is equal to destination |
|
955 | 955 | |
|
956 | 956 | $ hg init p2-succ-is-dest |
|
957 | 957 | $ cd p2-succ-is-dest |
|
958 | 958 | |
|
959 | 959 | $ hg debugdrawdag <<EOF |
|
960 | 960 | > F |
|
961 | 961 | > /| |
|
962 | 962 | > E D B # replace: E -> B |
|
963 | 963 | > \|/ |
|
964 | 964 | > A |
|
965 | 965 | > EOF |
|
966 | 966 | |
|
967 | 967 | $ hg rebase -d B -s E |
|
968 | 968 | note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B) |
|
969 | 969 | rebasing 4:66f1a38021c9 "F" (F tip) |
|
970 | 970 | $ hg log -G |
|
971 | 971 | o 5:aae1787dacee F |
|
972 | 972 | |\ |
|
973 | 973 | | | x 4:66f1a38021c9 F |
|
974 | 974 | | |/| |
|
975 | 975 | | | x 3:7fb047a69f22 E |
|
976 | 976 | | | | |
|
977 | 977 | | o | 2:b18e25de2cf5 D |
|
978 | 978 | | |/ |
|
979 | 979 | o / 1:112478962961 B |
|
980 | 980 | |/ |
|
981 | 981 | o 0:426bada5c675 A |
|
982 | 982 | |
|
983 | 983 | $ cd .. |
|
984 | 984 | |
|
985 | 985 | Rebase merge where successor of one parent is ancestor of destination |
|
986 | 986 | |
|
987 | 987 | $ hg init p1-succ-in-dest |
|
988 | 988 | $ cd p1-succ-in-dest |
|
989 | 989 | |
|
990 | 990 | $ hg debugdrawdag <<EOF |
|
991 | 991 | > F C |
|
992 | 992 | > /| | |
|
993 | 993 | > E D B # replace: D -> B |
|
994 | 994 | > \|/ |
|
995 | 995 | > A |
|
996 | 996 | > EOF |
|
997 | 997 | |
|
998 | 998 | $ hg rebase -d C -s D |
|
999 | 999 | note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B) |
|
1000 | 1000 | rebasing 5:66f1a38021c9 "F" (F tip) |
|
1001 | 1001 | |
|
1002 | 1002 | $ hg log -G |
|
1003 | 1003 | o 6:0913febf6439 F |
|
1004 | 1004 | |\ |
|
1005 | 1005 | +---x 5:66f1a38021c9 F |
|
1006 | 1006 | | | | |
|
1007 | 1007 | | o | 4:26805aba1e60 C |
|
1008 | 1008 | | | | |
|
1009 | 1009 | o | | 3:7fb047a69f22 E |
|
1010 | 1010 | | | | |
|
1011 | 1011 | +---x 2:b18e25de2cf5 D |
|
1012 | 1012 | | | |
|
1013 | 1013 | | o 1:112478962961 B |
|
1014 | 1014 | |/ |
|
1015 | 1015 | o 0:426bada5c675 A |
|
1016 | 1016 | |
|
1017 | 1017 | $ cd .. |
|
1018 | 1018 | |
|
1019 | 1019 | Rebase merge where successor of other parent is ancestor of destination |
|
1020 | 1020 | |
|
1021 | 1021 | $ hg init p2-succ-in-dest |
|
1022 | 1022 | $ cd p2-succ-in-dest |
|
1023 | 1023 | |
|
1024 | 1024 | $ hg debugdrawdag <<EOF |
|
1025 | 1025 | > F C |
|
1026 | 1026 | > /| | |
|
1027 | 1027 | > E D B # replace: E -> B |
|
1028 | 1028 | > \|/ |
|
1029 | 1029 | > A |
|
1030 | 1030 | > EOF |
|
1031 | 1031 | |
|
1032 | 1032 | $ hg rebase -d C -s E |
|
1033 | 1033 | note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B) |
|
1034 | 1034 | rebasing 5:66f1a38021c9 "F" (F tip) |
|
1035 | 1035 | $ hg log -G |
|
1036 | 1036 | o 6:c6ab0cc6d220 F |
|
1037 | 1037 | |\ |
|
1038 | 1038 | +---x 5:66f1a38021c9 F |
|
1039 | 1039 | | | | |
|
1040 | 1040 | | o | 4:26805aba1e60 C |
|
1041 | 1041 | | | | |
|
1042 | 1042 | | | x 3:7fb047a69f22 E |
|
1043 | 1043 | | | | |
|
1044 | 1044 | o---+ 2:b18e25de2cf5 D |
|
1045 | 1045 | / / |
|
1046 | 1046 | o / 1:112478962961 B |
|
1047 | 1047 | |/ |
|
1048 | 1048 | o 0:426bada5c675 A |
|
1049 | 1049 | |
|
1050 | 1050 | $ cd .. |
|
1051 | 1051 | |
|
1052 | 1052 | Rebase merge where successor of one parent is ancestor of destination |
|
1053 | 1053 | |
|
1054 | 1054 | $ hg init p1-succ-in-dest-b |
|
1055 | 1055 | $ cd p1-succ-in-dest-b |
|
1056 | 1056 | |
|
1057 | 1057 | $ hg debugdrawdag <<EOF |
|
1058 | 1058 | > F C |
|
1059 | 1059 | > /| | |
|
1060 | 1060 | > E D B # replace: E -> B |
|
1061 | 1061 | > \|/ |
|
1062 | 1062 | > A |
|
1063 | 1063 | > EOF |
|
1064 | 1064 | |
|
1065 | 1065 | $ hg rebase -d C -b F |
|
1066 | 1066 | rebasing 2:b18e25de2cf5 "D" (D) |
|
1067 | 1067 | note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B) |
|
1068 | 1068 | rebasing 5:66f1a38021c9 "F" (F tip) |
|
1069 | 1069 | note: rebase of 5:66f1a38021c9 created no changes to commit |
|
1070 | 1070 | $ hg log -G |
|
1071 | 1071 | o 6:8f47515dda15 D |
|
1072 | 1072 | | |
|
1073 | 1073 | | x 5:66f1a38021c9 F |
|
1074 | 1074 | | |\ |
|
1075 | 1075 | o | | 4:26805aba1e60 C |
|
1076 | 1076 | | | | |
|
1077 | 1077 | | | x 3:7fb047a69f22 E |
|
1078 | 1078 | | | | |
|
1079 | 1079 | | x | 2:b18e25de2cf5 D |
|
1080 | 1080 | | |/ |
|
1081 | 1081 | o / 1:112478962961 B |
|
1082 | 1082 | |/ |
|
1083 | 1083 | o 0:426bada5c675 A |
|
1084 | 1084 | |
|
1085 | 1085 | $ cd .. |
|
1086 | 1086 | |
|
1087 | 1087 | Rebase merge where successor of other parent is ancestor of destination |
|
1088 | 1088 | |
|
1089 | 1089 | $ hg init p2-succ-in-dest-b |
|
1090 | 1090 | $ cd p2-succ-in-dest-b |
|
1091 | 1091 | |
|
1092 | 1092 | $ hg debugdrawdag <<EOF |
|
1093 | 1093 | > F C |
|
1094 | 1094 | > /| | |
|
1095 | 1095 | > E D B # replace: D -> B |
|
1096 | 1096 | > \|/ |
|
1097 | 1097 | > A |
|
1098 | 1098 | > EOF |
|
1099 | 1099 | |
|
1100 | 1100 | $ hg rebase -d C -b F |
|
1101 | 1101 | note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B) |
|
1102 | 1102 | rebasing 3:7fb047a69f22 "E" (E) |
|
1103 | 1103 | rebasing 5:66f1a38021c9 "F" (F tip) |
|
1104 | 1104 | note: rebase of 5:66f1a38021c9 created no changes to commit |
|
1105 | 1105 | |
|
1106 | 1106 | $ hg log -G |
|
1107 | 1107 | o 6:533690786a86 E |
|
1108 | 1108 | | |
|
1109 | 1109 | | x 5:66f1a38021c9 F |
|
1110 | 1110 | | |\ |
|
1111 | 1111 | o | | 4:26805aba1e60 C |
|
1112 | 1112 | | | | |
|
1113 | 1113 | | | x 3:7fb047a69f22 E |
|
1114 | 1114 | | | | |
|
1115 | 1115 | | x | 2:b18e25de2cf5 D |
|
1116 | 1116 | | |/ |
|
1117 | 1117 | o / 1:112478962961 B |
|
1118 | 1118 | |/ |
|
1119 | 1119 | o 0:426bada5c675 A |
|
1120 | 1120 | |
|
1121 | 1121 | $ cd .. |
|
1122 | 1122 | |
|
1123 | 1123 | Rebase merge where both parents have successors in destination |
|
1124 | 1124 | |
|
1125 | 1125 | $ hg init p12-succ-in-dest |
|
1126 | 1126 | $ cd p12-succ-in-dest |
|
1127 | 1127 | $ hg debugdrawdag <<'EOS' |
|
1128 | 1128 | > E F |
|
1129 | 1129 | > /| /| # replace: A -> C |
|
1130 | 1130 | > A B C D # replace: B -> D |
|
1131 | 1131 | > | | |
|
1132 | 1132 | > X Y |
|
1133 | 1133 | > EOS |
|
1134 | 1134 | $ hg rebase -r A+B+E -d F |
|
1135 | 1135 | note: not rebasing 4:a3d17304151f "A" (A), already in destination as 0:96cc3511f894 "C" (C) |
|
1136 | 1136 | note: not rebasing 5:b23a2cc00842 "B" (B), already in destination as 1:058c1e1fb10a "D" (D) |
|
1137 | 1137 | rebasing 7:dac5d11c5a7d "E" (E tip) |
|
1138 | 1138 | abort: rebasing 7:dac5d11c5a7d will include unwanted changes from 3:59c792af609c, 5:b23a2cc00842 or 2:ba2b7fa7166d, 4:a3d17304151f |
|
1139 | 1139 | [255] |
|
1140 | 1140 | $ cd .. |
|
1141 | 1141 | |
|
1142 | 1142 | Rebase a non-clean merge. One parent has successor in destination, the other |
|
1143 | 1143 | parent moves as requested. |
|
1144 | 1144 | |
|
1145 | 1145 | $ hg init p1-succ-p2-move |
|
1146 | 1146 | $ cd p1-succ-p2-move |
|
1147 | 1147 | $ hg debugdrawdag <<'EOS' |
|
1148 | 1148 | > D Z |
|
1149 | 1149 | > /| | # replace: A -> C |
|
1150 | 1150 | > A B C # D/D = D |
|
1151 | 1151 | > EOS |
|
1152 | 1152 | $ hg rebase -r A+B+D -d Z |
|
1153 | 1153 | note: not rebasing 0:426bada5c675 "A" (A), already in destination as 2:96cc3511f894 "C" (C) |
|
1154 | 1154 | rebasing 1:fc2b737bb2e5 "B" (B) |
|
1155 | 1155 | rebasing 3:b8ed089c80ad "D" (D) |
|
1156 | 1156 | |
|
1157 | 1157 | $ rm .hg/localtags |
|
1158 | 1158 | $ hg log -G |
|
1159 | 1159 | o 6:e4f78693cc88 D |
|
1160 | 1160 | | |
|
1161 | 1161 | o 5:76840d832e98 B |
|
1162 | 1162 | | |
|
1163 | 1163 | o 4:50e41c1f3950 Z |
|
1164 | 1164 | | |
|
1165 | 1165 | o 2:96cc3511f894 C |
|
1166 | 1166 | |
|
1167 | 1167 | $ hg files -r tip |
|
1168 | 1168 | B |
|
1169 | 1169 | C |
|
1170 | 1170 | D |
|
1171 | 1171 | Z |
|
1172 | 1172 | |
|
1173 | 1173 | $ cd .. |
|
1174 | 1174 | |
|
1175 | 1175 | $ hg init p1-move-p2-succ |
|
1176 | 1176 | $ cd p1-move-p2-succ |
|
1177 | 1177 | $ hg debugdrawdag <<'EOS' |
|
1178 | 1178 | > D Z |
|
1179 | 1179 | > /| | # replace: B -> C |
|
1180 | 1180 | > A B C # D/D = D |
|
1181 | 1181 | > EOS |
|
1182 | 1182 | $ hg rebase -r B+A+D -d Z |
|
1183 | 1183 | rebasing 0:426bada5c675 "A" (A) |
|
1184 | 1184 | note: not rebasing 1:fc2b737bb2e5 "B" (B), already in destination as 2:96cc3511f894 "C" (C) |
|
1185 | 1185 | rebasing 3:b8ed089c80ad "D" (D) |
|
1186 | 1186 | |
|
1187 | 1187 | $ rm .hg/localtags |
|
1188 | 1188 | $ hg log -G |
|
1189 | 1189 | o 6:1b355ed94d82 D |
|
1190 | 1190 | | |
|
1191 | 1191 | o 5:a81a74d764a6 A |
|
1192 | 1192 | | |
|
1193 | 1193 | o 4:50e41c1f3950 Z |
|
1194 | 1194 | | |
|
1195 | 1195 | o 2:96cc3511f894 C |
|
1196 | 1196 | |
|
1197 | 1197 | $ hg files -r tip |
|
1198 | 1198 | A |
|
1199 | 1199 | C |
|
1200 | 1200 | D |
|
1201 | 1201 | Z |
|
1202 | 1202 | |
|
1203 | 1203 | $ cd .. |
|
1204 | 1204 | |
|
1205 | 1205 | Test that bookmark is moved and working dir is updated when all changesets have |
|
1206 | 1206 | equivalents in destination |
|
1207 | 1207 | $ hg init rbsrepo && cd rbsrepo |
|
1208 | 1208 | $ echo "[experimental]" > .hg/hgrc |
|
1209 | 1209 | $ echo "evolution=true" >> .hg/hgrc |
|
1210 | 1210 | $ echo "rebaseskipobsolete=on" >> .hg/hgrc |
|
1211 | 1211 | $ echo root > root && hg ci -Am root |
|
1212 | 1212 | adding root |
|
1213 | 1213 | $ echo a > a && hg ci -Am a |
|
1214 | 1214 | adding a |
|
1215 | 1215 | $ hg up 0 |
|
1216 | 1216 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1217 | 1217 | $ echo b > b && hg ci -Am b |
|
1218 | 1218 | adding b |
|
1219 | 1219 | created new head |
|
1220 | 1220 | $ hg rebase -r 2 -d 1 |
|
1221 | 1221 | rebasing 2:1e9a3c00cbe9 "b" (tip) |
|
1222 | 1222 | $ hg log -r . # working dir is at rev 3 (successor of 2) |
|
1223 | 1223 | 3:be1832deae9a b (no-eol) |
|
1224 | 1224 | $ hg book -r 2 mybook --hidden # rev 2 has a bookmark on it now |
|
1225 | 1225 | $ hg up 2 && hg log -r . # working dir is at rev 2 again |
|
1226 | 1226 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1227 | 1227 | 2:1e9a3c00cbe9 b (no-eol) |
|
1228 | 1228 | $ hg rebase -r 2 -d 3 --config experimental.stabilization.track-operation=1 |
|
1229 | 1229 | note: not rebasing 2:1e9a3c00cbe9 "b" (mybook), already in destination as 3:be1832deae9a "b" (tip) |
|
1230 | 1230 | Check that working directory and bookmark was updated to rev 3 although rev 2 |
|
1231 | 1231 | was skipped |
|
1232 | 1232 | $ hg log -r . |
|
1233 | 1233 | 3:be1832deae9a b (no-eol) |
|
1234 | 1234 | $ hg bookmarks |
|
1235 | 1235 | mybook 3:be1832deae9a |
|
1236 | 1236 | $ hg debugobsolete --rev tip |
|
1237 | 1237 | 1e9a3c00cbe90d236ac05ef61efcc5e40b7412bc be1832deae9ac531caa7438b8dcf6055a122cd8e 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'rebase', 'user': 'test'} |
|
1238 | 1238 | |
|
1239 | 1239 | Obsoleted working parent and bookmark could be moved if an ancestor of working |
|
1240 | 1240 | parent gets moved: |
|
1241 | 1241 | |
|
1242 | 1242 | $ hg init $TESTTMP/ancestor-wd-move |
|
1243 | 1243 | $ cd $TESTTMP/ancestor-wd-move |
|
1244 | 1244 | $ hg debugdrawdag <<'EOS' |
|
1245 | 1245 | > E D1 # rebase: D1 -> D2 |
|
1246 | 1246 | > | | |
|
1247 | 1247 | > | C |
|
1248 | 1248 | > D2 | |
|
1249 | 1249 | > | B |
|
1250 | 1250 | > |/ |
|
1251 | 1251 | > A |
|
1252 | 1252 | > EOS |
|
1253 | 1253 | $ hg update D1 -q |
|
1254 | 1254 | $ hg bookmark book -i |
|
1255 | 1255 | $ hg rebase -r B+D1 -d E |
|
1256 | 1256 | rebasing 1:112478962961 "B" (B) |
|
1257 | 1257 | note: not rebasing 5:15ecf15e0114 "D1" (book D1 tip), already in destination as 2:0807738e0be9 "D2" (D2) |
|
1258 | 1258 | $ hg log -G -T '{desc} {bookmarks}' |
|
1259 | 1259 | @ B book |
|
1260 | 1260 | | |
|
1261 | 1261 | | x D1 |
|
1262 | 1262 | | | |
|
1263 | 1263 | o | E |
|
1264 | 1264 | | | |
|
1265 | 1265 | | o C |
|
1266 | 1266 | | | |
|
1267 | 1267 | o | D2 |
|
1268 | 1268 | | | |
|
1269 | 1269 | | x B |
|
1270 | 1270 | |/ |
|
1271 | 1271 | o A |
|
1272 | 1272 | |
|
1273 | 1273 | Rebasing a merge with one of its parent having a hidden successor |
|
1274 | 1274 | |
|
1275 | 1275 | $ hg init $TESTTMP/merge-p1-hidden-successor |
|
1276 | 1276 | $ cd $TESTTMP/merge-p1-hidden-successor |
|
1277 | 1277 | |
|
1278 | 1278 | $ hg debugdrawdag <<'EOS' |
|
1279 | 1279 | > E |
|
1280 | 1280 | > | |
|
1281 | 1281 | > B3 B2 # amend: B1 -> B2 -> B3 |
|
1282 | 1282 | > |/ # B2 is hidden |
|
1283 | 1283 | > | D |
|
1284 | 1284 | > | |\ |
|
1285 | 1285 | > | B1 C |
|
1286 | 1286 | > |/ |
|
1287 | 1287 | > A |
|
1288 | 1288 | > EOS |
|
1289 | 1289 | |
|
1290 | 1290 | $ eval `hg tags -T '{tag}={node}\n'` |
|
1291 | 1291 | $ rm .hg/localtags |
|
1292 | 1292 | |
|
1293 | 1293 | $ hg rebase -r $D -d $E |
|
1294 | 1294 | rebasing 5:9e62094e4d94 "D" |
|
1295 | 1295 | |
|
1296 | 1296 | $ hg log -G |
|
1297 | 1297 | o 7:a699d059adcf D |
|
1298 | 1298 | |\ |
|
1299 | 1299 | | o 6:ecc93090a95c E |
|
1300 | 1300 | | | |
|
1301 | 1301 | | o 4:0dc878468a23 B3 |
|
1302 | 1302 | | | |
|
1303 | 1303 | o | 1:96cc3511f894 C |
|
1304 | 1304 | / |
|
1305 | 1305 | o 0:426bada5c675 A |
|
1306 | 1306 | |
|
1307 | 1307 | For some reasons (--hidden, rebaseskipobsolete=0, directaccess, etc.), |
|
1308 | 1308 | rebasestate may contain hidden hashes. "rebase --abort" should work regardless. |
|
1309 | 1309 | |
|
1310 | 1310 | $ hg init $TESTTMP/hidden-state1 |
|
1311 | 1311 | $ cd $TESTTMP/hidden-state1 |
|
1312 | 1312 | $ cat >> .hg/hgrc <<EOF |
|
1313 | 1313 | > [experimental] |
|
1314 | 1314 | > rebaseskipobsolete=0 |
|
1315 | 1315 | > EOF |
|
1316 | 1316 | |
|
1317 | 1317 | $ hg debugdrawdag <<'EOS' |
|
1318 | 1318 | > C |
|
1319 | 1319 | > | |
|
1320 | 1320 | > D B # prune: B, C |
|
1321 | 1321 | > |/ # B/D=B |
|
1322 | 1322 | > A |
|
1323 | 1323 | > EOS |
|
1324 | 1324 | |
|
1325 | 1325 | $ eval `hg tags -T '{tag}={node}\n'` |
|
1326 | 1326 | $ rm .hg/localtags |
|
1327 | 1327 | |
|
1328 | 1328 | $ hg update -q $C --hidden |
|
1329 | 1329 | $ hg rebase -s $B -d $D |
|
1330 | 1330 | rebasing 1:2ec65233581b "B" |
|
1331 | 1331 | merging D |
|
1332 | 1332 | warning: conflicts while merging D! (edit, then use 'hg resolve --mark') |
|
1333 | 1333 | unresolved conflicts (see hg resolve, then hg rebase --continue) |
|
1334 | 1334 | [1] |
|
1335 | 1335 | |
|
1336 | 1336 | $ cp -R . $TESTTMP/hidden-state2 |
|
1337 | 1337 | |
|
1338 | 1338 | $ hg log -G |
|
1339 | 1339 | @ 2:b18e25de2cf5 D |
|
1340 | 1340 | | |
|
1341 | 1341 | | @ 1:2ec65233581b B |
|
1342 | 1342 | |/ |
|
1343 | 1343 | o 0:426bada5c675 A |
|
1344 | 1344 | |
|
1345 | 1345 | $ hg summary |
|
1346 | 1346 | parent: 2:b18e25de2cf5 tip |
|
1347 | 1347 | D |
|
1348 | 1348 | parent: 1:2ec65233581b (obsolete) |
|
1349 | 1349 | B |
|
1350 | 1350 | branch: default |
|
1351 | 1351 | commit: 2 modified, 1 unknown, 1 unresolved (merge) |
|
1352 | 1352 | update: (current) |
|
1353 | 1353 | phases: 3 draft |
|
1354 | 1354 | rebase: 0 rebased, 2 remaining (rebase --continue) |
|
1355 | 1355 | |
|
1356 | 1356 | $ hg rebase --abort |
|
1357 | 1357 | rebase aborted |
|
1358 | 1358 | |
|
1359 | 1359 | Also test --continue for the above case |
|
1360 | 1360 | |
|
1361 | 1361 | $ cd $TESTTMP/hidden-state2 |
|
1362 | 1362 | $ hg resolve -m |
|
1363 | 1363 | (no more unresolved files) |
|
1364 | 1364 | continue: hg rebase --continue |
|
1365 | 1365 | $ hg rebase --continue |
|
1366 | 1366 | rebasing 1:2ec65233581b "B" |
|
1367 | 1367 | rebasing 3:7829726be4dc "C" (tip) |
|
1368 | 1368 | $ hg log -G |
|
1369 | 1369 | @ 5:1964d5d5b547 C |
|
1370 | 1370 | | |
|
1371 | 1371 | o 4:68deb90c12a2 B |
|
1372 | 1372 | | |
|
1373 | 1373 | o 2:b18e25de2cf5 D |
|
1374 | 1374 | | |
|
1375 | 1375 | o 0:426bada5c675 A |
|
1376 | 1376 |
@@ -1,95 +1,95 b'' | |||
|
1 | 1 | Tests rebasing with part of the rebase set already in the |
|
2 | 2 | destination (issue5422) |
|
3 | 3 | |
|
4 | 4 | $ cat >> $HGRCPATH <<EOF |
|
5 | 5 | > [extensions] |
|
6 | 6 | > rebase= |
|
7 | 7 | > drawdag=$TESTDIR/drawdag.py |
|
8 | 8 | > |
|
9 | 9 | > [experimental] |
|
10 | > evolution=allowunstable | |
|
11 | 10 | > evolution.createmarkers=True |
|
11 | > evolution.allowunstable=True | |
|
12 | 12 | > |
|
13 | 13 | > [alias] |
|
14 | 14 | > tglog = log -G --template "{rev}: {desc}" |
|
15 | 15 | > EOF |
|
16 | 16 | |
|
17 | 17 | $ rebasewithdag() { |
|
18 | 18 | > N=`$PYTHON -c "print($N+1)"` |
|
19 | 19 | > hg init repo$N && cd repo$N |
|
20 | 20 | > hg debugdrawdag |
|
21 | 21 | > hg rebase "$@" > _rebasetmp |
|
22 | 22 | > r=$? |
|
23 | 23 | > grep -v 'saved backup bundle' _rebasetmp |
|
24 | 24 | > [ $r -eq 0 ] && hg tglog |
|
25 | 25 | > cd .. |
|
26 | 26 | > return $r |
|
27 | 27 | > } |
|
28 | 28 | |
|
29 | 29 | Rebase two commits, of which one is already in the right place |
|
30 | 30 | |
|
31 | 31 | $ rebasewithdag -r C+D -d B <<EOF |
|
32 | 32 | > C |
|
33 | 33 | > | |
|
34 | 34 | > B D |
|
35 | 35 | > |/ |
|
36 | 36 | > A |
|
37 | 37 | > EOF |
|
38 | 38 | rebasing 2:b18e25de2cf5 "D" (D) |
|
39 | 39 | already rebased 3:26805aba1e60 "C" (C tip) |
|
40 | 40 | o 4: D |
|
41 | 41 | | |
|
42 | 42 | | o 3: C |
|
43 | 43 | |/ |
|
44 | 44 | | x 2: D |
|
45 | 45 | | | |
|
46 | 46 | o | 1: B |
|
47 | 47 | |/ |
|
48 | 48 | o 0: A |
|
49 | 49 | |
|
50 | 50 | Can collapse commits even if one is already in the right place |
|
51 | 51 | |
|
52 | 52 | $ rebasewithdag --collapse -r C+D -d B <<EOF |
|
53 | 53 | > C |
|
54 | 54 | > | |
|
55 | 55 | > B D |
|
56 | 56 | > |/ |
|
57 | 57 | > A |
|
58 | 58 | > EOF |
|
59 | 59 | rebasing 2:b18e25de2cf5 "D" (D) |
|
60 | 60 | rebasing 3:26805aba1e60 "C" (C tip) |
|
61 | 61 | o 4: Collapsed revision |
|
62 | 62 | | * D |
|
63 | 63 | | * C |
|
64 | 64 | | x 3: C |
|
65 | 65 | |/ |
|
66 | 66 | | x 2: D |
|
67 | 67 | | | |
|
68 | 68 | o | 1: B |
|
69 | 69 | |/ |
|
70 | 70 | o 0: A |
|
71 | 71 | |
|
72 | 72 | Rebase with "holes". The commits after the hole should end up on the parent of |
|
73 | 73 | the hole (B below), not on top of the destination (A). |
|
74 | 74 | |
|
75 | 75 | $ rebasewithdag -r B+D -d A <<EOF |
|
76 | 76 | > D |
|
77 | 77 | > | |
|
78 | 78 | > C |
|
79 | 79 | > | |
|
80 | 80 | > B |
|
81 | 81 | > | |
|
82 | 82 | > A |
|
83 | 83 | > EOF |
|
84 | 84 | already rebased 1:112478962961 "B" (B) |
|
85 | 85 | rebasing 3:f585351a92f8 "D" (D tip) |
|
86 | 86 | o 4: D |
|
87 | 87 | | |
|
88 | 88 | | x 3: D |
|
89 | 89 | | | |
|
90 | 90 | | o 2: C |
|
91 | 91 | |/ |
|
92 | 92 | o 1: B |
|
93 | 93 | | |
|
94 | 94 | o 0: A |
|
95 | 95 |
@@ -1,385 +1,385 b'' | |||
|
1 | 1 | Test uncommit - set up the config |
|
2 | 2 | |
|
3 | 3 | $ cat >> $HGRCPATH <<EOF |
|
4 | 4 | > [experimental] |
|
5 | > evolution=allowunstable | |
|
6 | 5 | > evolution.createmarkers=True |
|
6 | > evolution.allowunstable=True | |
|
7 | 7 | > [extensions] |
|
8 | 8 | > uncommit = |
|
9 | 9 | > drawdag=$TESTDIR/drawdag.py |
|
10 | 10 | > EOF |
|
11 | 11 | |
|
12 | 12 | Build up a repo |
|
13 | 13 | |
|
14 | 14 | $ hg init repo |
|
15 | 15 | $ cd repo |
|
16 | 16 | $ hg bookmark foo |
|
17 | 17 | |
|
18 | 18 | Help for uncommit |
|
19 | 19 | |
|
20 | 20 | $ hg help uncommit |
|
21 | 21 | hg uncommit [OPTION]... [FILE]... |
|
22 | 22 | |
|
23 | 23 | uncommit part or all of a local changeset |
|
24 | 24 | |
|
25 | 25 | This command undoes the effect of a local commit, returning the affected |
|
26 | 26 | files to their uncommitted state. This means that files modified or |
|
27 | 27 | deleted in the changeset will be left unchanged, and so will remain |
|
28 | 28 | modified in the working directory. |
|
29 | 29 | |
|
30 | 30 | (use 'hg help -e uncommit' to show help for the uncommit extension) |
|
31 | 31 | |
|
32 | 32 | options ([+] can be repeated): |
|
33 | 33 | |
|
34 | 34 | --keep allow an empty commit after uncommiting |
|
35 | 35 | -I --include PATTERN [+] include names matching the given patterns |
|
36 | 36 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
37 | 37 | |
|
38 | 38 | (some details hidden, use --verbose to show complete help) |
|
39 | 39 | |
|
40 | 40 | Uncommit with no commits should fail |
|
41 | 41 | |
|
42 | 42 | $ hg uncommit |
|
43 | 43 | abort: cannot uncommit null changeset |
|
44 | 44 | [255] |
|
45 | 45 | |
|
46 | 46 | Create some commits |
|
47 | 47 | |
|
48 | 48 | $ touch files |
|
49 | 49 | $ hg add files |
|
50 | 50 | $ for i in a ab abc abcd abcde; do echo $i > files; echo $i > file-$i; hg add file-$i; hg commit -m "added file-$i"; done |
|
51 | 51 | $ ls |
|
52 | 52 | file-a |
|
53 | 53 | file-ab |
|
54 | 54 | file-abc |
|
55 | 55 | file-abcd |
|
56 | 56 | file-abcde |
|
57 | 57 | files |
|
58 | 58 | |
|
59 | 59 | $ hg log -G -T '{rev}:{node} {desc}' --hidden |
|
60 | 60 | @ 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde |
|
61 | 61 | | |
|
62 | 62 | o 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd |
|
63 | 63 | | |
|
64 | 64 | o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc |
|
65 | 65 | | |
|
66 | 66 | o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab |
|
67 | 67 | | |
|
68 | 68 | o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a |
|
69 | 69 | |
|
70 | 70 | Simple uncommit off the top, also moves bookmark |
|
71 | 71 | |
|
72 | 72 | $ hg bookmark |
|
73 | 73 | * foo 4:6c4fd43ed714 |
|
74 | 74 | $ hg uncommit |
|
75 | 75 | $ hg status |
|
76 | 76 | M files |
|
77 | 77 | A file-abcde |
|
78 | 78 | $ hg bookmark |
|
79 | 79 | * foo 3:6db330d65db4 |
|
80 | 80 | |
|
81 | 81 | $ hg log -G -T '{rev}:{node} {desc}' --hidden |
|
82 | 82 | x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde |
|
83 | 83 | | |
|
84 | 84 | @ 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd |
|
85 | 85 | | |
|
86 | 86 | o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc |
|
87 | 87 | | |
|
88 | 88 | o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab |
|
89 | 89 | | |
|
90 | 90 | o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a |
|
91 | 91 | |
|
92 | 92 | |
|
93 | 93 | Recommit |
|
94 | 94 | |
|
95 | 95 | $ hg commit -m 'new change abcde' |
|
96 | 96 | $ hg status |
|
97 | 97 | $ hg heads -T '{rev}:{node} {desc}' |
|
98 | 98 | 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde (no-eol) |
|
99 | 99 | |
|
100 | 100 | Uncommit of non-existent and unchanged files has no effect |
|
101 | 101 | $ hg uncommit nothinghere |
|
102 | 102 | nothing to uncommit |
|
103 | 103 | [1] |
|
104 | 104 | $ hg status |
|
105 | 105 | $ hg uncommit file-abc |
|
106 | 106 | nothing to uncommit |
|
107 | 107 | [1] |
|
108 | 108 | $ hg status |
|
109 | 109 | |
|
110 | 110 | Try partial uncommit, also moves bookmark |
|
111 | 111 | |
|
112 | 112 | $ hg bookmark |
|
113 | 113 | * foo 5:0c07a3ccda77 |
|
114 | 114 | $ hg uncommit files |
|
115 | 115 | $ hg status |
|
116 | 116 | M files |
|
117 | 117 | $ hg bookmark |
|
118 | 118 | * foo 6:3727deee06f7 |
|
119 | 119 | $ hg heads -T '{rev}:{node} {desc}' |
|
120 | 120 | 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde (no-eol) |
|
121 | 121 | $ hg log -r . -p -T '{rev}:{node} {desc}' |
|
122 | 122 | 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcdediff -r 6db330d65db4 -r 3727deee06f7 file-abcde |
|
123 | 123 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
124 | 124 | +++ b/file-abcde Thu Jan 01 00:00:00 1970 +0000 |
|
125 | 125 | @@ -0,0 +1,1 @@ |
|
126 | 126 | +abcde |
|
127 | 127 | |
|
128 | 128 | $ hg log -G -T '{rev}:{node} {desc}' --hidden |
|
129 | 129 | @ 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde |
|
130 | 130 | | |
|
131 | 131 | | x 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde |
|
132 | 132 | |/ |
|
133 | 133 | | x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde |
|
134 | 134 | |/ |
|
135 | 135 | o 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd |
|
136 | 136 | | |
|
137 | 137 | o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc |
|
138 | 138 | | |
|
139 | 139 | o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab |
|
140 | 140 | | |
|
141 | 141 | o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a |
|
142 | 142 | |
|
143 | 143 | $ hg commit -m 'update files for abcde' |
|
144 | 144 | |
|
145 | 145 | Uncommit with dirty state |
|
146 | 146 | |
|
147 | 147 | $ echo "foo" >> files |
|
148 | 148 | $ cat files |
|
149 | 149 | abcde |
|
150 | 150 | foo |
|
151 | 151 | $ hg status |
|
152 | 152 | M files |
|
153 | 153 | $ hg uncommit |
|
154 | 154 | abort: uncommitted changes |
|
155 | 155 | [255] |
|
156 | 156 | $ hg uncommit files |
|
157 | 157 | $ cat files |
|
158 | 158 | abcde |
|
159 | 159 | foo |
|
160 | 160 | $ hg commit -m "files abcde + foo" |
|
161 | 161 | |
|
162 | 162 | Testing the 'experimental.uncommitondirtywdir' config |
|
163 | 163 | |
|
164 | 164 | $ echo "bar" >> files |
|
165 | 165 | $ hg uncommit |
|
166 | 166 | abort: uncommitted changes |
|
167 | 167 | [255] |
|
168 | 168 | $ hg uncommit --config experimental.uncommitondirtywdir=True |
|
169 | 169 | $ hg commit -m "files abcde + foo" |
|
170 | 170 | |
|
171 | 171 | Uncommit in the middle of a stack, does not move bookmark |
|
172 | 172 | |
|
173 | 173 | $ hg checkout '.^^^' |
|
174 | 174 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
175 | 175 | (leaving bookmark foo) |
|
176 | 176 | $ hg log -r . -p -T '{rev}:{node} {desc}' |
|
177 | 177 | 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abcdiff -r 69a232e754b0 -r abf2df566fc1 file-abc |
|
178 | 178 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
179 | 179 | +++ b/file-abc Thu Jan 01 00:00:00 1970 +0000 |
|
180 | 180 | @@ -0,0 +1,1 @@ |
|
181 | 181 | +abc |
|
182 | 182 | diff -r 69a232e754b0 -r abf2df566fc1 files |
|
183 | 183 | --- a/files Thu Jan 01 00:00:00 1970 +0000 |
|
184 | 184 | +++ b/files Thu Jan 01 00:00:00 1970 +0000 |
|
185 | 185 | @@ -1,1 +1,1 @@ |
|
186 | 186 | -ab |
|
187 | 187 | +abc |
|
188 | 188 | |
|
189 | 189 | $ hg bookmark |
|
190 | 190 | foo 9:48e5bd7cd583 |
|
191 | 191 | $ hg uncommit |
|
192 | 192 | $ hg status |
|
193 | 193 | M files |
|
194 | 194 | A file-abc |
|
195 | 195 | $ hg heads -T '{rev}:{node} {desc}' |
|
196 | 196 | 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo (no-eol) |
|
197 | 197 | $ hg bookmark |
|
198 | 198 | foo 9:48e5bd7cd583 |
|
199 | 199 | $ hg commit -m 'new abc' |
|
200 | 200 | created new head |
|
201 | 201 | |
|
202 | 202 | Partial uncommit in the middle, does not move bookmark |
|
203 | 203 | |
|
204 | 204 | $ hg checkout '.^' |
|
205 | 205 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
206 | 206 | $ hg log -r . -p -T '{rev}:{node} {desc}' |
|
207 | 207 | 1:69a232e754b08d568c4899475faf2eb44b857802 added file-abdiff -r 3004d2d9b508 -r 69a232e754b0 file-ab |
|
208 | 208 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
209 | 209 | +++ b/file-ab Thu Jan 01 00:00:00 1970 +0000 |
|
210 | 210 | @@ -0,0 +1,1 @@ |
|
211 | 211 | +ab |
|
212 | 212 | diff -r 3004d2d9b508 -r 69a232e754b0 files |
|
213 | 213 | --- a/files Thu Jan 01 00:00:00 1970 +0000 |
|
214 | 214 | +++ b/files Thu Jan 01 00:00:00 1970 +0000 |
|
215 | 215 | @@ -1,1 +1,1 @@ |
|
216 | 216 | -a |
|
217 | 217 | +ab |
|
218 | 218 | |
|
219 | 219 | $ hg bookmark |
|
220 | 220 | foo 9:48e5bd7cd583 |
|
221 | 221 | $ hg uncommit file-ab |
|
222 | 222 | $ hg status |
|
223 | 223 | A file-ab |
|
224 | 224 | |
|
225 | 225 | $ hg heads -T '{rev}:{node} {desc}\n' |
|
226 | 226 | 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab |
|
227 | 227 | 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc |
|
228 | 228 | 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo |
|
229 | 229 | |
|
230 | 230 | $ hg bookmark |
|
231 | 231 | foo 9:48e5bd7cd583 |
|
232 | 232 | $ hg commit -m 'update ab' |
|
233 | 233 | $ hg status |
|
234 | 234 | $ hg heads -T '{rev}:{node} {desc}\n' |
|
235 | 235 | 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab |
|
236 | 236 | 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc |
|
237 | 237 | 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo |
|
238 | 238 | |
|
239 | 239 | $ hg log -G -T '{rev}:{node} {desc}' --hidden |
|
240 | 240 | @ 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab |
|
241 | 241 | | |
|
242 | 242 | o 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab |
|
243 | 243 | | |
|
244 | 244 | | o 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc |
|
245 | 245 | | | |
|
246 | 246 | | | o 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo |
|
247 | 247 | | | | |
|
248 | 248 | | | | x 8:83815831694b1271e9f207cb1b79b2b19275edcb files abcde + foo |
|
249 | 249 | | | |/ |
|
250 | 250 | | | | x 7:0977fa602c2fd7d8427ed4e7ee15ea13b84c9173 update files for abcde |
|
251 | 251 | | | |/ |
|
252 | 252 | | | o 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde |
|
253 | 253 | | | | |
|
254 | 254 | | | | x 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde |
|
255 | 255 | | | |/ |
|
256 | 256 | | | | x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde |
|
257 | 257 | | | |/ |
|
258 | 258 | | | o 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd |
|
259 | 259 | | | | |
|
260 | 260 | | | x 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc |
|
261 | 261 | | |/ |
|
262 | 262 | | x 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab |
|
263 | 263 | |/ |
|
264 | 264 | o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a |
|
265 | 265 | |
|
266 | 266 | Uncommit with draft parent |
|
267 | 267 | |
|
268 | 268 | $ hg uncommit |
|
269 | 269 | $ hg phase -r . |
|
270 | 270 | 11: draft |
|
271 | 271 | $ hg commit -m 'update ab again' |
|
272 | 272 | |
|
273 | 273 | Uncommit with public parent |
|
274 | 274 | |
|
275 | 275 | $ hg phase -p "::.^" |
|
276 | 276 | $ hg uncommit |
|
277 | 277 | $ hg phase -r . |
|
278 | 278 | 11: public |
|
279 | 279 | |
|
280 | 280 | Partial uncommit with public parent |
|
281 | 281 | |
|
282 | 282 | $ echo xyz > xyz |
|
283 | 283 | $ hg add xyz |
|
284 | 284 | $ hg commit -m "update ab and add xyz" |
|
285 | 285 | $ hg uncommit xyz |
|
286 | 286 | $ hg status |
|
287 | 287 | A xyz |
|
288 | 288 | $ hg phase -r . |
|
289 | 289 | 15: draft |
|
290 | 290 | $ hg phase -r ".^" |
|
291 | 291 | 11: public |
|
292 | 292 | |
|
293 | 293 | Uncommit leaving an empty changeset |
|
294 | 294 | |
|
295 | 295 | $ cd $TESTTMP |
|
296 | 296 | $ hg init repo1 |
|
297 | 297 | $ cd repo1 |
|
298 | 298 | $ hg debugdrawdag <<'EOS' |
|
299 | 299 | > Q |
|
300 | 300 | > | |
|
301 | 301 | > P |
|
302 | 302 | > EOS |
|
303 | 303 | $ hg up Q -q |
|
304 | 304 | $ hg uncommit --keep |
|
305 | 305 | $ hg log -G -T '{desc} FILES: {files}' |
|
306 | 306 | @ Q FILES: |
|
307 | 307 | | |
|
308 | 308 | | x Q FILES: Q |
|
309 | 309 | |/ |
|
310 | 310 | o P FILES: P |
|
311 | 311 | |
|
312 | 312 | $ hg status |
|
313 | 313 | A Q |
|
314 | 314 | |
|
315 | 315 | $ cd .. |
|
316 | 316 | $ rm -rf repo1 |
|
317 | 317 | |
|
318 | 318 | Testing uncommit while merge |
|
319 | 319 | |
|
320 | 320 | $ hg init repo2 |
|
321 | 321 | $ cd repo2 |
|
322 | 322 | |
|
323 | 323 | Create some history |
|
324 | 324 | |
|
325 | 325 | $ touch a |
|
326 | 326 | $ hg add a |
|
327 | 327 | $ for i in 1 2 3; do echo $i > a; hg commit -m "a $i"; done |
|
328 | 328 | $ hg checkout 0 |
|
329 | 329 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
330 | 330 | $ touch b |
|
331 | 331 | $ hg add b |
|
332 | 332 | $ for i in 1 2 3; do echo $i > b; hg commit -m "b $i"; done |
|
333 | 333 | created new head |
|
334 | 334 | $ hg log -G -T '{rev}:{node} {desc}' --hidden |
|
335 | 335 | @ 5:2cd56cdde163ded2fbb16ba2f918c96046ab0bf2 b 3 |
|
336 | 336 | | |
|
337 | 337 | o 4:c3a0d5bb3b15834ffd2ef9ef603e93ec65cf2037 b 2 |
|
338 | 338 | | |
|
339 | 339 | o 3:49bb009ca26078726b8870f1edb29fae8f7618f5 b 1 |
|
340 | 340 | | |
|
341 | 341 | | o 2:990982b7384266e691f1bc08ca36177adcd1c8a9 a 3 |
|
342 | 342 | | | |
|
343 | 343 | | o 1:24d38e3cf160c7b6f5ffe82179332229886a6d34 a 2 |
|
344 | 344 | |/ |
|
345 | 345 | o 0:ea4e33293d4d274a2ba73150733c2612231f398c a 1 |
|
346 | 346 | |
|
347 | 347 | |
|
348 | 348 | Add and expect uncommit to fail on both merge working dir and merge changeset |
|
349 | 349 | |
|
350 | 350 | $ hg merge 2 |
|
351 | 351 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
352 | 352 | (branch merge, don't forget to commit) |
|
353 | 353 | |
|
354 | 354 | $ hg uncommit |
|
355 | 355 | abort: outstanding uncommitted merge |
|
356 | 356 | [255] |
|
357 | 357 | |
|
358 | 358 | $ hg uncommit --config experimental.uncommitondirtywdir=True |
|
359 | 359 | abort: cannot uncommit while merging |
|
360 | 360 | [255] |
|
361 | 361 | |
|
362 | 362 | $ hg status |
|
363 | 363 | M a |
|
364 | 364 | $ hg commit -m 'merge a and b' |
|
365 | 365 | |
|
366 | 366 | $ hg uncommit |
|
367 | 367 | abort: cannot uncommit merge changeset |
|
368 | 368 | [255] |
|
369 | 369 | |
|
370 | 370 | $ hg status |
|
371 | 371 | $ hg log -G -T '{rev}:{node} {desc}' --hidden |
|
372 | 372 | @ 6:c03b9c37bc67bf504d4912061cfb527b47a63c6e merge a and b |
|
373 | 373 | |\ |
|
374 | 374 | | o 5:2cd56cdde163ded2fbb16ba2f918c96046ab0bf2 b 3 |
|
375 | 375 | | | |
|
376 | 376 | | o 4:c3a0d5bb3b15834ffd2ef9ef603e93ec65cf2037 b 2 |
|
377 | 377 | | | |
|
378 | 378 | | o 3:49bb009ca26078726b8870f1edb29fae8f7618f5 b 1 |
|
379 | 379 | | | |
|
380 | 380 | o | 2:990982b7384266e691f1bc08ca36177adcd1c8a9 a 3 |
|
381 | 381 | | | |
|
382 | 382 | o | 1:24d38e3cf160c7b6f5ffe82179332229886a6d34 a 2 |
|
383 | 383 | |/ |
|
384 | 384 | o 0:ea4e33293d4d274a2ba73150733c2612231f398c a 1 |
|
385 | 385 |
General Comments 0
You need to be logged in to leave comments.
Login now