# HG changeset patch # User Augie Fackler # Date 1227306079 21600 # Node ID a3b717e4abf561063140386510c1fae41aee23ac # Parent 91ce18fa037541416f7453feb224c2daafa5edad Cleanups based on pyflakes output. diff --git a/fetch_command.py b/fetch_command.py --- a/fetch_command.py +++ b/fetch_command.py @@ -1,6 +1,5 @@ import cStringIO import re -import operator import os import shutil import tempfile @@ -124,7 +123,7 @@ def replay_convert_rev(hg_editor, svn, r hg_editor.ui.flush() if p[-1] == '/': dirpath = p[len(rootpath):] - files_to_grab.update((dirpath + f for f,k in + files_to_grab.update((dirpath + f for f,k in svn.list_files(p, r.revnum) if k == 'f')) else: files_to_grab.add(p[len(rootpath):]) @@ -207,7 +206,7 @@ def makecopyfinder(r, branchpath, rootdi copies.sort() copies.reverse() exactcopies = dict(copies) - + def finder(path): if path in exactcopies: return exactcopies[path], exactcopies[path][0] @@ -280,9 +279,9 @@ def stupid_fetch_branchrev(svn, hg_edito # Branch does not exist at this revision. Get parent revision and # remove everything. files = parentctx.manifest().keys() - def filectxfn(repo, memctx, path): + def filectxfn_rm(repo, memctx, path): raise IOError() - return files, filectxfn + return files, filectxfn_rm files = [] if parentid == revlog.nullid: @@ -314,10 +313,10 @@ def stupid_fetch_branchrev(svn, hg_edito # Assume it's a deleted directory path = path + '/' deleted = [f for f in parentctx if f.startswith(path)] - files += deleted + files += deleted copies = getcopies(svn, hg_editor, branch, branchpath, r, files, parentid) - + def filectxfn(repo, memctx, path): data, mode = svn.get_file(branchpath + '/' + path, r.revnum) isexec = 'x' in mode @@ -516,7 +515,7 @@ def stupid_svn_server_pull_rev(ui, svn, if p: files_touched.add(p) - copies = getcopies(svn, hg_editor, b, branches[b], r, files_touched, + copies = getcopies(svn, hg_editor, b, branches[b], r, files_touched, parent_ha) def filectxfn(repo, memctx, path): diff --git a/tests/test_fetch_command.py b/tests/test_fetch_command.py --- a/tests/test_fetch_command.py +++ b/tests/test_fetch_command.py @@ -1,12 +1,9 @@ -import os -import tempfile import unittest from mercurial import hg from mercurial import ui from mercurial import node -import fetch_command import test_util diff --git a/tests/test_fetch_renames.py b/tests/test_fetch_renames.py --- a/tests/test_fetch_renames.py +++ b/tests/test_fetch_renames.py @@ -1,14 +1,6 @@ -import os -import shutil import sys -import tempfile import unittest -from mercurial import hg -from mercurial import ui -from mercurial import node - -import fetch_command import test_util diff --git a/tests/test_fetch_symlinks.py b/tests/test_fetch_symlinks.py --- a/tests/test_fetch_symlinks.py +++ b/tests/test_fetch_symlinks.py @@ -1,14 +1,5 @@ -import os -import shutil -import sys -import tempfile import unittest -from mercurial import hg -from mercurial import ui -from mercurial import node - -import fetch_command import test_util diff --git a/tests/test_push_command.py b/tests/test_push_command.py --- a/tests/test_push_command.py +++ b/tests/test_push_command.py @@ -1,11 +1,9 @@ import os import socket import subprocess -import tempfile import unittest from mercurial import context -from mercurial import commands from mercurial import hg from mercurial import node from mercurial import ui @@ -300,7 +298,7 @@ class PushTests(test_util.TestBase): # while we're here, double check pushing an already-executable file # works repo = self.repo - def file_callback(repo, memctx, path): + def file_callback2(repo, memctx, path): return context.memfilectx(path=path, data='bar', islink=link, @@ -310,7 +308,7 @@ class PushTests(test_util.TestBase): (repo['default'].node(), node.nullid), 'message', ['alpha', ], - file_callback, + file_callback2, 'author', '2008-1-1 00:00:00 -0500', {'branch': 'default', }) @@ -324,7 +322,7 @@ class PushTests(test_util.TestBase): self.assertEqual(tip['alpha'].flags(), expected_flags) # now test removing the property entirely repo = self.repo - def file_callback(repo, memctx, path): + def file_callback3(repo, memctx, path): return context.memfilectx(path=path, data='bar', islink=False, @@ -334,7 +332,7 @@ class PushTests(test_util.TestBase): (repo['default'].node(), node.nullid), 'message', ['alpha', ], - file_callback, + file_callback3, 'author', '2008-01-01 00:00:00 -0500', {'branch': 'default', }) diff --git a/tests/test_tags.py b/tests/test_tags.py --- a/tests/test_tags.py +++ b/tests/test_tags.py @@ -1,5 +1,3 @@ -import os -import tempfile import unittest from mercurial import hg diff --git a/utility_commands.py b/utility_commands.py --- a/utility_commands.py +++ b/utility_commands.py @@ -1,4 +1,3 @@ -from mercurial import context from mercurial import cmdutil from mercurial import node from mercurial import util as mutil