瀏覽代碼

Add --remote argument to 'dulwich archive'.

Jelmer Vernooij 7 年之前
父節點
當前提交
f644882d4e
共有 1 個文件被更改,包括 11 次插入5 次删除
  1. 11 5
      bin/dulwich

+ 11 - 5
bin/dulwich

@@ -66,12 +66,18 @@ class Command(object):
 class cmd_archive(Command):
 
     def run(self, args):
-        opts, args = getopt(args, "", [])
-        client, path = get_transport_and_path(args.pop(0))
-        location = args.pop(0)
+        parser = optparse.OptionParser()
+        parser.add_option("--remote", type=str,
+                          help="Retrieve archive from specified remote repo")
+        options, args = parser.parse_args(args)
         committish = args.pop(0)
-        porcelain.archive(location, committish, outstream=sys.stdout,
-            errstream=sys.stderr)
+        if options.remote:
+            client, path = get_transport_and_path(options.remote)
+            client.archive(path, committish, sys.stdout.write,
+                    write_error=sys.stderr.write)
+        else:
+            porcelain.archive('.', committish, outstream=sys.stdout,
+                errstream=sys.stderr)
 
 
 class cmd_add(Command):