# HG changeset patch # User Matt Harbison # Date 1415594785 18000 # Node ID cb42050f2dadfbb876452e23287441a937c20c5c # Parent ccfb56450f21e627d8d960a15e00b8d27176693a addremove: support addremove with explicit paths in subrepos Git and svn subrepos are currently not supported. diff -r ccfb56450f21 -r cb42050f2dad mercurial/help/subrepos.txt --- a/mercurial/help/subrepos.txt Mon Nov 24 23:51:26 2014 -0500 +++ b/mercurial/help/subrepos.txt Sun Nov 09 23:46:25 2014 -0500 @@ -82,8 +82,10 @@ ignored. :addremove: addremove does not recurse into subrepos unless - -S/--subrepos is specified. Git and Subversion subrepositories - will print a warning and continue. + -S/--subrepos is specified. However, if you specify the full + path of a directory in a subrepo, addremove will be performed on + it even without -S/--subrepos being specified. Git and + Subversion subrepositories will print a warning and continue. :archive: archive does not recurse in subrepositories unless -S/--subrepos is specified. diff -r ccfb56450f21 -r cb42050f2dad mercurial/scmutil.py --- a/mercurial/scmutil.py Mon Nov 24 23:51:26 2014 -0500 +++ b/mercurial/scmutil.py Sun Nov 09 23:46:25 2014 -0500 @@ -723,9 +723,17 @@ ret = 0 join = lambda f: os.path.join(prefix, f) + def matchessubrepo(matcher, subpath): + if matcher.exact(subpath): + return True + for f in matcher.files(): + if f.startswith(subpath): + return True + return False + wctx = repo[None] for subpath in sorted(wctx.substate): - if opts.get('subrepos'): + if opts.get('subrepos') or matchessubrepo(m, subpath): sub = wctx.sub(subpath) try: submatch = matchmod.narrowmatcher(subpath, m) diff -r ccfb56450f21 -r cb42050f2dad tests/test-subrepo-deep-nested-change.t --- a/tests/test-subrepo-deep-nested-change.t Mon Nov 24 23:51:26 2014 -0500 +++ b/tests/test-subrepo-deep-nested-change.t Sun Nov 09 23:46:25 2014 -0500 @@ -147,9 +147,18 @@ A sub1/foo R sub1/sub2/test.txt $ hg update -Cq + $ touch sub1/sub2/folder/bar + $ hg addremove sub1/sub2 + adding sub1/sub2/folder/bar (glob) + $ hg status -S + A sub1/sub2/folder/bar + ? foo/bar/abc + ? sub1/foo + $ hg update -Cq $ rm sub1/sub2/folder/test.txt $ rm sub1/sub2/test.txt $ hg ci -ASm "remove test.txt" + adding sub1/sub2/folder/bar (glob) removing sub1/sub2/folder/test.txt (glob) removing sub1/sub2/test.txt (glob) adding sub1/foo (glob)