comparison 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
comparison
equal deleted inserted replaced
23539:cb42050f2dad 23540:f274d27f1994
3 # Copyright 2009-2010 Matt Mackall <mpm@selenic.com> 3 # Copyright 2009-2010 Matt Mackall <mpm@selenic.com>
4 # 4 #
5 # This software may be used and distributed according to the terms of the 5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version. 6 # GNU General Public License version 2 or any later version.
7 7
8 import copy
8 import errno, os, re, shutil, posixpath, sys 9 import errno, os, re, shutil, posixpath, sys
9 import xml.dom.minidom 10 import xml.dom.minidom
10 import stat, subprocess, tarfile 11 import stat, subprocess, tarfile
11 from i18n import _ 12 from i18n import _
12 import config, util, node, error, cmdutil, scmutil, match as matchmod 13 import config, util, node, error, cmdutil, scmutil, match as matchmod
622 def add(self, ui, match, dryrun, listsubrepos, prefix, explicitonly): 623 def add(self, ui, match, dryrun, listsubrepos, prefix, explicitonly):
623 return cmdutil.add(ui, self._repo, match, dryrun, listsubrepos, 624 return cmdutil.add(ui, self._repo, match, dryrun, listsubrepos,
624 os.path.join(prefix, self._path), explicitonly) 625 os.path.join(prefix, self._path), explicitonly)
625 626
626 def addremove(self, m, prefix, opts, dry_run, similarity): 627 def addremove(self, m, prefix, opts, dry_run, similarity):
628 # In the same way as sub directories are processed, once in a subrepo,
629 # always entry any of its subrepos. Don't corrupt the options that will
630 # be used to process sibling subrepos however.
631 opts = copy.copy(opts)
632 opts['subrepos'] = True
627 return scmutil.addremove(self._repo, m, 633 return scmutil.addremove(self._repo, m,
628 os.path.join(prefix, self._path), opts, 634 os.path.join(prefix, self._path), opts,
629 dry_run, similarity) 635 dry_run, similarity)
630 636
631 @annotatesubrepoerror 637 @annotatesubrepoerror