Revert "Make local path argument to clone.py optional."
This reverts commit 8ba850c0690d4a9fbf0479f52653a59a499df85f.
Jelmer Vernooij
25 days ago
0 | """Clone. | |
1 | ||
2 | This trivial script demonstrates how to clone or lock a remote repository. | |
3 | ||
4 | Example usage: | |
5 | 1. python examples/clone.py git://github.com/jelmer/dulwich | |
6 | 2. python examples/clone.py git://github.com/jelmer/dulwich.git dulwich | |
7 | """ | |
8 | ||
0 | #!/usr/bin/python | |
1 | # This trivial script demonstrates how to clone a remote repository. | |
2 | # | |
3 | # Example usage: | |
4 | # python examples/clone.py git://github.com/jelmer/dulwich dulwich-clone | |
9 | 5 | |
10 | 6 | import sys |
11 | ||
12 | from os.path import basename | |
13 | ||
14 | 7 | from getopt import getopt |
15 | ||
16 | 8 | from dulwich import porcelain |
17 | 9 | |
18 | ||
19 | _, args = getopt(sys.argv, "", []) | |
20 | ||
10 | opts, args = getopt(sys.argv, "", []) | |
11 | opts = dict(opts) | |
21 | 12 | |
22 | 13 | if len(args) < 2: |
23 | 14 | print("usage: %s host:path path" % (args[0], )) |
24 | 15 | sys.exit(1) |
25 | 16 | |
26 | elif len(args) < 3: | |
27 | target_path = basename(args[1].split(":")[-1]) | |
28 | if target_path[-4:] == ".git": | |
29 | target_path = target_path[:-4] | |
30 | else: | |
31 | target_path = args[2] | |
32 | ||
33 | porcelain.clone(args[1], target_path) | |
17 | porcelain.clone(args[1], args[2]) |