diff options
author | Jordan Petridis <jordan@centricular.com> | 2020-04-17 08:08:15 +0300 |
---|---|---|
committer | Jordan Petridis <jordan@centricular.com> | 2020-04-23 13:28:43 +0300 |
commit | e9a759a881b6a7052cbd3c1ef0cd0769b144013d (patch) | |
tree | 5dd1411f5e25408ea63fed2677d5f531755f850a | |
parent | dcbaa0e5432a2f25e679d7e7f7ecd5e7f9fafab0 (diff) |
clone_manifest_ref: add the ability to fetch instead of cloning the repo
-rwxr-xr-x | gitlab/clone_manifest_ref.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gitlab/clone_manifest_ref.py b/gitlab/clone_manifest_ref.py index cbaf75d..b26043b 100755 --- a/gitlab/clone_manifest_ref.py +++ b/gitlab/clone_manifest_ref.py @@ -67,6 +67,7 @@ if __name__ == "__main__": parser.add_argument("--project", action="store", type=str) parser.add_argument("--destination", action="store", type=str, default='.') parser.add_argument("--manifest", action="store", type=str) + parser.add_argument("--fetch", action="store_true", default=False) options = parser.parse_args() if not options.project: @@ -82,5 +83,10 @@ if __name__ == "__main__": if dest == '.': dest = os.path.join (os.getcwd(), project.name) - git('clone', project.fetch_uri, dest) + if options.fetch: + assert os.path.exists(dest) == True + git('fetch', project.fetch_uri, project.revision, repository_path=dest) + else: + git('clone', project.fetch_uri, dest) + git('checkout', '--detach', project.revision, repository_path=dest) |