Mercurial > public > mercurial-scm > hg-stable
diff mercurial/subrepo.py @ 23540:f274d27f1994
addremove: automatically process a subrepository's subrepos
Since addremove on the top of a directory tree will recursively handle sub
directories, it should be the same with deep subrepos, once the user has
explicitly asked to process a subrepo. This really only has an effect when a
path that is a subrepo (or is in a subrepo) is given, since -S causes all
subrepos to be processed already. An addremove without a path that crosses into
a subrepo, will still not enter any subrepos, per backward compatibility rules.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sun, 30 Nov 2014 22:47:53 -0500 |
parents | f1b06a8aad42 |
children | 7fa2189c1e87 |
line wrap: on
line diff
--- a/mercurial/subrepo.py Sun Nov 09 23:46:25 2014 -0500 +++ b/mercurial/subrepo.py Sun Nov 30 22:47:53 2014 -0500 @@ -5,6 +5,7 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. +import copy import errno, os, re, shutil, posixpath, sys import xml.dom.minidom import stat, subprocess, tarfile @@ -624,6 +625,11 @@ os.path.join(prefix, self._path), explicitonly) def addremove(self, m, prefix, opts, dry_run, similarity): + # In the same way as sub directories are processed, once in a subrepo, + # always entry any of its subrepos. Don't corrupt the options that will + # be used to process sibling subrepos however. + opts = copy.copy(opts) + opts['subrepos'] = True return scmutil.addremove(self._repo, m, os.path.join(prefix, self._path), opts, dry_run, similarity)