Dulwich.io dulwich / 9633224
Revert "Make local path argument to clone.py optional." This reverts commit 8ba850c0690d4a9fbf0479f52653a59a499df85f. Jelmer Vernooń≥ 25 days ago
1 changed file(s) with 8 addition(s) and 24 deletion(s). Raw diff Collapse all Expand all
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
95
106 import sys
11
12 from os.path import basename
13
147 from getopt import getopt
15
168 from dulwich import porcelain
179
18
19 _, args = getopt(sys.argv, "", [])
20
10 opts, args = getopt(sys.argv, "", [])
11 opts = dict(opts)
2112
2213 if len(args) < 2:
2314 print("usage: %s host:path path" % (args[0], ))
2415 sys.exit(1)
2516
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])