Mercurial > hg-onsub
comparison onsub.py @ 20:132e522fda32
compatibility with mercurial 3.8
author | viktor.kuzmin |
---|---|
date | Wed, 18 May 2016 16:30:12 +0300 |
parents | d920e3425db5 |
children | 003eee5497e0 |
comparison
equal
deleted
inserted
replaced
19:30bdbd5f6173 | 20:132e522fda32 |
---|---|
5 # This software may be used and distributed according to the terms of | 5 # This software may be used and distributed according to the terms of |
6 # the GNU General Public License version 2 or any later version. | 6 # the GNU General Public License version 2 or any later version. |
7 | 7 |
8 import os | 8 import os |
9 from mercurial.i18n import _ | 9 from mercurial.i18n import _ |
10 from mercurial import extensions, subrepo, util | 10 from mercurial import extensions, subrepo, util, cmdutil |
11 | |
12 cmdtable = {} | |
13 command = cmdutil.command(cmdtable) | |
11 | 14 |
12 """execute a command in each subrepository""" | 15 """execute a command in each subrepository""" |
13 | 16 |
17 @command("onsub", | |
18 [('b', 'breadth-first', None, | |
19 _('use breadth-first traversal')), | |
20 ('p', 'post-order', None, | |
21 _('use post-order depth-first traversal')), | |
22 ('', 'root-repo', None, | |
23 _('include root repository in traversal')), | |
24 ('', 'max-depth', -1, | |
25 _('limit recursion to N levels (negative for no limit)'), 'N'), | |
26 ('', 'ignore-errors', None, | |
27 _('continue execution despite errors')), | |
28 ('t', 'type', '', | |
29 _('the type of repo to filter'), 'TYPE'), | |
30 ('0', 'print0', None, | |
31 _('end subrepository names with NUL, for use with xargs'))], | |
32 _('[-b] [-0] [-t TYPE] [--ignore-errors] CMD [POST-CMD]')) | |
14 def onsub(ui, repo, *args, **opts): | 33 def onsub(ui, repo, *args, **opts): |
15 """execute a command in each subrepository | 34 """execute a command in each subrepository |
16 | 35 |
17 Executes CMD with the current working directory set to the root of | 36 Executes CMD with the current working directory set to the root of |
18 each subrepository. By default, execution stops if CMD returns a | 37 each subrepository. By default, execution stops if CMD returns a |
169 | 188 |
170 if opts.get('breadth_first'): | 189 if opts.get('breadth_first'): |
171 bfs() | 190 bfs() |
172 else: | 191 else: |
173 dfs() | 192 dfs() |
174 | |
175 cmdtable = { | |
176 "onsub": | |
177 (onsub, | |
178 [('b', 'breadth-first', None, | |
179 _('use breadth-first traversal')), | |
180 ('p', 'post-order', None, | |
181 _('use post-order depth-first traversal')), | |
182 ('', 'root-repo', None, | |
183 _('include root repository in traversal')), | |
184 ('', 'max-depth', -1, | |
185 _('limit recursion to N levels (negative for no limit)'), 'N'), | |
186 ('', 'ignore-errors', None, | |
187 _('continue execution despite errors')), | |
188 ('t', 'type', '', | |
189 _('the type of repo to filter'), 'TYPE'), | |
190 ('0', 'print0', None, | |
191 _('end subrepository names with NUL, for use with xargs'))], | |
192 _('[-b] [-0] [-t TYPE] [--ignore-errors] CMD [POST-CMD]')) | |
193 } |