MissingObjectFinder: minor cleanup: 80 chars, others.
authorDavid Borowitz <dborowitz@google.com>
Thu, 26 Aug 2010 00:31:55 +0000 (02:31 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Thu, 26 Aug 2010 00:31:55 +0000 (02:31 +0200)
NEWS
dulwich/object_store.py

diff --git a/NEWS b/NEWS
index 5dc436993308ac79619361d8981df415e9142468..0fd3e463e283a1b7a2fadd7846862ac1bd02857f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -48,6 +48,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
index 61192d7e9479c8874534ed5a2575ef4e36fbcff1..162f1024cde883ef2965b9236b46e0948eb1531b 100644 (file)
@@ -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)])