2
0
Эх сурвалжийг харах

object_store: clean up whitespace

Change-Id: Ifa5cda814fb3aef7cfe68c27cd0388dc35c4cfa9
Augie Fackler 15 жил өмнө
parent
commit
aedc71394a

+ 20 - 20
dulwich/object_store.py

@@ -60,7 +60,8 @@ class BaseObjectStore(object):
     """Object store interface."""
     """Object store interface."""
 
 
     def determine_wants_all(self, refs):
     def determine_wants_all(self, refs):
-	    return [sha for (ref, sha) in refs.iteritems() if not sha in self and not ref.endswith("^{}")]
+        return [sha for (ref, sha) in refs.iteritems()
+                if not sha in self and not ref.endswith("^{}")]
 
 
     def iter_shas(self, shas):
     def iter_shas(self, shas):
         """Iterate over the objects for the specified shas.
         """Iterate over the objects for the specified shas.
@@ -148,7 +149,7 @@ class BaseObjectStore(object):
                     newmode = None
                     newmode = None
                     newhexsha = None
                     newhexsha = None
                     newchildpath = None
                     newchildpath = None
-                if (want_unchanged or oldmode != newmode or 
+                if (want_unchanged or oldmode != newmode or
                     oldhexsha != newhexsha):
                     oldhexsha != newhexsha):
                     if stat.S_ISDIR(oldmode):
                     if stat.S_ISDIR(oldmode):
                         if newmode is None or stat.S_ISDIR(newmode):
                         if newmode is None or stat.S_ISDIR(newmode):
@@ -182,7 +183,7 @@ class BaseObjectStore(object):
         while todo:
         while todo:
             (tid, tpath) = todo.pop()
             (tid, tpath) = todo.pop()
             tree = self[tid]
             tree = self[tid]
-            for name, mode, hexsha in tree.iteritems(): 
+            for name, mode, hexsha in tree.iteritems():
                 path = posixpath.join(tpath, name)
                 path = posixpath.join(tpath, name)
                 if stat.S_ISDIR(mode):
                 if stat.S_ISDIR(mode):
                     todo.add((hexsha, path))
                     todo.add((hexsha, path))
@@ -195,7 +196,7 @@ class BaseObjectStore(object):
 
 
         :param haves: Iterable over SHAs already in common.
         :param haves: Iterable over SHAs already in common.
         :param wants: Iterable over SHAs of objects to fetch.
         :param wants: Iterable over SHAs of objects to fetch.
-        :param progress: Simple progress function that will be called with 
+        :param progress: Simple progress function that will be called with
             updated progress strings.
             updated progress strings.
         :param get_tagged: Function that returns a dict of pointed-to sha -> tag
         :param get_tagged: Function that returns a dict of pointed-to sha -> tag
             sha for including tags.
             sha for including tags.
@@ -221,7 +222,7 @@ class BaseObjectStore(object):
 
 
     def get_graph_walker(self, heads):
     def get_graph_walker(self, heads):
         """Obtain a graph walker for this object store.
         """Obtain a graph walker for this object store.
-        
+
         :param heads: Local heads to start search with
         :param heads: Local heads to start search with
         :return: GraphWalker object
         :return: GraphWalker object
         """
         """
@@ -304,7 +305,7 @@ class PackBasedObjectStore(BaseObjectStore):
                 return pack.get_raw(sha)
                 return pack.get_raw(sha)
             except KeyError:
             except KeyError:
                 pass
                 pass
-        if hexsha is None: 
+        if hexsha is None:
             hexsha = sha_to_hex(name)
             hexsha = sha_to_hex(name)
         ret = self._get_loose_object(hexsha)
         ret = self._get_loose_object(hexsha)
         if ret is not None:
         if ret is not None:
@@ -387,7 +388,7 @@ class DiskObjectStore(PackBasedObjectStore):
     def move_in_thin_pack(self, path):
     def move_in_thin_pack(self, path):
         """Move a specific file containing a pack into the pack directory.
         """Move a specific file containing a pack into the pack directory.
 
 
-        :note: The file should be on the same file system as the 
+        :note: The file should be on the same file system as the
             packs directory.
             packs directory.
 
 
         :param path: Path to the pack file.
         :param path: Path to the pack file.
@@ -395,13 +396,13 @@ class DiskObjectStore(PackBasedObjectStore):
         data = ThinPackData(self.get_raw, path)
         data = ThinPackData(self.get_raw, path)
 
 
         # Write index for the thin pack (do we really need this?)
         # Write index for the thin pack (do we really need this?)
-        temppath = os.path.join(self.pack_dir, 
+        temppath = os.path.join(self.pack_dir,
             sha_to_hex(urllib2.randombytes(20))+".tempidx")
             sha_to_hex(urllib2.randombytes(20))+".tempidx")
         data.create_index_v2(temppath)
         data.create_index_v2(temppath)
         p = Pack.from_objects(data, load_pack_index(temppath))
         p = Pack.from_objects(data, load_pack_index(temppath))
 
 
         # Write a full pack version
         # Write a full pack version
