changeset 832:e9af7eba88db

globally: clean up whitespace around operators and commas to conform with PEP8 Mostly autoformatted by Eclipse. A few manual corrections were performed where Eclipse's autoformatter did something non-idiomatic.
author Yonggang Luo <luoyonggang@gmail.com>
date Wed, 12 Oct 2011 15:35:25 +0800
parents be5bbb2f2d68
children 312b37bc5e20
files hgsubversion/editor.py hgsubversion/stupid.py hgsubversion/svncommands.py hgsubversion/svnmeta.py hgsubversion/svnwrap/common.py hgsubversion/svnwrap/subvertpy_wrapper.py hgsubversion/svnwrap/svn_swig_wrapper.py hgsubversion/util.py tests/comprehensive/test_stupid_pull.py tests/fixtures/rsvn.py tests/test_diff.py tests/test_externals.py tests/test_fetch_command.py tests/test_fetch_symlinks.py tests/test_push_command.py tests/test_push_dirs.py tests/test_push_renames.py tests/test_rebuildmeta.py tests/test_single_dir_clone.py tests/test_startrev.py tests/test_svnwrap.py tests/test_tags.py tests/test_template_keywords.py tests/test_urls.py tests/test_util.py tests/test_utility_commands.py
diffstat 26 files changed, 107 insertions(+), 106 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/editor.py
+++ b/hgsubversion/editor.py
@@ -119,7 +119,7 @@ class HgEditor(svnwrap.Editor):
                 # assuming it is a directory
                 self.current.externals[path] = None
                 map(self.current.delete, [pat for pat in self.current.files.iterkeys()
-                                          if pat.startswith(path+'/')])
+                                          if pat.startswith(path + '/')])
                 for f in ctx.walk(util.PrefixMatch(br_path2)):
                     f_p = '%s/%s' % (path, f[len(br_path2):])
                     if f_p not in self.current.files:
