changeset 22:f21f26513968 default tip

Update for Mercurial 4.8.
author Ludovic Chabant <ludovic@chabant.com>
date Sat, 03 Nov 2018 23:38:48 -0700
parents 003eee5497e0
children
files onsub.py
diffstat 1 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/onsub.py	Mon May 08 20:03:41 2017 +0200
+++ b/onsub.py	Sat Nov 03 23:38:48 2018 -0700
@@ -7,10 +7,10 @@
 
 import os
 from mercurial.i18n import _
-from mercurial import extensions, subrepo, util, cmdutil
+from mercurial import extensions, subrepo, util, registrar
 
 cmdtable = {}
-command = cmdutil.command(cmdtable)
+command = registrar.command(cmdtable)
 
 """execute a command in each subrepository"""
 
@@ -86,7 +86,7 @@
 
     def execCmd(sub, cmd, kind):
         """if sub == None, cmd is executed inside repo; else, inside sub.
-        If cmd == None, do nothing. If cmd == '', do only the print0 (if needed). 
+        If cmd == None, do nothing. If cmd == '', do only the print0 (if needed).
         Else, do either print0 or the debugging message, then execute the command.
         kind is the type of the (sub)repo.
         """
@@ -128,44 +128,44 @@
     def bfs():
         """execute precmd in repo.root and in each subrepository, breadth-first"""
         if includeroot:
-            execCmd(None, precmd, 'hg') 
+            execCmd(None, precmd, 'hg')
         ctx = repo['.']
         work = [(1, ctx.sub(subpath), ctx.substate[subpath][2]) for subpath in sorted(ctx.substate)]
         while work:
             (depth, sub, kind) = work.pop(0)
             if depth > maxdepth >= 0:
                 continue
-            execCmd(sub, precmd, kind) 
+            execCmd(sub, precmd, kind)
             if kind == 'hg':
                 rev = sub._state[1]
                 ctx = sub._repo[rev]
-                w = [(depth + 1, ctx.sub(subpath), ctx.substate[subpath][2]) 
+                w = [(depth + 1, ctx.sub(subpath), ctx.substate[subpath][2])
                      for subpath in sorted(ctx.substate)]
                 work.extend(w)
-    
+
     def dfs():
         """execute pre-/postcmd in repo.root and in each subrepository, depth-first"""
 
         def dfs_rek(depth, sub, kind):
             if depth > maxdepth >= 0:
                 return
-            execCmd(sub, precmd, kind) 
+            execCmd(sub, precmd, kind)
             if kind == 'hg':
                 rev = sub._state[1]
                 ctx = sub._repo[rev]
                 for subpath in sorted(ctx.substate):
                     dfs_rek(depth+1, ctx.sub(subpath), ctx.substate[subpath][2])
             execCmd(sub, postcmd, kind)
-    
+
         ctx = repo['.']
         work = [(ctx.sub(subpath), ctx.substate[subpath][2]) for subpath in sorted(ctx.substate)]
         if includeroot:
-            execCmd(None, precmd, 'hg') 
+            execCmd(None, precmd, 'hg')
         for (sub, kind) in work:
             dfs_rek(1, sub, kind)
         if includeroot:
-            execCmd(None, postcmd, 'hg') 
-        
+            execCmd(None, postcmd, 'hg')
+
     ### start of main function part ###
     if len(args) == 2:
         precmd = args[0]