← Back to team overview

dulwich-users team mailing list archive

[PATCH 2/4] MissingObjectFinder: minor cleanup: 80 chars, others.

 

From: Dave Borowitz <dborowitz@xxxxxxxxxx>

Change-Id: I06fe864a6a89d1b77cffd13aac790c15b64224ff
---
 NEWS                    |    2 ++
 dulwich/object_store.py |   13 +++++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/NEWS b/NEWS
index 14cb030..75fe560 100644
--- a/NEWS
+++ b/NEWS
@@ -50,6 +50,8 @@
   * Use real in-memory objects rather than stubs for server tests.
     (Dave Borowitz)
 
+  * Clean up MissingObjectFinder. (Dave Borowitz)
+
  API CHANGES
 
   * ObjectStore.iter_tree_contents now walks contents in depth-first, sorted
diff --git a/dulwich/object_store.py b/dulwich/object_store.py
index 61192d7..162f102 100644
--- a/dulwich/object_store.py
+++ b/dulwich/object_store.py
@@ -711,8 +711,10 @@ class MissingObjectFinder(object):
 
     def __init__(self, object_store, haves, wants, progress=None,
                  get_tagged=None):
-        self.sha_done = set(haves)
-        self.objects_to_send = set([(w, None, False) for w in wants if w not in haves])
+        haves = set(haves)
+        self.sha_done = haves
+        self.objects_to_send = set([(w, None, False) for w in wants
+                                    if w not in haves])
         self.object_store = object_store
         if progress is None:
             self.progress = lambda x: None
@@ -721,10 +723,13 @@ class MissingObjectFinder(object):
         self._tagged = get_tagged and get_tagged() or {}
 
     def add_todo(self, entries):
-        self.objects_to_send.update([e for e in entries if not e[0] in self.sha_done])
+        self.objects_to_send.update([e for e in entries
+                                     if not e[0] in self.sha_done])
 
     def parse_tree(self, tree):
-        self.add_todo([(sha, name, not stat.S_ISDIR(mode)) for (mode, name, sha) in tree.entries() if not S_ISGITLINK(mode)])
+        self.add_todo([(sha, name, not stat.S_ISDIR(mode))
+                       for mode, name, sha in tree.entries()
+                       if not S_ISGITLINK(mode)])
 
     def parse_commit(self, commit):
         self.add_todo([(commit.tree, "", False)])
-- 
1.7.2




Follow ups

References