-        temppath = os.path.join(self.pack_dir, 
+        temppath = os.path.join(self.pack_dir,
             sha_to_hex(urllib2.randombytes(20))+".temppack")
             sha_to_hex(urllib2.randombytes(20))+".temppack")
         write_pack(temppath, ((o, None) for o in p.iterobjects()), len(p))
         write_pack(temppath, ((o, None) for o in p.iterobjects()), len(p))
         pack_sha = load_pack_index(temppath+".idx").objects_sha1()
         pack_sha = load_pack_index(temppath+".idx").objects_sha1()
@@ -415,14 +416,14 @@ class DiskObjectStore(PackBasedObjectStore):
     def move_in_pack(self, path):
     def move_in_pack(self, path):
         """Move a specific file containing a pack into the pack directory.
         """Move a specific file containing a pack into the pack directory.
 
 
-        :note: The file should be on the same file system as the 
+        :note: The file should be on the same file system as the
             packs directory.
             packs directory.
 
 
         :param path: Path to the pack file.
         :param path: Path to the pack file.
         """
         """
         p = PackData(path)
         p = PackData(path)
         entries = p.sorted_entries()
         entries = p.sorted_entries()
-        basename = os.path.join(self.pack_dir, 
+        basename = os.path.join(self.pack_dir,
             "pack-%s" % iter_sha1(entry[0] for entry in entries))
             "pack-%s" % iter_sha1(entry[0] for entry in entries))
         write_pack_index_v2(basename+".idx", entries, p.get_stored_checksum())
         write_pack_index_v2(basename+".idx", entries, p.get_stored_checksum())
         p.close()
         p.close()
@@ -434,7 +435,7 @@ class DiskObjectStore(PackBasedObjectStore):
     def add_thin_pack(self):
     def add_thin_pack(self):
         """Add a new thin pack to this object store.
         """Add a new thin pack to this object store.
 
 
-        Thin packs are packs that contain deltas with parents that exist 
+        Thin packs are packs that contain deltas with parents that exist
         in a different pack.
         in a different pack.
         """
         """
         fd, path = tempfile.mkstemp(dir=self.pack_dir, suffix=".pack")
         fd, path = tempfile.mkstemp(dir=self.pack_dir, suffix=".pack")
@@ -449,9 +450,9 @@ class DiskObjectStore(PackBasedObjectStore):
         return f, commit
         return f, commit
 
 
     def add_pack(self):
     def add_pack(self):
-        """Add a new pack to this object store. 
+        """Add a new pack to this object store.
 
 
-        :return: Fileobject to write to and a commit function to 
+        :return: Fileobject to write to and a commit function to
             call when the pack is finished.
             call when the pack is finished.
         """
         """
         fd, path = tempfile.mkstemp(dir=self.pack_dir, suffix=".pack")
         fd, path = tempfile.mkstemp(dir=self.pack_dir, suffix=".pack")
@@ -607,7 +608,7 @@ class ObjectStoreIterator(ObjectIterator):
     def __contains__(self, needle):
     def __contains__(self, needle):
         """Check if an object is present.
         """Check if an object is present.
 
 
-        :note: This checks if the object is present in 
+        :note: This checks if the object is present in
             the underlying object store, not if it would
             the underlying object store, not if it would
             be yielded by the iterator.
             be yielded by the iterator.
 
 
@@ -617,7 +618,7 @@ class ObjectStoreIterator(ObjectIterator):
 
 
     def __getitem__(self, key):
     def __getitem__(self, key):
         """Find an object by SHA1.
         """Find an object by SHA1.
-        
+
         :note: This retrieves the object from the underlying
         :note: This retrieves the object from the underlying
             object store. It will also succeed if the object would
             object store. It will also succeed if the object would
             not be returned by the iterator.
             not be returned by the iterator.
@@ -652,7 +653,7 @@ def tree_lookup_path(lookup_obj, root_sha, path):
 class MissingObjectFinder(object):
 class MissingObjectFinder(object):
     """Find the objects missing from another object store.
     """Find the objects missing from another object store.
 
 
-    :param object_store: Object store containing at least all objects to be 
+    :param object_store: Object store containing at least all objects to be
         sent
         sent
     :param haves: SHA1s of commits not to send (already present in target)
     :param haves: SHA1s of commits not to send (already present in target)
     :param wants: SHA1s of commits to send
     :param wants: SHA1s of commits to send
@@ -706,9 +707,8 @@ class MissingObjectFinder(object):
 
 
 
 
 class ObjectStoreGraphWalker(object):
 class ObjectStoreGraphWalker(object):
-    """Graph walker that finds out what commits are missing from an object 
-    store.
-    
+    """Graph walker that finds what commits are missing from an object store.
+
     :ivar heads: Revisions without descendants in the local repo
     :ivar heads: Revisions without descendants in the local repo
     :ivar get_parents: Function to retrieve parents in the local repo
     :ivar get_parents: Function to retrieve parents in the local repo
     """
     """