changeset 6:a41d82517c45

fix quirks spotted by pychecker
author Robin Farine <robin.farine@terminus.org>
date Sun, 23 Jul 2006 14:42:52 +0200
parents 7648fb26fde9
children 118793cfcca3
files forest.py
diffstat 1 files changed, 8 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/forest.py	Sat Jul 22 01:08:39 2006 +0200
+++ b/forest.py	Sun Jul 23 14:42:52 2006 +0200
@@ -28,10 +28,8 @@
 
 import ConfigParser
 import os
-import sys
 
-import mercurial.node
-from mercurial import commands, hg, util
+from mercurial import commands, hg, node, util
 
 try: # 'find' renamed as 'findcmd' after Mercurial 0.9
     from mercurial.commands import findcmd
@@ -167,7 +165,7 @@
             if mq_patches_applied(repo.root):
                 ui.warn(_("mq patches applied\n"))
                 continue
-            func(repo, rev, path)
+            func(repo, path, rev)
 
 
     def update(self, ui, repo):
@@ -185,7 +183,7 @@
                 raise util.Abort(_("'%s' has mq patches applied") % root)
             if root != '.':
                 repo = repository(ui, root)
-            rev = mercurial.node.hex(repo.dirstate.parents()[0])
+            rev = node.hex(repo.dirstate.parents()[0])
             paths = dict(repo.ui.configitems('paths'))
             if self.rootmap.has_key(root):
                 tree = self.rootmap[root]
@@ -244,7 +242,7 @@
     opts['force'] = None
     opts['rev'] = []
 
-    def doit(repo, rev, path):
+    def doit(repo, path, *unused):
         commands.pull(repo.ui, repo, path, **opts)
 
     snapshot = ForestSnapshot(snapfile)
@@ -265,7 +263,7 @@
     opts['force'] = None
     opts['rev'] = []
 
-    def doit(repo, rev, path):
+    def doit(repo, path, *unused):
         commands.push(repo.ui, repo, path, **opts)
 
     snapshot = ForestSnapshot(snapfile)
@@ -284,6 +282,7 @@
         if not cfg.has_section(section):
             break
         root = cfg.get(section, 'root')
+        dest = util.localpath(root)
         psect = section + '.paths'
         if not cfg.has_option(psect, pathalias):
             ui.warn(_("no path alias '%s' defined for tree '%s'\n") %
@@ -291,7 +290,6 @@
             continue
         source = cfg.get(psect, pathalias)
         ui.write("\n[%s]\n" % root)
-        dest = util.localpath(root)
         if os.path.exists(dest):
             ui.warn(_("destination '%s' already exists, skipping\n") % dest)
             continue
@@ -304,7 +302,7 @@
         commands.clone(ui, source, dest, **opts)
         if not opts['tip']:
             rev = cfg.get(section, 'revision')
-            if rev and rev != mercurial.node.nullid:
+            if rev and rev != node.nullid:
                 repo = repository(ui, dest)
                 commands.update(repo.ui, repo, node=rev)
 
@@ -329,7 +327,7 @@
         commands.status(repo.ui, repo, *pats, **opts)
 
 
-def trees(ui, repo):
+def trees(ui, *unused):
     """List the roots of the repositories."""
 
     for root in enumerate_repos():