[cig-commits] commit: fix quirks spotted by pychecker

Mercurial hg at geodynamics.org
Mon Nov 24 11:26:47 PST 2008


changeset:   6:a41d82517c45
user:        Robin Farine <robin.farine at terminus.org>
date:        Sun Jul 23 14:42:52 2006 +0200
files:       forest.py
description:
fix quirks spotted by pychecker


diff -r 7648fb26fde9 -r a41d82517c45 forest.py
--- 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 @@ version = "0.1"
 
 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 @@ class ForestSnapshot(object):
             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 @@ class ForestSnapshot(object):
                 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 @@ def pull(ui, toprepo, snapfile, pathalia
     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 @@ def push(ui, toprepo, snapfile, pathalia
     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 @@ def seed(ui, repo, snapshot, pathalias, 
         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 @@ def seed(ui, repo, snapshot, pathalias, 
             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 @@ def seed(ui, repo, snapshot, pathalias, 
         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 @@ def status(ui, repo, *pats, **opts):
         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():



More information about the CIG-COMMITS mailing list