--- a/hgsubversion/stupid.py
+++ b/hgsubversion/stupid.py
@@ -408,7 +408,7 @@ def fetch_externals(ui, svn, branchpath,
     # revision in the common case.
     dirs = set(externals)
     if parentctx.node() == revlog.nullid:
-        dirs.update([p for p,k in svn.list_files(branchpath, r.revnum) if k == 'd'])
+        dirs.update([p for p, k in svn.list_files(branchpath, r.revnum) if k == 'd'])
         dirs.add('')
     else:
         branchprefix = (branchpath and branchpath + '/') or branchpath
@@ -560,7 +560,7 @@ def branches_in_paths(meta, tbdelta, pat
             # we need to detect those branches. It's a little thorny and slow, but
             # seems to be the best option.
             elif paths[p].copyfrom_path and not p.startswith('tags/'):
-                paths_need_discovery.extend(['%s/%s' % (p,x[0])
+                paths_need_discovery.extend(['%s/%s' % (p, x[0])
                                              for x in listdir(p, revnum)
                                              if x[1] == 'f'])
 
--- a/hgsubversion/svncommands.py
+++ b/hgsubversion/svncommands.py
@@ -55,7 +55,7 @@ def verify(ui, repo, args=None, **opts):
         svnfiles.add(fn)
         fp = fn
         if branchpath:
-            fp = branchpath + '/'  + fn
+            fp = branchpath + '/' + fn
         data, mode = svn.get_file(posixpath.normpath(fp), srev)
         fctx = ctx[fn]
         dmatch = fctx.data() == data
--- a/hgsubversion/svnmeta.py
+++ b/hgsubversion/svnmeta.py
@@ -257,7 +257,7 @@ class SVNMeta(object):
                     branchpath = branch[3:]
                 else:
                     branchpath = 'branches/%s' % branch
-            path = '%s/%s' % (subdir , branchpath)
+            path = '%s/%s' % (subdir, branchpath)
 
         extra['convert_revision'] = 'svn:%(uuid)s%(path)s@%(rev)s' % {
             'uuid': self.uuid,
@@ -368,7 +368,7 @@ class SVNMeta(object):
         else:
             path = test.split('/')[-1]
             test = '/'.join(test.split('/')[:-1])
-        ln =  self.localname(test)
+        ln = self.localname(test)
         if ln and ln.startswith('../'):
             return None, None, None
         return path, ln, test
@@ -424,7 +424,7 @@ class SVNMeta(object):
             branch_created_rev = self.branches[branch][2]
             if parent_branch == 'trunk':
                 parent_branch = None
-            if branch_created_rev <= number+1 and branch != parent_branch:
+            if branch_created_rev <= number + 1 and branch != parent_branch:
                 # did the branch exist in previous run
                 if exact and branch in self.prevbranches:
                     if self.prevbranches[branch][1] < real_num:
@@ -450,7 +450,7 @@ class SVNMeta(object):
                     return node.hex(self.revmap[tagged])
                 tag = fromtag
             # Reference an existing tag
-            limitedtags = maps.Tags(self.repo, endrev=number-1)
+            limitedtags = maps.Tags(self.repo, endrev=number - 1)
             if tag in limitedtags:
                 return limitedtags[tag]
         r, br = self.get_parent_svn_branch_and_rev(number - 1, branch, exact)
@@ -609,7 +609,7 @@ class SVNMeta(object):
             branchparent = branchparent.parents()[0]
         branch = self.get_source_rev(ctx=branchparent)[1]
 
-        parentctx = self.repo[self.get_parent_revision(rev.revnum+1, branch)]
+        parentctx = self.repo[self.get_parent_revision(rev.revnum + 1, branch)]
         if '.hgtags' in parentctx:
             tagdata = parentctx.filectx('.hgtags').data()
         else:
--- a/hgsubversion/svnwrap/common.py
+++ b/hgsubversion/svnwrap/common.py
@@ -38,7 +38,7 @@ def parse_url(url, user=None, passwd=Non
                 user, passwd = userpass, ''
             user, passwd = urllib.unquote(user), urllib.unquote(passwd)
     if user and scheme == 'svn+ssh':
-        netloc = '@'.join((user, netloc, ))
+        netloc = '@'.join((user, netloc,))
     url = urlparse.urlunparse((scheme, netloc, path, params, query, fragment))
     return (user or None, passwd or None, url)
 
--- a/hgsubversion/svnwrap/subvertpy_wrapper.py
+++ b/hgsubversion/svnwrap/subvertpy_wrapper.py
@@ -87,7 +87,7 @@ class PathAdapter(object):
             self.copyfrom_path = intern(self.copyfrom_path)
 
 class AbstractEditor(object):
-    __slots__ = ('editor', )
+    __slots__ = ('editor',)
 
     def __init__(self, editor):
         self.editor = editor
@@ -131,7 +131,7 @@ class AbstractEditor(object):
         self.editor.delete_entry(path, revnum, None)
 
 class FileEditor(AbstractEditor):
-    __slots__ = ('path', )
+    __slots__ = ('path',)
 
     def __init__(self, editor, path):
         super(FileEditor, self).__init__(editor)
@@ -145,7 +145,7 @@ class FileEditor(AbstractEditor):
         del self.path
 
 class DirectoryEditor(AbstractEditor):
-    __slots__ = ('path', )
+    __slots__ = ('path',)
 
     def __init__(self, editor, path):
         super(DirectoryEditor, self).__init__(editor)
@@ -306,7 +306,7 @@ class SubversionRepo(object):
                 #       ra.get_log(), even with chunk_size set, takes a while
                 #       when converting the 65k+ rev. in LLVM.
                 self.remote.get_log(paths=paths, revprops=revprops,
-                                    start=start+1, end=stop, limit=chunk_size,
+                                    start=start + 1, end=stop, limit=chunk_size,
                                     discover_changed_paths=True,
                                     callback=callback)
             except SubversionException, e:
@@ -477,7 +477,7 @@ class SubversionRepo(object):
                 # File not found
                 raise IOError(errno.ENOENT, e.args[0])
             raise
-        if mode  == 'l':
+        if mode == 'l':
             linkprefix = "link "
             if data.startswith(linkprefix):
                 data = data[len(linkprefix):]
@@ -531,4 +531,4 @@ class SubversionRepo(object):
         if not path or path == '.':
             return self.svn_url
         assert path[0] != '/', path
-        return '/'.join((self.svn_url, urllib.quote(path).rstrip('/'), ))
+        return '/'.join((self.svn_url, urllib.quote(path).rstrip('/'),))
--- a/hgsubversion/svnwrap/svn_swig_wrapper.py
+++ b/hgsubversion/svnwrap/svn_swig_wrapper.py
@@ -293,7 +293,7 @@ class SubversionRepo(object):
                 #       when converting the 65k+ rev. in LLVM.
                 ra.get_log(self.ra,
                            paths,
-                           start+1,
+                           start + 1,
                            stop,
                            chunk_size, #limit of how many log messages to load
                            True, # don't need to know changed paths
@@ -497,7 +497,7 @@ class SubversionRepo(object):
             if e.args[1] in notfound: # File not found
                 raise IOError(errno.ENOENT, e.args[0])
             raise
-        if mode  == 'l':
+        if mode == 'l':
             linkprefix = "link "
             if data.startswith(linkprefix):
                 data = data[len(linkprefix):]
--- a/hgsubversion/util.py
+++ b/hgsubversion/util.py
@@ -35,7 +35,7 @@ def filterdiff(diff, oldrev, newrev):
                                   diff)
     oldrev = formatrev(oldrev)
     newrev = formatrev(newrev)
-    diff = a_re.sub(r'--- \1'+ oldrev, diff)
+    diff = a_re.sub(r'--- \1' + oldrev, diff)
     diff = b_re.sub(r'+++ \1' + newrev, diff)
     diff = devnull_re.sub(r'\1 /dev/null\t(working copy)', diff)
     diff = header_re.sub(r'Index: \1' + '\n' + ('=' * 67), diff)
@@ -65,9 +65,9 @@ def islocalrepo(url):
     path = url[prefixlen:]
     path = urllib.url2pathname(path).replace(os.sep, '/')
     while '/' in path:
-        if reduce(lambda x,y: x and y,
+        if reduce(lambda x, y: x and y,
                   map(lambda p: os.path.exists(os.path.join(path, p)),
-                      ('hooks', 'format', 'db', ))):
+                      ('hooks', 'format', 'db',))):
             return True
         path = path.rsplit('/', 1)[0]
     return False
--- a/tests/comprehensive/test_stupid_pull.py
+++ b/tests/comprehensive/test_stupid_pull.py
@@ -52,7 +52,7 @@ for case in (f for f in os.listdir(test_
     name += '_single'
     attrs[name] = buildmethod(case, name, 'single')
 
-StupidPullTests = type('StupidPullTests', (test_util.TestBase, ), attrs)
+StupidPullTests = type('StupidPullTests', (test_util.TestBase,), attrs)
 
 
 def suite():
--- a/tests/fixtures/rsvn.py
+++ b/tests/fixtures/rsvn.py
@@ -169,7 +169,7 @@ def rsvn(pool):
     sys.stderr.write(str(e) + '\n\n')
     usage()
     sys.exit(1)
-  
+
   for opt, value in opts:
     if opt == '--version':
       print '%s version %s' % (os.path.basename(sys.argv[0]), VERSION)
@@ -181,75 +181,75 @@ def rsvn(pool):
       username = value
     elif opt == '--message':
       log_msg = value
-  
+
   if log_msg == None:
     usage('Missing --message argument')
     sys.exit(1)
-  
+
   if len(args) != 1:
     usage('Missing repository path argument')
     sys.exit(1)
-  
+
   repos_path = args[0]
   print 'Accessing repository at [%s]' % repos_path
 
   repository = Repository(repos_path, pool)
   sub = repository.subpool()
-  
+
   try:
     txn = repository.begin(username, log_msg)
-  
+
     # Read commands from STDIN
     lineno = 0
     for line in sys.stdin:
       lineno += 1
-      
+
       core.svn_pool_clear(sub)
       try:
         if COMMENT_RE.search(line):
           continue
-    
+
         match = RCOPY_RE.search(line)
         if match:
           src = match.group(1)
           dest = match.group(2)
           txn.copy(src, dest, sub)
           continue
-    
+
         match = RMOVE_RE.search(line)
         if match:
           src = match.group(1)
           dest = match.group(2)
           txn.move(src, dest, sub)
           continue
-    
+
         match = RMKDIR_RE.search(line)
         if match:
           entry = match.group(1)
           txn.mkdir(entry, sub)
           continue
-    
+
         match = RDELETE_RE.search(line)
         if match:
           entry = match.group(1)
           txn.delete(entry, sub)
           continue
-  
+
         raise NameError, ('Unknown command [%s] on line %d' %
             (line, lineno))
-    
+
       except:
-        sys.stderr.write(('Exception occured while processing line %d:\n' % 
+        sys.stderr.write(('Exception occured while processing line %d:\n' %
             lineno))
         etype, value, tb = sys.exc_info()
         traceback.print_exception(etype, value, tb, None, sys.stderr)
         sys.stderr.write('\n')
         txn.rollback()
         sys.exit(1)
-  
+
     new_rev = txn.commit()
     print '\nCommitted revision %d.' % new_rev
-  
+
   finally:
     print '\nRepository closed.'
 
--- a/tests/test_diff.py
+++ b/tests/test_diff.py
@@ -33,7 +33,7 @@ class DiffTests(test_util.TestBase):
                             ])
         u = ui.ui()
         u.pushbuffer()
-        wrappers.diff(lambda x,y,z: None, u, self.repo, svn=True)
+        wrappers.diff(lambda x, y, z: None, u, self.repo, svn=True)
         self.assertEqual(u.popbuffer(), expected_diff_output)
 
 
--- a/tests/test_externals.py
+++ b/tests/test_externals.py
@@ -10,7 +10,7 @@ try:
     subrepo.svnsubrepo
     hgutil.checknlink
 except (ImportError, AttributeError), e:
-    print >>sys.stderr, 'test_externals: skipping .hgsub tests'
+    print >> sys.stderr, 'test_externals: skipping .hgsub tests'
     subrepo = None
 
 from hgsubversion import svnexternals
@@ -358,7 +358,7 @@ HEAD subdir2/deps/project2
         self.assertchanges(changes, self.repo['tip'])
 
         # Check .hgsub and .hgsubstate were not pushed
-        self.assertEqual(['dir', 'subdir1', 'subdir1/a','subdir2',
+        self.assertEqual(['dir', 'subdir1', 'subdir1/a', 'subdir2',
                           'subdir2/a'], self.svnls('trunk'))
 
         # Remove all references from one directory, add a new one
--- a/tests/test_fetch_command.py
+++ b/tests/test_fetch_command.py
@@ -165,7 +165,7 @@ class TestBasicRepoLayout(test_util.Test
 
         commands.clone(ui, repo_url + subdir, wc_path)
         commands.clone(ui, repo_url + quoted_subdir, wc2_path)
-        repo  = hg.repository(ui, wc_path)
+        repo = hg.repository(ui, wc_path)
         repo2 = hg.repository(ui, wc2_path)
 
         self.assertEqual(repo['tip'].extra()['convert_revision'],
--- a/tests/test_fetch_symlinks.py
+++ b/tests/test_fetch_symlinks.py
@@ -39,7 +39,7 @@ class TestFetchSymlinks(test_util.TestBa
                 'linka4': 'link to this',
                 },
             }
-            
+
         for rev in repo:
             ctx = repo[rev]
             for f in ctx.manifest():
--- a/tests/test_push_command.py
+++ b/tests/test_push_command.py
@@ -43,7 +43,7 @@ class PushTests(test_util.TestBase):
                              file_callback,
                              'an_author',
                              '2008-10-07 20:59:48 -0500',
-                             {'branch': 'default',})
+                             {'branch': 'default', })
         new_hash = repo.commitctx(ctx)
         hg.update(repo, repo['tip'].node())
         old_tip = repo['tip'].node()
@@ -64,7 +64,7 @@ class PushTests(test_util.TestBase):
                              file_callback,
                              'an_author',
                              '2008-10-07 20:59:48 -0500',
-                             {'branch': 'default',})
+                             {'branch': 'default', })
         new_hash = repo.commitctx(ctx)
         hg.update(repo, repo['tip'].node())
         # Touch an existing file
@@ -116,7 +116,7 @@ class PushTests(test_util.TestBase):
                                  filectxfn=file_callback,
                                  user='an_author',
                                  date='2008-10-07 20:59:48 -0500',
-                                 extra={'branch': 'default',})
+                                 extra={'branch': 'default', })
             new_hash = repo.commitctx(ctx)
             if not commit:
                 return # some tests use this test as an extended setup.
@@ -161,7 +161,7 @@ class PushTests(test_util.TestBase):
                              file_callback,
                              'an_author',
                              '2008-10-07 20:59:48 -0500',
-                             {'branch': 'default',})
+                             {'branch': 'default', })
         new_hash = repo.commitctx(ctx)
         if not commit:
             return # some tests use this test as an extended setup.
@@ -183,7 +183,7 @@ class PushTests(test_util.TestBase):
                                       copied=False)
         oldtiphash = self.repo['default'].node()
         ctx = context.memctx(self.repo,
-                             (self.repo[0].node(), revlog.nullid, ),
+                             (self.repo[0].node(), revlog.nullid,),
                              'automated test',
                              ['gamma', ],
                              filectxfn,
@@ -229,7 +229,7 @@ class PushTests(test_util.TestBase):
                              file_callback,
                              'an_author',
                              '2008-10-07 20:59:48 -0500',
-                             {'branch': 'default',})
+                             {'branch': 'default', })
         new_hash = repo.commitctx(ctx)
         hg.update(repo, repo['tip'].node())
         self.pushrevisions()
