summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuan Junchun <junchunx.guan@intel.com>2013-10-11 18:16:17 +0800
committerGuido Günther <agx@sigxcpu.org>2013-10-22 13:39:11 +0200
commitd52abf37893c90c228ca043623a9bda214382239 (patch)
tree8e63a6bb951a4db7f91985872781ca33cc47d9da
parent284eea5b0c7f4d6fbb09e4151ef02958e140fcf0 (diff)
gbp-clone: support cloning to a specific directory
Closes: #725666 Signed-off-by: Guan Junchun <junchunx.guan@intel.com> Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
-rwxr-xr-xgbp/scripts/clone.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/gbp/scripts/clone.py b/gbp/scripts/clone.py
index 5f21329..15e1174 100755
--- a/gbp/scripts/clone.py
+++ b/gbp/scripts/clone.py
@@ -59,21 +59,23 @@ def main(argv):
(options, args) = parse_args(argv)
- if len(args) != 2:
+ if len(args) < 2:
gbp.log.err("Need a repository to clone.")
return 1
else:
source = args[1]
+ clone_to, auto_name = (os.path.curdir, True) if len(args) < 3 else (args[2], False)
try:
- GitRepository(os.path.curdir)
+ GitRepository(clone_to)
gbp.log.err("Can't run inside a git repository.")
return 1
except GitRepositoryError:
pass
try:
- repo = DebianGitRepository.clone(os.path.curdir, source, options.depth)
+ repo = DebianGitRepository.clone(clone_to, source, options.depth,
+ auto_name=auto_name)
os.chdir(repo.path)
# Reparse the config files of the cloned repository so we pick up the