Show More
@@ -7,6 +7,7 b'' | |||||
7 |
|
7 | |||
8 | from __future__ import absolute_import |
|
8 | from __future__ import absolute_import | |
9 |
|
9 | |||
|
10 | import copy as copymod | |||
10 | import errno |
|
11 | import errno | |
11 | import os |
|
12 | import os | |
12 | import re |
|
13 | import re | |
@@ -270,6 +271,28 b' def dorecord(ui, repo, commitfunc, cmdsu' | |||||
270 | raise error.Abort(_('cannot partially commit a merge ' |
|
271 | raise error.Abort(_('cannot partially commit a merge ' | |
271 | '(use "hg commit" instead)')) |
|
272 | '(use "hg commit" instead)')) | |
272 |
|
273 | |||
|
274 | status = repo.status(match=match) | |||
|
275 | ||||
|
276 | overrides = {(b'ui', b'commitsubrepos'): True} | |||
|
277 | ||||
|
278 | with repo.ui.configoverride(overrides, b'record'): | |||
|
279 | # subrepoutil.precommit() modifies the status | |||
|
280 | tmpstatus = scmutil.status(copymod.copy(status[0]), | |||
|
281 | copymod.copy(status[1]), | |||
|
282 | copymod.copy(status[2]), | |||
|
283 | copymod.copy(status[3]), | |||
|
284 | copymod.copy(status[4]), | |||
|
285 | copymod.copy(status[5]), | |||
|
286 | copymod.copy(status[6])) | |||
|
287 | ||||
|
288 | # Force allows -X subrepo to skip the subrepo. | |||
|
289 | subs, commitsubs, newstate = subrepoutil.precommit( | |||
|
290 | repo.ui, wctx, tmpstatus, match, force=True) | |||
|
291 | for s in subs: | |||
|
292 | if s in commitsubs: | |||
|
293 | dirtyreason = wctx.sub(s).dirtyreason(True) | |||
|
294 | raise error.Abort(dirtyreason) | |||
|
295 | ||||
273 | def fail(f, msg): |
|
296 | def fail(f, msg): | |
274 | raise error.Abort('%s: %s' % (f, msg)) |
|
297 | raise error.Abort('%s: %s' % (f, msg)) | |
275 |
|
298 | |||
@@ -279,7 +302,6 b' def dorecord(ui, repo, commitfunc, cmdsu' | |||||
279 | match.explicitdir = vdirs.append |
|
302 | match.explicitdir = vdirs.append | |
280 | match.bad = fail |
|
303 | match.bad = fail | |
281 |
|
304 | |||
282 | status = repo.status(match=match) |
|
|||
283 | if not force: |
|
305 | if not force: | |
284 | repo.checkcommitpatterns(wctx, vdirs, match, status, fail) |
|
306 | repo.checkcommitpatterns(wctx, vdirs, match, status, fail) | |
285 | diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=True) |
|
307 | diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=True) |
@@ -121,9 +121,22 b' add new commit to be amended' | |||||
121 | $ echo a >> a |
|
121 | $ echo a >> a | |
122 | $ hg ci -m3 |
|
122 | $ hg ci -m3 | |
123 |
|
123 | |||
|
124 | $ echo 't = t' > .hgsub | |||
|
125 | ||||
|
126 | --interactive won't silently ignore dirty subrepos | |||
|
127 | ||||
|
128 | $ echo modified > t/b | |||
|
129 | $ hg amend --interactive --config ui.interactive=True | |||
|
130 | abort: uncommitted changes in subrepository "t" | |||
|
131 | [255] | |||
|
132 | $ hg amend --interactive --config ui.interactive=True --config ui.commitsubrepos=True | |||
|
133 | abort: uncommitted changes in subrepository "t" | |||
|
134 | [255] | |||
|
135 | ||||
|
136 | $ hg -R t revert -q --all --no-backup | |||
|
137 | ||||
124 | amend with one subrepo dropped |
|
138 | amend with one subrepo dropped | |
125 |
|
139 | |||
126 | $ echo 't = t' > .hgsub |
|
|||
127 | $ hg amend |
|
140 | $ hg amend | |
128 | saved backup bundle to * (glob) (obsstore-off !) |
|
141 | saved backup bundle to * (glob) (obsstore-off !) | |
129 | $ hg status --change . |
|
142 | $ hg status --change . |
@@ -295,16 +295,6 b' handle subrepos safely on qrecord' | |||||
295 | A .hgsub |
|
295 | A .hgsub | |
296 | A sub/a |
|
296 | A sub/a | |
297 | % qrecord --config ui.interactive=1 -m0 0.diff |
|
297 | % qrecord --config ui.interactive=1 -m0 0.diff | |
298 | diff --git a/.hgsub b/.hgsub |
|
|||
299 | new file mode 100644 |
|
|||
300 | examine changes to '.hgsub'? [Ynesfdaq?] y |
|
|||
301 |
|
||||
302 | @@ -0,0 +1,1 @@ |
|
|||
303 | +sub = sub |
|
|||
304 | record this change to '.hgsub'? [Ynesfdaq?] y |
|
|||
305 |
|
||||
306 | warning: subrepo spec file '.hgsub' not found |
|
|||
307 | warning: subrepo spec file '.hgsub' not found |
|
|||
308 | abort: uncommitted changes in subrepository "sub" |
|
298 | abort: uncommitted changes in subrepository "sub" | |
309 | [255] |
|
299 | [255] | |
310 | % update substate when adding .hgsub w/clean updated subrepo |
|
300 | % update substate when adding .hgsub w/clean updated subrepo | |
@@ -333,15 +323,6 b' handle subrepos safely on qrecord' | |||||
333 | M .hgsub |
|
323 | M .hgsub | |
334 | A sub2/a |
|
324 | A sub2/a | |
335 | % qrecord --config ui.interactive=1 -m1 1.diff |
|
325 | % qrecord --config ui.interactive=1 -m1 1.diff | |
336 | diff --git a/.hgsub b/.hgsub |
|
|||
337 | 1 hunks, 1 lines changed |
|
|||
338 | examine changes to '.hgsub'? [Ynesfdaq?] y |
|
|||
339 |
|
||||
340 | @@ -1,1 +1,2 @@ |
|
|||
341 | sub = sub |
|
|||
342 | +sub2 = sub2 |
|
|||
343 | record this change to '.hgsub'? [Ynesfdaq?] y |
|
|||
344 |
|
||||
345 | abort: uncommitted changes in subrepository "sub2" |
|
326 | abort: uncommitted changes in subrepository "sub2" | |
346 | [255] |
|
327 | [255] | |
347 | % update substate when modifying .hgsub w/clean updated subrepo |
|
328 | % update substate when modifying .hgsub w/clean updated subrepo |
General Comments 0
You need to be logged in to leave comments.
Login now