@@ -264,7 +264,7 @@ class PushTests(test_util.TestBase):
                              file_callback,
                              'an_author',
                              '2008-10-07 20:59:48 -0500',
-                             {'branch': 'the_branch',})
+                             {'branch': 'the_branch', })
         new_hash = repo.commitctx(ctx)
         hg.update(repo, repo['tip'].node())
         if push:
@@ -291,7 +291,7 @@ class PushTests(test_util.TestBase):
         oldf.close()
 
         # do a commit here
-        self.commitchanges([('foobaz', 'foobaz', 'This file is added on default.', ),
+        self.commitchanges([('foobaz', 'foobaz', 'This file is added on default.',),
                             ],
                            parent='default',
                            message='commit to default')
@@ -469,13 +469,13 @@ class PushTests(test_util.TestBase):
 
     def test_push_outdated_base_text(self):
         self.test_push_two_revs()
-        changes = [('adding_file', 'adding_file', 'different_content', ),
+        changes = [('adding_file', 'adding_file', 'different_content',),
                    ]
         par = self.repo['tip'].rev()
         self.commitchanges(changes, parent=par)
         self.pushrevisions()
         changes = [('adding_file', 'adding_file',
-                    'even_more different_content', ),
+                    'even_more different_content',),
                    ]
         self.commitchanges(changes, parent=par)
         try:
--- a/tests/test_push_dirs.py
+++ b/tests/test_push_dirs.py
@@ -48,7 +48,7 @@ class TestPushDirectories(test_util.Test
     def test_push_new_dir_project_root_not_repo_root(self):
         self._load_fixture_and_fetch('fetch_missing_files_subdir.svndump',
                                      subdir='foo')
-        changes = [('magic_new/a', 'magic_new/a', 'ohai', ),
+        changes = [('magic_new/a', 'magic_new/a', 'ohai',),
                    ]
         self.commitchanges(changes)
         self.pushrevisions()
@@ -64,20 +64,21 @@ class TestPushDirectories(test_util.Test
     def test_push_new_file_existing_dir_root_not_repo_root(self):
         self._load_fixture_and_fetch('empty_dir_in_trunk_not_repo_root.svndump',
                                      subdir='project')
-        changes = [('narf/a', 'narf/a', 'ohai', ),
+        changes = [('narf/a', 'narf/a', 'ohai',),
                    ]
         self.commitchanges(changes)
         self.assertEqual(self.svnls('project/trunk'), ['a',
-                                                       'narf',])
+                                                       'narf',
+                                                       ])
         self.pushrevisions()
         self.assertEqual(self.svnls('project/trunk'), ['a',
                                                        'narf',
                                                        'narf/a'])
-        changes = [('narf/a', None, None, ),
+        changes = [('narf/a', None, None,),
                    ]
         self.commitchanges(changes)
         self.pushrevisions()
-        self.assertEqual(self.svnls('project/trunk'), ['a' ,])
+        self.assertEqual(self.svnls('project/trunk'), ['a'])
 
     def test_push_single_dir_change_in_subdir(self):
         # Tests simple pushing from default branch to a single dir repo
--- a/tests/test_push_renames.py
+++ b/tests/test_push_renames.py
@@ -79,9 +79,9 @@ class TestPushRenames(test_util.TestBase
             ('geek/delta', 'geek/delta', 'content',),
             ('geek/gamma', 'geek/gamma', 'content',),
             ('geek/later/pi', 'geek/later/pi', 'content geek/later/pi',),
-            ('geek/later/rho', 'geek/later/rho', 'content geek/later/rho', ),
-            ('geek/other/blah', 'geek/other/blah', 'content geek/other/blah', ),
-            ('geek/other/another/layer', 'geek/other/another/layer', 'content deep file', ),
+            ('geek/later/rho', 'geek/later/rho', 'content geek/later/rho',),
+            ('geek/other/blah', 'geek/other/blah', 'content geek/other/blah',),
+            ('geek/other/another/layer', 'geek/other/another/layer', 'content deep file',),
             ]
 
         self.commitchanges(changes)
@@ -90,29 +90,29 @@ class TestPushRenames(test_util.TestBase
 
         changes = [
             # rename (copy + remove) all of geek to greek
-            ('geek/alpha', 'greek/alpha', None, ),
-            ('geek/beta', 'greek/beta', None, ),
-            ('geek/delta', 'greek/delta', None, ),
-            ('geek/gamma', 'greek/gamma', None, ),
-            ('geek/later/pi', 'greek/later/pi', None, ),
-            ('geek/later/rho', 'greek/later/rho', None, ),
-            ('geek/other/blah', 'greek/other/blah', None, ),
-            ('geek/other/another/layer', 'greek/other/another/layer', None, ),
+            ('geek/alpha', 'greek/alpha', None,),
+            ('geek/beta', 'greek/beta', None,),
+            ('geek/delta', 'greek/delta', None,),
+            ('geek/gamma', 'greek/gamma', None,),
+            ('geek/later/pi', 'greek/later/pi', None,),
+            ('geek/later/rho', 'greek/later/rho', None,),
+            ('geek/other/blah', 'greek/other/blah', None,),
+            ('geek/other/another/layer', 'greek/other/another/layer', None,),
 
-            ('geek/alpha', None, None, ),
-            ('geek/beta', None, None, ),
-            ('geek/delta', None, None, ),
-            ('geek/gamma', None, None, ),
-            ('geek/later/pi', None, None, ),
-            ('geek/later/rho', None, None, ),
-            ('geek/other/blah', None, None, ),
-            ('geek/other/another/layer', None, None, ),
+            ('geek/alpha', None, None,),
+            ('geek/beta', None, None,),
+            ('geek/delta', None, None,),
+            ('geek/gamma', None, None,),
+            ('geek/later/pi', None, None,),
+            ('geek/later/rho', None, None,),
+            ('geek/other/blah', None, None,),
+            ('geek/other/another/layer', None, None,),
             ]
         self.commitchanges(changes)
         self.pushrevisions()
         # print '\n'.join(sorted(self.svnls('trunk')))
         assert reduce(lambda x, y: x and y,
-                      ('geek' not in f for f in self.svnls('trunk'))),(
+                      ('geek' not in f for f in self.svnls('trunk'))), (
             'This failure means rename of an entire tree is broken.'
             ' There is a print on the preceding line commented out '
             'that should help you.')
--- a/tests/test_rebuildmeta.py
+++ b/tests/test_rebuildmeta.py
@@ -55,7 +55,7 @@ def _do_case(self, name, stupid, single)
     self.assertTrue(os.path.isdir(os.path.join(src.path, 'svn')),
                     'no .hg/svn directory in the destination!')
     dest = hg.repository(u, os.path.dirname(dest.path))
-    for tf in ('lastpulled', 'rev_map', 'uuid', 'tagmap', 'layout', 'subdir', ):
+    for tf in ('lastpulled', 'rev_map', 'uuid', 'tagmap', 'layout', 'subdir',):
 
         stf = os.path.join(src.path, 'svn', tf)
         self.assertTrue(os.path.isfile(stf), '%r is missing!' % stf)
@@ -113,7 +113,7 @@ for case in [f for f in os.listdir(test_
     name = bname + '_single'
     attrs[name] = buildmethod(case, name, False, True)
 
-RebuildMetaTests = type('RebuildMetaTests', (test_util.TestBase, ), attrs)
+RebuildMetaTests = type('RebuildMetaTests', (test_util.TestBase,), attrs)
 
 
 def suite():
--- a/tests/test_single_dir_clone.py
+++ b/tests/test_single_dir_clone.py
@@ -105,7 +105,7 @@ class TestSingleDir(test_util.TestBase):
                              file_callback,
                              'an_author',
                              '2009-10-19 18:49:30 -0500',
-                             {'branch': 'default',})
+                             {'branch': 'default', })
         repo.commitctx(ctx)
         hg.update(repo, repo['tip'].node())
         self.pushrevisions()
@@ -136,7 +136,7 @@ class TestSingleDir(test_util.TestBase):
                              filectxfn,
                              'an_author',
                              '2009-10-19 18:49:30 -0500',
-                             {'branch': 'localhacking',})
+                             {'branch': 'localhacking', })
         n = repo.commitctx(ctx)
         self.assertEqual(self.repo['tip']['bogus'].data(),
                          'contents of bogus')
@@ -171,7 +171,7 @@ class TestSingleDir(test_util.TestBase):
                                  file_callback,
                                  'an_author',
                                  '2009-10-19 18:49:30 -0500',
-                                 {'branch': 'default',})
+                                 {'branch': 'default', })
             repo.commitctx(ctx)
         hg.update(repo, repo['tip'].node())
         self.pushrevisions(expected_extra_back=1)
@@ -206,7 +206,7 @@ class TestSingleDir(test_util.TestBase):
                                           file_callback(name),
                                           'an_author',
                                           '2009-10-19 18:49:30 -0500',
-                                          {'branch': name,}))
+                                          {'branch': name, }))
 
         parent = repo['tip'].node()
         commit_to_branch('default', parent)
