From 065b3ea6a78f6b31a855c4cd42aee2700250f325 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Wed, 31 Jul 2019 00:42:08 +0200 Subject: [PATCH] [DEV] add clone commands --- island/commands.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/island/commands.py b/island/commands.py index 450a0ad..dd83964 100644 --- a/island/commands.py +++ b/island/commands.py @@ -295,6 +295,24 @@ def rebase(path_repository, destination): return return_value +def clone(path_repository, address, branch_name = None, origin=None): + if address == None or address == "": + raise "Missing address" + cmd = 'git clone ' + address + if branch_name != None and branch_name == "": + cmd += " --branch " + branch_name + if origin != None and origin == "": + cmd += " --origin " + origin + if path_repository != None and path_repository == "": + cmd += " " + path_repository + debug.verbose("execute : " + cmd) + if os.path.exists(path_repository) == True: + debug.warning("Can not clone repository path already exist") + return False + return_value = multiprocess.run_command(cmd) + generic_display_error(return_value, "clone", error_only=True) + return return_value + def fetch(path_repository, remote_name, prune=True): cmd = 'git fetch ' + remote_name