changeset 20:132e522fda32

compatibility with mercurial 3.8
author viktor.kuzmin
date Wed, 18 May 2016 16:30:12 +0300
parents 30bdbd5f6173
children 003eee5497e0
files onsub.py
diffstat 1 files changed, 20 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/onsub.py	Thu Apr 12 10:33:30 2012 +0200
+++ b/onsub.py	Wed May 18 16:30:12 2016 +0300
@@ -7,10 +7,29 @@
 
 import os
 from mercurial.i18n import _
-from mercurial import extensions, subrepo, util
+from mercurial import extensions, subrepo, util, cmdutil
+
+cmdtable = {}
+command = cmdutil.command(cmdtable)
 
 """execute a command in each subrepository"""
 
+@command("onsub",
+         [('b', 'breadth-first', None,
+           _('use breadth-first traversal')),
+          ('p', 'post-order', None,
+           _('use post-order depth-first traversal')),
+          ('', 'root-repo', None,
+           _('include root repository in traversal')),
+          ('', 'max-depth', -1,
+           _('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] [-t TYPE] [--ignore-errors] CMD [POST-CMD]'))
 def onsub(ui, repo, *args, **opts):
     """execute a command in each subrepository
 
@@ -171,23 +190,3 @@
         bfs()
     else:
         dfs()
-          
-cmdtable = {
-    "onsub":
-        (onsub,
-         [('b', 'breadth-first', None,
-           _('use breadth-first traversal')),
-          ('p', 'post-order', None,
-           _('use post-order depth-first traversal')),
-          ('', 'root-repo', None,
-           _('include root repository in traversal')),
-          ('', 'max-depth', -1,
-           _('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] [-t TYPE] [--ignore-errors] CMD [POST-CMD]'))
-}