Comments
Patch
@@ -248,6 +248,21 @@ def dorecord(ui, repo, commitfunc, cmdsu
if not opts.get('user'):
ui.username() # raise exception, username not provided
+ wctx = repo[None]
+ match = scmutil.match(wctx, pats, opts)
+ status = repo.status(match=match)
+
+ overrides = {(b'ui', b'commitsubrepos'): True}
+
+ with repo.ui.configoverride(overrides, b'record'):
+ # Force allows -X subrepo.
+ subs, commitsubs, newstate = subrepoutil.precommit(
+ repo.ui, wctx, status, match, force=True)
+ for s in subs:
+ if s in commitsubs:
+ dirtyreason = wctx.sub(s).dirtyreason(True)
+ raise error.Abort(dirtyreason)
+
def recordfunc(ui, repo, message, match, opts):
"""This is generic record driver.
@@ -121,9 +121,22 @@ add new commit to be amended
$ echo a >> a
$ hg ci -m3
+ $ echo 't = t' > .hgsub
+
+--interactive won't silently ignore dirty subrepos
+
+ $ echo modified > t/b
+ $ hg amend --interactive --config ui.interactive=True
+ abort: uncommitted changes in subrepository "t"
+ [255]
+ $ hg amend --interactive --config ui.interactive=True --config ui.commitsubrepos=True
+ abort: uncommitted changes in subrepository "t"
+ [255]
+
+ $ hg -R t revert -q --all --no-backup
+
amend with one subrepo dropped
- $ echo 't = t' > .hgsub
$ hg amend
saved backup bundle to * (glob) (obsstore-off !)
$ hg status --change .
@@ -295,16 +295,6 @@ handle subrepos safely on qrecord
A .hgsub
A sub/a
% qrecord --config ui.interactive=1 -m0 0.diff
- diff --git a/.hgsub b/.hgsub
- new file mode 100644
- examine changes to '.hgsub'? [Ynesfdaq?] y
-
- @@ -0,0 +1,1 @@
- +sub = sub
- record this change to '.hgsub'? [Ynesfdaq?] y
-
- warning: subrepo spec file '.hgsub' not found
- warning: subrepo spec file '.hgsub' not found
abort: uncommitted changes in subrepository "sub"
[255]
% update substate when adding .hgsub w/clean updated subrepo
@@ -333,15 +323,6 @@ handle subrepos safely on qrecord
M .hgsub
A sub2/a
% qrecord --config ui.interactive=1 -m1 1.diff
- diff --git a/.hgsub b/.hgsub
- 1 hunks, 1 lines changed
- examine changes to '.hgsub'? [Ynesfdaq?] y
-
- @@ -1,1 +1,2 @@
- sub = sub
- +sub2 = sub2
- record this change to '.hgsub'? [Ynesfdaq?] y
-
abort: uncommitted changes in subrepository "sub2"
[255]
% update substate when modifying .hgsub w/clean updated subrepo