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