diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1143,7 +1143,7 @@ def clone(ui, source, dest=None, **opts) _('mark new/missing files as added/removed before committing')), ('', 'close-branch', None, _('mark a branch as closed, hiding it from the branch list')), - ] + walkopts + commitopts + commitopts2, + ] + walkopts + commitopts + commitopts2 + subrepoopts, _('[OPTION]... [FILE]...')) def commit(ui, repo, *pats, **opts): """commit the specified files or all outstanding changes @@ -1167,6 +1167,10 @@ def commit(ui, repo, *pats, **opts): Returns 0 on success, 1 if nothing changed. """ + if opts.get('subrepos'): + # Let --subrepos on the command line overide config setting. + ui.setconfig('ui', 'commitsubrepos', True) + extra = {} if opts.get('close_branch'): if repo['.'].node() not in repo.branchheads(): diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt --- a/mercurial/help/config.txt +++ b/mercurial/help/config.txt @@ -1010,7 +1010,7 @@ User interface controls. Whether to commit modified subrepositories when committing the parent repository. If False and one subrepository has uncommitted changes, abort the commit. - Default is True. + Default is False. ``debug`` Print debugging information. True or False. Default is False. diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1062,11 +1062,12 @@ class localrepository(repo.repository): '.hgsubstate' not in changes[0] + changes[1] + changes[2]): changes[2].insert(0, '.hgsubstate') - if subs and not self.ui.configbool('ui', 'commitsubrepos', True): + if subs and not self.ui.configbool('ui', 'commitsubrepos', False): changedsubs = [s for s in subs if wctx.sub(s).dirty(True)] if changedsubs: raise util.Abort(_("uncommitted changes in subrepo %s") - % changedsubs[0]) + % changedsubs[0], + hint=_("use --subrepos for recursive commit")) # make sure all explicit patterns are matched if not force and match.files(): diff --git a/tests/test-debugcomplete.t b/tests/test-debugcomplete.t --- a/tests/test-debugcomplete.t +++ b/tests/test-debugcomplete.t @@ -191,7 +191,7 @@ Show all commands + options add: include, exclude, subrepos, dry-run annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, include, exclude clone: noupdate, updaterev, rev, branch, pull, uncompressed, ssh, remotecmd, insecure - commit: addremove, close-branch, include, exclude, message, logfile, date, user + commit: addremove, close-branch, include, exclude, message, logfile, date, user, subrepos diff: rev, change, text, git, nodates, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, unified, stat, include, exclude, subrepos export: output, switch-parent, rev, text, git, nodates forget: include, exclude diff --git a/tests/test-mq-subrepo.t b/tests/test-mq-subrepo.t --- a/tests/test-mq-subrepo.t +++ b/tests/test-mq-subrepo.t @@ -1,3 +1,5 @@ + $ echo "[ui]" >> $HGRCPATH + $ echo "commitsubrepos = Yes" >> $HGRCPATH $ echo "[extensions]" >> $HGRCPATH $ echo "mq=" >> $HGRCPATH $ echo "record=" >> $HGRCPATH diff --git a/tests/test-qrecord.t b/tests/test-qrecord.t --- a/tests/test-qrecord.t +++ b/tests/test-qrecord.t @@ -64,6 +64,7 @@ help record (record) -l --logfile FILE read commit message from file -d --date DATE record the specified date as commit date -u --user USER record the specified user as committer + -S --subrepos recurse into subrepositories -w --ignore-all-space ignore white space when comparing lines -b --ignore-space-change ignore changes in the amount of white space -B --ignore-blank-lines ignore changes whose lines are all blank diff --git a/tests/test-subrepo-deep-nested-change.t b/tests/test-subrepo-deep-nested-change.t --- a/tests/test-subrepo-deep-nested-change.t +++ b/tests/test-subrepo-deep-nested-change.t @@ -77,7 +77,7 @@ debugsub output for main and sub1 Modifying deeply nested 'sub2' $ echo modified > cloned/sub1/sub2/sub2 - $ hg commit -m "deep nested modif should trigger a commit" -R cloned + $ hg commit --subrepos -m "deep nested modif should trigger a commit" -R cloned committing subrepository sub1 committing subrepository sub1/sub2 diff --git a/tests/test-subrepo-git.t b/tests/test-subrepo-git.t --- a/tests/test-subrepo-git.t +++ b/tests/test-subrepo-git.t @@ -103,7 +103,7 @@ clone root, make local change $ echo ggg >> s/g $ hg status --subrepos M s/g - $ hg commit -m ggg + $ hg commit --subrepos -m ggg committing subrepository s $ hg debugsub path s @@ -125,7 +125,7 @@ clone root separately, make different lo $ hg status --subrepos A s/f - $ hg commit -m f + $ hg commit --subrepos -m f committing subrepository s $ hg debugsub path s @@ -164,7 +164,7 @@ user a pulls, merges, commits g gg ggg - $ hg commit -m 'merge' + $ hg commit --subrepos -m 'merge' committing subrepository s $ hg status --subrepos --rev 1:5 M .hgsubstate @@ -294,7 +294,7 @@ nested commit $ echo ffff >> inner/s/f $ hg status --subrepos M inner/s/f - $ hg commit -m nested + $ hg commit --subrepos -m nested committing subrepository inner committing subrepository inner/s @@ -325,7 +325,7 @@ Don't crash if the subrepo is missing $ hg push -q abort: subrepo s is missing [255] - $ hg commit -qm missing + $ hg commit --subrepos -qm missing abort: subrepo s is missing [255] $ hg update -C diff --git a/tests/test-subrepo-recursion.t b/tests/test-subrepo-recursion.t --- a/tests/test-subrepo-recursion.t +++ b/tests/test-subrepo-recursion.t @@ -58,7 +58,14 @@ Test recursive diff without committing a Commits: - $ hg commit -m 0-0-0 + $ hg commit -m fails + abort: uncommitted changes in subrepo foo + (use --subrepos for recursive commit) + [255] + +The --subrepos flag overwrite the config setting: + + $ hg commit -m 0-0-0 --config ui.commitsubrepos=No --subrepos committing subrepository foo committing subrepository foo/bar @@ -177,7 +184,7 @@ Status with relative path: Cleanup and final commit: $ rm -r dir - $ hg commit -m 2-3-2 + $ hg commit --subrepos -m 2-3-2 committing subrepository foo committing subrepository foo/bar @@ -394,7 +401,7 @@ Make nested change: y2 y3 +y4 - $ hg commit -m 3-4-2 + $ hg commit --subrepos -m 3-4-2 committing subrepository foo $ hg outgoing -S comparing with $TESTTMP/repo diff --git a/tests/test-subrepo-svn.t b/tests/test-subrepo-svn.t --- a/tests/test-subrepo-svn.t +++ b/tests/test-subrepo-svn.t @@ -105,7 +105,7 @@ change file in svn and hg, commit branch: default commit: 1 modified, 1 subrepos update: (current) - $ hg commit -m 'Message!' + $ hg commit --subrepos -m 'Message!' committing subrepository s Sending*s/alpha (glob) Transmitting file data . @@ -171,7 +171,7 @@ add a commit from svn this commit from hg will fail $ echo zzz >> s/alpha - $ hg ci -m 'amend alpha from hg' + $ hg ci --subrepos -m 'amend alpha from hg' committing subrepository s abort: svn: Commit failed (details follow): svn: (Out of date)?.*/src/alpha.*(is out of date)? (re) @@ -182,7 +182,7 @@ this commit fails because of meta change $ svn propset svn:mime-type 'text/html' s/alpha property 'svn:mime-type' set on 's/alpha' - $ hg ci -m 'amend alpha from hg' + $ hg ci --subrepos -m 'amend alpha from hg' committing subrepository s abort: svn: Commit failed (details follow): svn: (Out of date)?.*/src/alpha.*(is out of date)? (re) @@ -192,7 +192,7 @@ this commit fails because of meta change this commit fails because of externals changes $ echo zzz > s/externals/other - $ hg ci -m 'amend externals from hg' + $ hg ci --subrepos -m 'amend externals from hg' committing subrepository s abort: cannot commit svn externals [255] @@ -214,7 +214,7 @@ this commit fails because of externals m $ svn propset svn:mime-type 'text/html' s/externals/other property 'svn:mime-type' set on 's/externals/other' - $ hg ci -m 'amend externals from hg' + $ hg ci --subrepos -m 'amend externals from hg' committing subrepository s abort: cannot commit svn externals [255] @@ -523,7 +523,7 @@ This is surprising, but is also correct Point to a Subversion branch which has since been deleted and recreated First, create that condition in the repository. - $ hg ci -m cleanup + $ hg ci --subrepos -m cleanup committing subrepository obstruct Sending obstruct/other Transmitting file data . diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t --- a/tests/test-subrepo.t +++ b/tests/test-subrepo.t @@ -1,3 +1,8 @@ +Let commit recurse into subrepos by default to match pre-2.0 behavior: + + $ echo "[ui]" >> $HGRCPATH + $ echo "commitsubrepos = Yes" >> $HGRCPATH + $ rm -rf sub $ mkdir sub $ cd sub @@ -107,6 +112,7 @@ leave sub dirty (and check ui.commitsubr $ echo c > s/a $ hg --config ui.commitsubrepos=no ci -m4 abort: uncommitted changes in subrepo s + (use --subrepos for recursive commit) [255] $ hg ci -m4 committing subrepository s