Skip ^{} tags.
authorJelmer Vernooij <jelmer@samba.org>
Wed, 11 Mar 2009 21:40:00 +0000 (21:40 +0000)
committerJelmer Vernooij <jelmer@samba.org>
Wed, 11 Mar 2009 21:40:00 +0000 (21:40 +0000)
bin/dulwich
dulwich/client.py
dulwich/object_store.py

index 213ec1847a5ed02b05ea400b80b17659eb35bb61..83b399791ea5313fe05f6bf84562a1e223baedf5 100755 (executable)
@@ -29,6 +29,7 @@ def get_transport_and_path(uri):
     # if its not git or git+ssh, try a local url..
     return SubprocessGitClient(), uri
 
+
 def cmd_fetch_pack(args):
        from dulwich.client import SimpleFetchGraphWalker
        from dulwich.repo import Repo
@@ -36,7 +37,7 @@ def cmd_fetch_pack(args):
        opts = dict(opts)
         client, path = get_transport_and_path(args.pop(0))
        if "--all" in opts:
-               determine_wants = lambda x: [y for y in x.values() if not y in r.object_store]
+               determine_wants = r.object_store.determine_wants_all
        else:
                determine_wants = lambda x: [y for y in args if not y in r.object_store]
        r = Repo(".")
@@ -152,7 +153,6 @@ def cmd_clone(args):
        if args == []:
                print "usage: dulwich clone host:path [PATH]"
                sys.exit(1)
-
         client, host_path = get_transport_and_path(args.pop(0))
 
        if len(args) > 0:
@@ -164,11 +164,10 @@ def cmd_clone(args):
                os.mkdir(path)
        Repo.init(path)
        r = Repo(path)
-       determine_wants = lambda x: [y for y in x.values() if not y in r.object_store]
        graphwalker = SimpleFetchGraphWalker(r.heads().values(), r.get_parents)
        f, commit = r.object_store.add_pack()
        try:
-               client.fetch_pack(host_path, determine_wants, graphwalker, f.write, 
+               client.fetch_pack(host_path, r.object_store.determine_wants_all, graphwalker, f.write, 
                                          sys.stdout.write)
                f.close()
                commit()
index 59b3ece99f76cab04c6fbd4be70e0c302a6b99b9..951e6fb76d3227e4b4b617703da0b59125772373 100644 (file)
@@ -85,8 +85,7 @@ class GitClient(object):
             (sha, ref) = pkt.rstrip("\n").split(" ", 1)
             if server_capabilities is None:
                 (ref, server_capabilities) = extract_capabilities(ref)
-            if not (ref == "capabilities^{}" and sha == "0" * 40):
-                refs[ref] = sha
+            refs[ref] = sha
         return refs, server_capabilities
 
     def send_pack(self, path, generate_pack_contents):
index e7ff64716835249467a73f2a996789e3a91e24e0..5e444613b1c3e4fc58f910ecacc22e6e5671e90c 100644 (file)
@@ -42,6 +42,9 @@ class ObjectStore(object):
         self.path = path
         self._packs = None
 
+    def determine_wants_all(self, refs):
+           return [sha for (ref, sha) in refs.iteritems() if not sha in self and not ref.endswith("^{}")]
+
     def iter_shas(self, shas):
         return ObjectStoreIterator(self, shas)