Show More
@@ -952,7 +952,7 b' def absorb(ui, repo, stack=None, targetc' | |||||
952 | chunks = cmdutil.recordfilter(ui, origchunks)[0] |
|
952 | chunks = cmdutil.recordfilter(ui, origchunks)[0] | |
953 | targetctx = overlaydiffcontext(stack[-1], chunks) |
|
953 | targetctx = overlaydiffcontext(stack[-1], chunks) | |
954 | fm = None |
|
954 | fm = None | |
955 | if opts.get('print_changes'): |
|
955 | if opts.get('print_changes') or not opts.get('apply_changes'): | |
956 | fm = ui.formatter('absorb', opts) |
|
956 | fm = ui.formatter('absorb', opts) | |
957 | state.diffwith(targetctx, matcher, fm) |
|
957 | state.diffwith(targetctx, matcher, fm) | |
958 | if fm is not None: |
|
958 | if fm is not None: | |
@@ -971,6 +971,10 b' def absorb(ui, repo, stack=None, targetc' | |||||
971 | label='absorb.description') |
|
971 | label='absorb.description') | |
972 | fm.end() |
|
972 | fm.end() | |
973 | if not opts.get('dry_run'): |
|
973 | if not opts.get('dry_run'): | |
|
974 | if not opts.get('apply_changes'): | |||
|
975 | if ui.promptchoice("apply changes (yn)? $$ &Yes $$ &No", default=1): | |||
|
976 | raise error.Abort(_('absorb cancelled\n')) | |||
|
977 | ||||
974 | state.apply() |
|
978 | state.apply() | |
975 | if state.commit(): |
|
979 | if state.commit(): | |
976 | state.printchunkstats() |
|
980 | state.printchunkstats() | |
@@ -979,8 +983,10 b' def absorb(ui, repo, stack=None, targetc' | |||||
979 | return state |
|
983 | return state | |
980 |
|
984 | |||
981 | @command('^absorb', |
|
985 | @command('^absorb', | |
982 |
[(' |
|
986 | [('a', 'apply-changes', None, | |
983 | _('print which changesets are modified by which changes')), |
|
987 | _('apply changes without prompting for confirmation')), | |
|
988 | ('p', 'print-changes', None, | |||
|
989 | _('just print which changesets are modified by which changes')), | |||
984 | ('i', 'interactive', None, |
|
990 | ('i', 'interactive', None, | |
985 | _('interactively select which chunks to apply (EXPERIMENTAL)')), |
|
991 | _('interactively select which chunks to apply (EXPERIMENTAL)')), | |
986 | ('e', 'edit-lines', None, |
|
992 | ('e', 'edit-lines', None, |
@@ -15,10 +15,10 b' Make some commits:' | |||||
15 |
|
15 | |||
16 | absorb --edit-lines will run the editor if filename is provided: |
|
16 | absorb --edit-lines will run the editor if filename is provided: | |
17 |
|
17 | |||
18 | $ hg absorb --edit-lines |
|
18 | $ hg absorb --edit-lines --apply-changes | |
19 | nothing applied |
|
19 | nothing applied | |
20 | [1] |
|
20 | [1] | |
21 | $ HGEDITOR=cat hg absorb --edit-lines a |
|
21 | $ HGEDITOR=cat hg absorb --edit-lines --apply-changes a | |
22 | HG: editing a |
|
22 | HG: editing a | |
23 | HG: "y" means the line to the right exists in the changeset to the top |
|
23 | HG: "y" means the line to the right exists in the changeset to the top | |
24 | HG: |
|
24 | HG: | |
@@ -43,7 +43,7 b' Edit the file using --edit-lines:' | |||||
43 | > y : f |
|
43 | > y : f | |
44 | > yyy : g |
|
44 | > yyy : g | |
45 | > EOF |
|
45 | > EOF | |
46 | $ HGEDITOR='cat editortext >' hg absorb -q --edit-lines a |
|
46 | $ HGEDITOR='cat editortext >' hg absorb -q --edit-lines --apply-changes a | |
47 | $ hg cat -r 0 a |
|
47 | $ hg cat -r 0 a | |
48 | d |
|
48 | d | |
49 | e |
|
49 | e |
@@ -19,7 +19,7 b'' | |||||
19 | $ hg update C -q |
|
19 | $ hg update C -q | |
20 | $ printf B1 > B |
|
20 | $ printf B1 > B | |
21 |
|
21 | |||
22 | $ hg absorb -q |
|
22 | $ hg absorb -aq | |
23 |
|
23 | |||
24 | $ hg log -G -T '{desc} {phase}' |
|
24 | $ hg log -G -T '{desc} {phase}' | |
25 | @ C secret |
|
25 | @ C secret |
@@ -34,7 +34,7 b' rename a to b, then b to a' | |||||
34 | 2 0b888b00216c a: 3 |
|
34 | 2 0b888b00216c a: 3 | |
35 |
|
35 | |||
36 | $ sedi 's/$/a/' a |
|
36 | $ sedi 's/$/a/' a | |
37 | $ hg absorb -pq |
|
37 | $ hg absorb -apq | |
38 | showing changes for a |
|
38 | showing changes for a | |
39 | @@ -0,3 +0,3 @@ |
|
39 | @@ -0,3 +0,3 @@ | |
40 | eff892d -1 |
|
40 | eff892d -1 | |
@@ -62,7 +62,7 b' when the first changeset is public' | |||||
62 |
|
62 | |||
63 | $ sedi 's/a/A/' a |
|
63 | $ sedi 's/a/A/' a | |
64 |
|
64 | |||
65 | $ hg absorb -pq |
|
65 | $ hg absorb -apq | |
66 | showing changes for a |
|
66 | showing changes for a | |
67 | @@ -0,3 +0,3 @@ |
|
67 | @@ -0,3 +0,3 @@ | |
68 | -1a |
|
68 | -1a | |
@@ -105,7 +105,7 b' copy a to b' | |||||
105 | $ sedi 's/$/a/' a |
|
105 | $ sedi 's/$/a/' a | |
106 | $ sedi 's/$/b/' b |
|
106 | $ sedi 's/$/b/' b | |
107 |
|
107 | |||
108 | $ hg absorb -pq |
|
108 | $ hg absorb -apq | |
109 | showing changes for a |
|
109 | showing changes for a | |
110 | @@ -0,1 +0,1 @@ |
|
110 | @@ -0,1 +0,1 @@ | |
111 | eff892d -1 |
|
111 | eff892d -1 | |
@@ -149,7 +149,7 b' copy b to a' | |||||
149 | $ sedi 's/$/a/' a |
|
149 | $ sedi 's/$/a/' a | |
150 | $ sedi 's/$/a/' b |
|
150 | $ sedi 's/$/a/' b | |
151 |
|
151 | |||
152 | $ hg absorb -pq |
|
152 | $ hg absorb -apq | |
153 | showing changes for a |
|
153 | showing changes for a | |
154 | @@ -0,2 +0,2 @@ |
|
154 | @@ -0,2 +0,2 @@ | |
155 | -1 |
|
155 | -1 | |
@@ -196,7 +196,7 b' copy b to a' | |||||
196 | $ sedi 's/$/a/' a |
|
196 | $ sedi 's/$/a/' a | |
197 | $ sedi 's/$/c/' c |
|
197 | $ sedi 's/$/c/' c | |
198 |
|
198 | |||
199 | $ hg absorb -pq |
|
199 | $ hg absorb -apq | |
200 | showing changes for a |
|
200 | showing changes for a | |
201 | @@ -0,2 +0,2 @@ |
|
201 | @@ -0,2 +0,2 @@ | |
202 | 55105f9 -1 |
|
202 | 55105f9 -1 | |
@@ -244,7 +244,7 b' copy b to a' | |||||
244 |
|
244 | |||
245 | run absorb again would apply the change to c |
|
245 | run absorb again would apply the change to c | |
246 |
|
246 | |||
247 | $ hg absorb -pq |
|
247 | $ hg absorb -apq | |
248 | showing changes for c |
|
248 | showing changes for c | |
249 | @@ -0,1 +0,1 @@ |
|
249 | @@ -0,1 +0,1 @@ | |
250 | 7060601 -1 |
|
250 | 7060601 -1 | |
@@ -309,7 +309,7 b' run absorb again would apply the change ' | |||||
309 | $ sedi 's/$/e/' e |
|
309 | $ sedi 's/$/e/' e | |
310 | $ sedi 's/$/d/' d |
|
310 | $ sedi 's/$/d/' d | |
311 |
|
311 | |||
312 | $ hg absorb -pq |
|
312 | $ hg absorb -apq | |
313 | showing changes for d |
|
313 | showing changes for d | |
314 | @@ -0,2 +0,2 @@ |
|
314 | @@ -0,2 +0,2 @@ | |
315 | 55105f9 -1 |
|
315 | 55105f9 -1 |
@@ -22,7 +22,7 b' Do not strip innocent children. See http' | |||||
22 | $ hg up E -q |
|
22 | $ hg up E -q | |
23 | $ echo 1 >> B |
|
23 | $ echo 1 >> B | |
24 | $ echo 2 >> D |
|
24 | $ echo 2 >> D | |
25 | $ hg absorb |
|
25 | $ hg absorb -a | |
26 | saved backup bundle to * (glob) |
|
26 | saved backup bundle to * (glob) | |
27 | 2 of 2 chunk(s) applied |
|
27 | 2 of 2 chunk(s) applied | |
28 |
|
28 |
@@ -68,7 +68,7 b' Preview absorb changes:' | |||||
68 |
|
68 | |||
69 | Run absorb: |
|
69 | Run absorb: | |
70 |
|
70 | |||
71 | $ hg absorb |
|
71 | $ hg absorb --apply-changes | |
72 | saved backup bundle to * (glob) |
|
72 | saved backup bundle to * (glob) | |
73 | 2 of 2 chunk(s) applied |
|
73 | 2 of 2 chunk(s) applied | |
74 | $ hg annotate a |
|
74 | $ hg annotate a | |
@@ -84,7 +84,20 b' Delete a few lines and related commits w' | |||||
84 | > 2b |
|
84 | > 2b | |
85 | > 4d |
|
85 | > 4d | |
86 | > EOF |
|
86 | > EOF | |
87 | $ hg absorb |
|
87 | $ echo y | hg absorb --config ui.interactive=1 | |
|
88 | showing changes for a | |||
|
89 | @@ -0,1 +0,0 @@ | |||
|
90 | f548282 -1a | |||
|
91 | @@ -2,1 +1,0 @@ | |||
|
92 | ff5d556 -3 | |||
|
93 | @@ -4,1 +2,0 @@ | |||
|
94 | 84e5416 -5e | |||
|
95 | ||||
|
96 | 3 changesets affected | |||
|
97 | 84e5416 commit 5 | |||
|
98 | ff5d556 commit 3 | |||
|
99 | f548282 commit 1 | |||
|
100 | apply changes (yn)? y | |||
88 |
|
|
101 | saved backup bundle to * (glob) | |
89 | 3 of 3 chunk(s) applied |
|
102 | 3 of 3 chunk(s) applied | |
90 | $ hg annotate a |
|
103 | $ hg annotate a | |
@@ -112,7 +125,7 b' Delete a few lines and related commits w' | |||||
112 | Non 1:1 map changes will be ignored: |
|
125 | Non 1:1 map changes will be ignored: | |
113 |
|
126 | |||
114 | $ echo 1 > a |
|
127 | $ echo 1 > a | |
115 | $ hg absorb |
|
128 | $ hg absorb --apply-changes | |
116 | nothing applied |
|
129 | nothing applied | |
117 | [1] |
|
130 | [1] | |
118 |
|
131 | |||
@@ -124,7 +137,7 b' Insertaions:' | |||||
124 | > 4d |
|
137 | > 4d | |
125 | > insert aftert 4d |
|
138 | > insert aftert 4d | |
126 | > EOF |
|
139 | > EOF | |
127 | $ hg absorb -q |
|
140 | $ hg absorb -q --apply-changes | |
128 | $ hg status |
|
141 | $ hg status | |
129 | $ hg annotate a |
|
142 | $ hg annotate a | |
130 | 1: insert before 2b |
|
143 | 1: insert before 2b | |
@@ -142,7 +155,7 b' Bookmarks are moved:' | |||||
142 | b2 2:946e4bc87915 |
|
155 | b2 2:946e4bc87915 | |
143 | * ba 2:946e4bc87915 |
|
156 | * ba 2:946e4bc87915 | |
144 | $ sedi 's/insert/INSERT/' a |
|
157 | $ sedi 's/insert/INSERT/' a | |
145 | $ hg absorb -q |
|
158 | $ hg absorb -q --apply-changes | |
146 | $ hg status |
|
159 | $ hg status | |
147 | $ hg bookmarks |
|
160 | $ hg bookmarks | |
148 | b1 1:a4183e9b3d31 |
|
161 | b1 1:a4183e9b3d31 | |
@@ -156,11 +169,11 b' Non-mofified files are ignored:' | |||||
156 | $ touch c |
|
169 | $ touch c | |
157 | $ hg add c |
|
170 | $ hg add c | |
158 | $ hg rm b |
|
171 | $ hg rm b | |
159 | $ hg absorb |
|
172 | $ hg absorb --apply-changes | |
160 | nothing applied |
|
173 | nothing applied | |
161 | [1] |
|
174 | [1] | |
162 | $ sedi 's/INSERT/Insert/' a |
|
175 | $ sedi 's/INSERT/Insert/' a | |
163 | $ hg absorb |
|
176 | $ hg absorb --apply-changes | |
164 | saved backup bundle to * (glob) |
|
177 | saved backup bundle to * (glob) | |
165 | 2 of 2 chunk(s) applied |
|
178 | 2 of 2 chunk(s) applied | |
166 | $ hg status |
|
179 | $ hg status | |
@@ -182,7 +195,7 b' Public commits will not be changed:' | |||||
182 |
|
195 | |||
183 | 1 changesets affected |
|
196 | 1 changesets affected | |
184 | 85b4e0e commit 4 |
|
197 | 85b4e0e commit 4 | |
185 | $ hg absorb |
|
198 | $ hg absorb --apply-changes | |
186 | saved backup bundle to * (glob) |
|
199 | saved backup bundle to * (glob) | |
187 | 1 of 2 chunk(s) applied |
|
200 | 1 of 2 chunk(s) applied | |
188 | $ hg diff -U 0 |
|
201 | $ hg diff -U 0 | |
@@ -233,7 +246,7 b' Merge commit will not be changed:' | |||||
233 |
|
246 | |||
234 | $ echo 2 >> m1 |
|
247 | $ echo 2 >> m1 | |
235 | $ echo 2 >> m2 |
|
248 | $ echo 2 >> m2 | |
236 | $ hg absorb |
|
249 | $ hg absorb --apply-changes | |
237 | abort: no mutable changeset to change |
|
250 | abort: no mutable changeset to change | |
238 | [255] |
|
251 | [255] | |
239 | $ hg revert -q -C m1 m2 |
|
252 | $ hg revert -q -C m1 m2 | |
@@ -259,15 +272,15 b' Use pattern to select files to be fixed ' | |||||
259 | $ hg status |
|
272 | $ hg status | |
260 | M a |
|
273 | M a | |
261 | M b |
|
274 | M b | |
262 | $ hg absorb a |
|
275 | $ hg absorb --apply-changes a | |
263 | saved backup bundle to * (glob) |
|
276 | saved backup bundle to * (glob) | |
264 | 1 of 1 chunk(s) applied |
|
277 | 1 of 1 chunk(s) applied | |
265 | $ hg status |
|
278 | $ hg status | |
266 | M b |
|
279 | M b | |
267 | $ hg absorb --exclude b |
|
280 | $ hg absorb --apply-changes --exclude b | |
268 | nothing applied |
|
281 | nothing applied | |
269 | [1] |
|
282 | [1] | |
270 | $ hg absorb b |
|
283 | $ hg absorb --apply-changes b | |
271 | saved backup bundle to * (glob) |
|
284 | saved backup bundle to * (glob) | |
272 | 1 of 1 chunk(s) applied |
|
285 | 1 of 1 chunk(s) applied | |
273 | $ hg status |
|
286 | $ hg status | |
@@ -312,7 +325,7 b' Test obsolete markers creation:' | |||||
312 | > add-noise=1 |
|
325 | > add-noise=1 | |
313 | > EOF |
|
326 | > EOF | |
314 |
|
327 | |||
315 | $ hg --config absorb.max-stack-size=3 absorb |
|
328 | $ hg --config absorb.max-stack-size=3 absorb -a | |
316 | absorb: only the recent 3 changesets will be analysed |
|
329 | absorb: only the recent 3 changesets will be analysed | |
317 | 2 of 2 chunk(s) applied |
|
330 | 2 of 2 chunk(s) applied | |
318 | $ hg log -T '{rev}:{node|short} {desc} {get(extras, "absorb_source")}\n' |
|
331 | $ hg log -T '{rev}:{node|short} {desc} {get(extras, "absorb_source")}\n' | |
@@ -320,7 +333,7 b' Test obsolete markers creation:' | |||||
320 | 5:99cfab7da5ff commit b 1 74cfa6294160149d60adbf7582b99ce37a4597ec |
|
333 | 5:99cfab7da5ff commit b 1 74cfa6294160149d60adbf7582b99ce37a4597ec | |
321 | 4:fec2b3bd9e08 commit a 2 28f10dcf96158f84985358a2e5d5b3505ca69c22 |
|
334 | 4:fec2b3bd9e08 commit a 2 28f10dcf96158f84985358a2e5d5b3505ca69c22 | |
322 | 0:f9a81da8dc53 commit a 1 |
|
335 | 0:f9a81da8dc53 commit a 1 | |
323 | $ hg absorb |
|
336 | $ hg absorb --apply-changes | |
324 | 1 of 1 chunk(s) applied |
|
337 | 1 of 1 chunk(s) applied | |
325 | $ hg log -T '{rev}:{node|short} {desc} {get(extras, "absorb_source")}\n' |
|
338 | $ hg log -T '{rev}:{node|short} {desc} {get(extras, "absorb_source")}\n' | |
326 | 10:e1c8c1e030a4 commit b 2 3dfde4199b4610ea6e3c6fa9f5bdad8939d69524 |
|
339 | 10:e1c8c1e030a4 commit b 2 3dfde4199b4610ea6e3c6fa9f5bdad8939d69524 | |
@@ -367,7 +380,7 b' Executable files:' | |||||
367 |
|
380 | |||
368 | 1 changesets affected |
|
381 | 1 changesets affected | |
369 | 99b4ae7 foo |
|
382 | 99b4ae7 foo | |
370 | $ hg absorb |
|
383 | $ hg absorb --apply-changes | |
371 | 1 of 1 chunk(s) applied |
|
384 | 1 of 1 chunk(s) applied | |
372 | $ hg diff -c . |
|
385 | $ hg diff -c . | |
373 | diff --git a/foo.py b/foo.py |
|
386 | diff --git a/foo.py b/foo.py | |
@@ -414,7 +427,7 b' Remove lines may delete changesets:' | |||||
414 | 30970db b3 |
|
427 | 30970db b3 | |
415 | 1154859 b12 |
|
428 | 1154859 b12 | |
416 | bfafb49 a12 |
|
429 | bfafb49 a12 | |
417 | $ hg absorb -v | grep became |
|
430 | $ hg absorb -av | grep became | |
418 | 0:bfafb49242db: 1 file(s) changed, became 4:1a2de97fc652 |
|
431 | 0:bfafb49242db: 1 file(s) changed, became 4:1a2de97fc652 | |
419 | 1:115485984805: 2 file(s) changed, became 5:0c930dfab74c |
|
432 | 1:115485984805: 2 file(s) changed, became 5:0c930dfab74c | |
420 | 2:30970dbf7b40: became empty and was dropped |
|
433 | 2:30970dbf7b40: became empty and was dropped | |
@@ -468,7 +481,7 b' This should move us to the non-obsolete ' | |||||
468 | 2 changesets affected |
|
481 | 2 changesets affected | |
469 | 82dbe7f a1234 |
|
482 | 82dbe7f a1234 | |
470 | f1c23dd a123 |
|
483 | f1c23dd a123 | |
471 | $ hg absorb --verbose |
|
484 | $ hg absorb --apply-changes --verbose | |
472 | 1:f1c23dd5d08d: became empty and was dropped |
|
485 | 1:f1c23dd5d08d: became empty and was dropped | |
473 | 2:82dbe7fd19f0: became empty and was dropped |
|
486 | 2:82dbe7fd19f0: became empty and was dropped | |
474 | a: 1 of 1 chunk(s) applied |
|
487 | a: 1 of 1 chunk(s) applied |
General Comments 0
You need to be logged in to leave comments.
Login now