changeset 895:1959fd51ea12

hg2git: flake8 cleanup
author Sean Farley <sean@farley.io>
date Wed, 22 Apr 2015 16:42:48 -0700
parents 0d258c2d0e91
children a1e47539644e
files hggit/hg2git.py
diffstat 1 files changed, 16 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/hggit/hg2git.py
+++ b/hggit/hg2git.py
@@ -6,7 +6,6 @@
 import stat
 
 import dulwich.objects as dulobjs
-from dulwich import diff_tree
 from mercurial import util as hgutil
 
 import compat
@@ -107,11 +106,12 @@
     def __init__(self, hg_repo, start_ctx, git_store, git_commit):
         """Create an instance against a mercurial.localrepo.
 
-        start_ctx is the context for a Mercurial commit that has a Git
-        equivalent, passed in as git_commit. The incremental computation will be
-        started from this commit. git_store is the Git object store the commit
-        comes from. start_ctx can be repo[nullid], in which case git_commit
-        should be None.
+        start_ctx: the context for a Mercurial commit that has a Git
+                   equivalent, passed in as git_commit. The incremental
+                   computation will be started from this commit.
+        git_store: the Git object store the commit comes from.
+
+        start_ctx can be repo[nullid], in which case git_commit should be None.
         """
         self._hg = hg_repo
 
@@ -199,7 +199,8 @@
                 subadded, subremoved = self._handle_subrepos(newctx)
                 break
 
-        # We first process subrepo and file removals so we can prune dead trees.
+        # We first process subrepo and file removals so we can prune dead
+        # trees.
         for path in subremoved:
             self._remove_path(path, dirty_trees)
 
@@ -229,8 +230,8 @@
 
             fctx = newctx[path]
 
-            entry, blob = IncrementalChangesetExporter.tree_entry(fctx,
-                self._blob_cache)
+            func = IncrementalChangesetExporter.tree_entry
+            entry, blob = func(fctx, self._blob_cache)
             if blob is not None:
                 yield (blob, fctx.filenode())
 
@@ -373,8 +374,8 @@
         #
         # All other combinations are 'do nothing'.
         #
-        # git links without corresponding submodule paths are stored as subrepos
-        # with a substate but without an entry in .hgsub.
+        # git links without corresponding submodule paths are stored as
+        # subrepos with a substate but without an entry in .hgsub.
 
         # 'added' is both modified and added
         added, removed = [], []
@@ -393,7 +394,8 @@
 
         for path, sha in newsubstate.iteritems():
             if not isgit(newsub, path):
-                # new = hg or no; the only cases we care about are handled above
+                # new = hg or no; the only cases we care about are handled
+                # above
                 continue
 
             # case (1)
@@ -426,5 +428,5 @@
         else:
             mode = 0100644
 
-        return (dulobjs.TreeEntry(os.path.basename(fctx.path()), mode, blob_id),
-                blob)
+        return (dulobjs.TreeEntry(os.path.basename(fctx.path()), mode,
+                                  blob_id), blob)