@@ -252,7 +252,7 @@ class TestSingleDir(test_util.TestBase):
                              file_callback,
                              'an_author',
                              '2009-10-19 18:49:30 -0500',
-                             {'branch': 'default',})
+                             {'branch': 'default', })
         self.repo.commitctx(ctx)
         hg.update(self.repo, self.repo['tip'].node())
         self.pushrevisions()
--- a/tests/test_startrev.py
+++ b/tests/test_startrev.py
@@ -61,7 +61,7 @@ for case in [f for f in os.listdir(test_
     name = bname + '_stupid'
     attrs[name] = buildmethod(case, name, subdir, True)
 
-StartRevTests = type('StartRevTests', (test_util.TestBase, ), attrs)
+StartRevTests = type('StartRevTests', (test_util.TestBase,), attrs)
 
 
 def suite():
--- a/tests/test_svnwrap.py
+++ b/tests/test_svnwrap.py
@@ -22,10 +22,10 @@ class TestBasicRepoLayout(unittest.TestC
     def setUp(self):
         self.tmpdir = tempfile.mkdtemp('svnwrap_test')
         self.repo_path = '%s/testrepo' % self.tmpdir
-        subprocess.call(['svnadmin', 'create', self.repo_path,])
+        subprocess.call(['svnadmin', 'create', self.repo_path, ])
         inp = open(os.path.join(os.path.dirname(__file__), 'fixtures',
                                 'project_root_at_repo_root.svndump'))
-        proc = subprocess.call(['svnadmin', 'load', self.repo_path,],
+        proc = subprocess.call(['svnadmin', 'load', self.repo_path, ],
                                 stdin=inp,
                                 close_fds=test_util.canCloseFds,
                                 stdout=subprocess.PIPE,
@@ -57,10 +57,10 @@ class TestRootAsSubdirOfRepo(TestBasicRe
     def setUp(self):
         self.tmpdir = tempfile.mkdtemp('svnwrap_test')
         self.repo_path = '%s/testrepo' % self.tmpdir
-        subprocess.call(['svnadmin', 'create', self.repo_path,])
+        subprocess.call(['svnadmin', 'create', self.repo_path, ])
         inp = open(os.path.join(os.path.dirname(__file__), 'fixtures',
                                 'project_root_not_repo_root.svndump'))
-        ret = subprocess.call(['svnadmin', 'load', self.repo_path,],
+        ret = subprocess.call(['svnadmin', 'load', self.repo_path, ],
                               stdin=inp,
                               close_fds=test_util.canCloseFds,
                               stdout=subprocess.PIPE,
--- a/tests/test_tags.py
+++ b/tests/test_tags.py
@@ -138,9 +138,9 @@ rename a tag
        openheads = [h for h in heads if not repo[h].extra().get('close', False)]
        closedheads = set(heads) - set(openheads)
        self.assertEqual(len(openheads), 1)
-       self.assertEqual(len(closedheads), headcount-1)
+       self.assertEqual(len(closedheads), headcount - 1)
        closedheads = sorted(list(closedheads),
-                            cmp=lambda x,y: cmp(repo[x].rev(), repo[y].rev()))
+                            cmp=lambda x, y: cmp(repo[x].rev(), repo[y].rev()))
 
        # closeme has no open heads
        for h in openheads:
--- a/tests/test_template_keywords.py
+++ b/tests/test_template_keywords.py
@@ -82,5 +82,5 @@ class TestLogKeywords(test_util.TestBase
                           template='{rev}:{svnrev} ', **defaults)
 
 def suite():
-    all = [unittest.TestLoader().loadTestsFromTestCase(TestLogKeywords),]
+    all = [unittest.TestLoader().loadTestsFromTestCase(TestLogKeywords), ]
     return unittest.TestSuite(all)
--- a/tests/test_urls.py
+++ b/tests/test_urls.py
@@ -29,16 +29,16 @@ class TestSubversionUrls(test_util.TestB
 
     def test_svnssh_preserve_user(self):
         self.assertEqual(
-            ('user', 't3stpw', 'svn+ssh://user@svn.testurl.com/repo', ),
+            ('user', 't3stpw', 'svn+ssh://user@svn.testurl.com/repo',),
             parse_url('svn+ssh://user:t3stpw@svn.testurl.com/repo'))
         self.assertEqual(
-            ('bob', '123abc', 'svn+ssh://bob@svn.testurl.com/repo', ),
+            ('bob', '123abc', 'svn+ssh://bob@svn.testurl.com/repo',),
             parse_url('svn+ssh://user:t3stpw@svn.testurl.com/repo', 'bob', '123abc'))
         self.assertEqual(
-            ('user2', None, 'svn+ssh://user2@svn.testurl.com/repo', ),
+            ('user2', None, 'svn+ssh://user2@svn.testurl.com/repo',),
             parse_url('svn+ssh://user2@svn.testurl.com/repo'))
         self.assertEqual(
-            ('bob', None, 'svn+ssh://bob@svn.testurl.com/repo', ),
+            ('bob', None, 'svn+ssh://bob@svn.testurl.com/repo',),
             parse_url('svn+ssh://user2@svn.testurl.com/repo', 'bob'))
 
     def test_user_password_url(self):
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -43,7 +43,7 @@ from hgsubversion import util
 #   "Note that on Windows, you cannot set close_fds to true and
 #   also redirect the standard handles by setting stdin, stdout or
 #   stderr."
-canCloseFds='win32' not in sys.platform
+canCloseFds = 'win32' not in sys.platform
 
 if not 'win32' in sys.platform:
     def kill_process(popen_obj):
@@ -75,7 +75,7 @@ else:
         DWORD, 'dwProcessId',
     )
 
-    CloseHandle =  WINAPI(BOOL, ctypes.windll.kernel32.CloseHandle,
+    CloseHandle = WINAPI(BOOL, ctypes.windll.kernel32.CloseHandle,
         HANDLE, 'hObject'
     )
 
@@ -163,10 +163,10 @@ def load_svndump_fixture(path, fixture_n
     already exist.
     '''
     if os.path.exists(path): rmtree(path)
-    subprocess.call(['svnadmin', 'create', path,],
+    subprocess.call(['svnadmin', 'create', path, ],
                     stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
     inp = open(os.path.join(FIXTURES, fixture_name))
-    proc = subprocess.Popen(['svnadmin', 'load', path,], stdin=inp,
+    proc = subprocess.Popen(['svnadmin', 'load', path, ], stdin=inp,
                             stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
     proc.communicate()
 
@@ -248,8 +248,8 @@ class TestBase(unittest.TestCase):
     def setUp(self):
         _verify_our_modules()
 
-        self.oldenv = dict([(k, os.environ.get(k, None), ) for k in
-                           ('LANG', 'LC_ALL', 'HGRCPATH', )])
+        self.oldenv = dict([(k, os.environ.get(k, None),) for k in
+                           ('LANG', 'LC_ALL', 'HGRCPATH',)])
         self.oldt = i18n.t
         os.environ['LANG'] = os.environ['LC_ALL'] = 'C'
         i18n.t = gettext.translation('hg', i18n.localedir, fallback=True)
--- a/tests/test_utility_commands.py
+++ b/tests/test_utility_commands.py
@@ -112,7 +112,7 @@ class UtilityTests(test_util.TestBase):
         self._load_fixture_and_fetch('two_heads.svndump')
         u = self.ui()
         u.pushbuffer()
-        parents = (self.repo['the_branch'].node(), revlog.nullid, )
+        parents = (self.repo['the_branch'].node(), revlog.nullid,)
         def filectxfn(repo, memctx, path):
             return context.memfilectx(path=path,
                                       data='added',
@@ -155,7 +155,7 @@ class UtilityTests(test_util.TestBase):
     def test_outgoing_output(self):
         self._load_fixture_and_fetch('two_heads.svndump')
         u = self.ui()
-        parents = (self.repo['the_branch'].node(), revlog.nullid, )
+        parents = (self.repo['the_branch'].node(), revlog.nullid,)
         def filectxfn(repo, memctx, path):
             return context.memfilectx(path=path,
                                       data='added',
@@ -185,7 +185,7 @@ class UtilityTests(test_util.TestBase):
 
     def test_rebase(self):
         self._load_fixture_and_fetch('two_revs.svndump')
-        parents = (self.repo[0].node(), revlog.nullid, )
+        parents = (self.repo[0].node(), revlog.nullid,)
         def filectxfn(repo, memctx, path):
             return context.memfilectx(path=path,
                                       data='added',