##// END OF EJS Templates
record: prevent commits that don't pick up dirty subrepo changes (issue6102)...
Matt Harbison -
r42143:4ea21df3 4.9.1 stable
parent child Browse files
Show More
@@ -7,6 +7,7 b''
7 7
8 8 from __future__ import absolute_import
9 9
10 import copy as copymod
10 11 import errno
11 12 import os
12 13 import re
@@ -270,6 +271,28 b' def dorecord(ui, repo, commitfunc, cmdsu'
270 271 raise error.Abort(_('cannot partially commit a merge '
271 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 296 def fail(f, msg):
274 297 raise error.Abort('%s: %s' % (f, msg))
275 298
@@ -279,7 +302,6 b' def dorecord(ui, repo, commitfunc, cmdsu'
279 302 match.explicitdir = vdirs.append
280 303 match.bad = fail
281 304
282 status = repo.status(match=match)
283 305 if not force:
284 306 repo.checkcommitpatterns(wctx, vdirs, match, status, fail)
285 307 diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=True)
@@ -121,9 +121,22 b' add new commit to be amended'
121 121 $ echo a >> a
122 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 138 amend with one subrepo dropped
125 139
126 $ echo 't = t' > .hgsub
127 140 $ hg amend
128 141 saved backup bundle to * (glob) (obsstore-off !)
129 142 $ hg status --change .
@@ -295,16 +295,6 b' handle subrepos safely on qrecord'
295 295 A .hgsub
296 296 A sub/a
297 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 298 abort: uncommitted changes in subrepository "sub"
309 299 [255]
310 300 % update substate when adding .hgsub w/clean updated subrepo
@@ -333,15 +323,6 b' handle subrepos safely on qrecord'
333 323 M .hgsub
334 324 A sub2/a
335 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 326 abort: uncommitted changes in subrepository "sub2"
346 327 [255]
347 328 % update substate when modifying .hgsub w/clean updated subrepo
General Comments 0
You need to be logged in to leave comments. Login now