Mercurial > hg-onsub
diff onsub.py @ 18:d920e3425db5
Added parameter to filter the type of subrepo to loop through.
Added tests.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Thu, 29 Mar 2012 16:18:57 -0700 |
parents | 5ea3f7533ec5 |
children | 132e522fda32 |
line wrap: on
line diff
--- a/onsub.py Tue Mar 27 16:53:23 2012 -0700 +++ b/onsub.py Thu Mar 29 16:18:57 2012 -0700 @@ -63,6 +63,7 @@ precmd = None postcmd = None includeroot = opts.get('root_repo') + repotypefilter = opts.get('type') def execCmd(sub, cmd, kind): """if sub == None, cmd is executed inside repo; else, inside sub. @@ -91,7 +92,7 @@ HG_REPO=repo.root, HG_SUBTYPE=kind) cmdwd = os.path.join(repo.root, relpath) - if cmd != None: + if cmd != None and (repotypefilter == '' or repotypefilter == kind): if print0: ui.write(relpath, "\0") if cmd != '': @@ -184,7 +185,9 @@ _('limit recursion to N levels (negative for no limit)'), 'N'), ('', 'ignore-errors', None, _('continue execution despite errors')), + ('t', 'type', '', + _('the type of repo to filter'), 'TYPE'), ('0', 'print0', None, _('end subrepository names with NUL, for use with xargs'))], - _('[-b] [-0] [--ignore-errors] CMD [POST-CMD]')) + _('[-b] [-0] [-t TYPE] [--ignore-errors] CMD [POST-CMD]')) }