Browse Source

Simplify clone code.

Jelmer Vernooij 15 years ago
parent
commit
9208f15845
2 changed files with 7 additions and 9 deletions
  1. 5 7
      bin/dulwich
  2. 2 2
      dulwich/client.py

+ 5 - 7
bin/dulwich

@@ -152,13 +152,11 @@ def cmd_clone(args):
 
     if not os.path.exists(path):
         os.mkdir(path)
-    Repo.init(path)
-    r = Repo(path)
-    graphwalker = r.get_graph_walker()
-    f, commit = r.object_store.add_pack()
-    client.fetch_pack(host_path, r.object_store.determine_wants_all, 
-                      graphwalker, f.write, sys.stdout.write)
-    commit()
+    r = Repo.init(path)
+    remote_refs = client.fetch(host_path, r,
+        determine_wants=r.object_store.determine_wants_all,
+        progress=sys.stdout.write)
+    r["HEAD"] = remote_refs["HEAD"]
 
 
 def cmd_commit(args):

+ 2 - 2
dulwich/client.py

@@ -139,8 +139,8 @@ class GitClient(object):
             determine_wants = target.object_store.determine_wants_all
         f, commit = target.object_store.add_pack()
         try:
-            return self.fetch_pack(path, determine_wants, target.graph_walker, 
-                                   f.write, progress)
+            return self.fetch_pack(path, determine_wants, 
+                target.get_graph_walker(), f.write, progress)
         finally:
             commit()