Add directory argument to gbs clone
authorGuan Junchun <junchunx.guan@intel.com>
Fri, 11 Oct 2013 10:07:56 +0000 (18:07 +0800)
committerGuan Junchun <junchunx.guan@intel.com>
Mon, 14 Oct 2013 07:28:03 +0000 (15:28 +0800)
With this patch, we can clone a repo to a specific directory
$ gbs clone remote_repo dir

Fixes: #1336

Change-Id: I72241337a2815b444c214ddb8ca8ea6b7fefb63f

gitbuildsys/cmd_clone.py
tools/gbs

index 25124c8..438aeb2 100644 (file)
@@ -57,6 +57,8 @@ def main(args):
     if args.debug:
         gbp_args.append("--verbose")
     gbp_args.append(args.uri)
+    if args.directory:
+        gbp_args.append(args.directory)
 
     # Clone
     log.info('cloning %s' % args.uri)
index ae06cf4..dbdb520 100755 (executable)
--- a/tools/gbs
+++ b/tools/gbs
@@ -430,10 +430,13 @@ def clone_parser(parser):
     """Clone a git repository
     Examples:
       $ gbs clone git://example.com/repos/package.git
+      $ gbs clone git://example.com/repos/package.git dir
       $ gbs clone --upstream-branch=orig ../package.git
     """
 
     parser.add_argument('uri', help='path/uri to a git repository')
+    parser.add_argument('directory', nargs='?', help='the name of a new directory to clone into. '
+                        'Cloning into an existing directory is only allowed if the directory is empty.')
     parser.add_argument('--upstream-branch', help='upstream branch')
     parser.add_argument('--packaging-branch', help='packaging branch, or development branch')
     parser.add_argument('--all', action='store_true',