[DEV] fetch other remote, status on other remote
This commit is contained in:
parent
f8de06c4d9
commit
bc82c533f1
@ -64,6 +64,7 @@ myArgs.add("c", "color", desc="Display message in color")
|
|||||||
#myArgs.add("h", "help", desc="Help of this action")
|
#myArgs.add("h", "help", desc="Help of this action")
|
||||||
myArgs.add("b", "branch", haveParam=True, desc="Select branch to display")
|
myArgs.add("b", "branch", haveParam=True, desc="Select branch to display")
|
||||||
myArgs.add("m", "manifest", haveParam=True, desc="Name of the manifest")
|
myArgs.add("m", "manifest", haveParam=True, desc="Name of the manifest")
|
||||||
|
myArgs.add("N", "no-fetch-manifest", haveParam=False, desc="Disable the fetch of the manifest")
|
||||||
"""
|
"""
|
||||||
myArgs.add("j", "jobs", haveParam=True, desc="Specifies the number of jobs (commands) to run simultaneously")
|
myArgs.add("j", "jobs", haveParam=True, desc="Specifies the number of jobs (commands) to run simultaneously")
|
||||||
myArgs.add("d", "depth", haveParam=True, desc="Depth to clone all the repository")
|
myArgs.add("d", "depth", haveParam=True, desc="Depth to clone all the repository")
|
||||||
@ -131,6 +132,10 @@ def parseGenericArg(argument, active):
|
|||||||
else:
|
else:
|
||||||
debug.disable_color()
|
debug.disable_color()
|
||||||
return True
|
return True
|
||||||
|
elif argument.get_option_name() == "no-fetch-manifest":
|
||||||
|
if active == False:
|
||||||
|
env.set_fetch_manifest(False)
|
||||||
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -26,9 +26,15 @@ def help():
|
|||||||
|
|
||||||
def execute(arguments):
|
def execute(arguments):
|
||||||
debug.info("execute:")
|
debug.info("execute:")
|
||||||
|
origin_name = ""
|
||||||
for elem in arguments:
|
for elem in arguments:
|
||||||
debug.info(" '" + str(elem.get_arg()) + "'")
|
debug.info(" '" + str(elem.get_arg()) + "'")
|
||||||
if len(arguments) != 0:
|
if len(arguments) == 0:
|
||||||
|
pass
|
||||||
|
elif len(arguments) == 1:
|
||||||
|
origin_name = arguments[0].get_arg()
|
||||||
|
debug.info("try fetch remote if exist: '" + str(origin_name) + "'")
|
||||||
|
else:
|
||||||
debug.error("Sync have not parameter")
|
debug.error("Sync have not parameter")
|
||||||
|
|
||||||
# check if .XXX exist (create it if needed)
|
# check if .XXX exist (create it if needed)
|
||||||
@ -40,10 +46,11 @@ def execute(arguments):
|
|||||||
|
|
||||||
configuration = config.Config()
|
configuration = config.Config()
|
||||||
|
|
||||||
debug.info("update manifest : '" + str(env.get_island_path_manifest()) + "'")
|
if env.get_fetch_manifest() == True:
|
||||||
# update manifest
|
debug.info("update manifest : '" + str(env.get_island_path_manifest()) + "'")
|
||||||
cmd = "git fetch --all"
|
# update manifest
|
||||||
multiprocess.run_command_direct(cmd, cwd=env.get_island_path_manifest())
|
cmd = "git fetch --all"
|
||||||
|
multiprocess.run_command_direct(cmd, cwd=env.get_island_path_manifest())
|
||||||
|
|
||||||
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())
|
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())
|
||||||
if os.path.exists(file_source_manifest) == False:
|
if os.path.exists(file_source_manifest) == False:
|
||||||
@ -69,7 +76,10 @@ def execute(arguments):
|
|||||||
# simply update the repository ...
|
# simply update the repository ...
|
||||||
debug.verbose("Fetching project: ")
|
debug.verbose("Fetching project: ")
|
||||||
# fetch the repository
|
# fetch the repository
|
||||||
cmd = "git fetch " + elem.select_remote["name"]
|
if origin_name == "":
|
||||||
|
cmd = "git fetch " + elem.select_remote["name"]
|
||||||
|
else:
|
||||||
|
cmd = "git fetch " + origin_name
|
||||||
debug.verbose("execute : " + cmd)
|
debug.verbose("execute : " + cmd)
|
||||||
multiprocess.run_command_direct(cmd, cwd=git_repo_path)
|
multiprocess.run_command_direct(cmd, cwd=git_repo_path)
|
||||||
|
|
||||||
|
@ -21,15 +21,18 @@ def help():
|
|||||||
return "plop"
|
return "plop"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def execute(arguments):
|
def execute(arguments):
|
||||||
debug.info("execute:")
|
debug.info("execute:")
|
||||||
|
origin_name = ""
|
||||||
for elem in arguments:
|
for elem in arguments:
|
||||||
debug.info(" '" + str(elem.get_arg()) + "'")
|
debug.info(" '" + str(elem.get_arg()) + "'")
|
||||||
if len(arguments) != 0:
|
if len(arguments) == 0:
|
||||||
debug.error("status have not parameter")
|
pass
|
||||||
|
elif len(arguments) == 1:
|
||||||
|
origin_name = arguments[0].get_arg()
|
||||||
|
debug.info("try fetch remote if exist: '" + str(origin_name) + "'")
|
||||||
|
else:
|
||||||
|
debug.error("Sync have not parameter")
|
||||||
|
|
||||||
# check if .XXX exist (create it if needed)
|
# check if .XXX exist (create it if needed)
|
||||||
if os.path.exists(env.get_island_path()) == False \
|
if os.path.exists(env.get_island_path()) == False \
|
||||||
@ -62,28 +65,42 @@ def execute(arguments):
|
|||||||
debug.verbose("execute : " + cmd)
|
debug.verbose("execute : " + cmd)
|
||||||
ret_diff = multiprocess.run_command(cmd, cwd=git_repo_path)
|
ret_diff = multiprocess.run_command(cmd, cwd=git_repo_path)
|
||||||
# get local branch
|
# get local branch
|
||||||
cmd = "git branch"
|
cmd = "git branch -a"
|
||||||
debug.verbose("execute : " + cmd)
|
debug.verbose("execute : " + cmd)
|
||||||
ret_branch = multiprocess.run_command(cmd, cwd=git_repo_path)
|
ret_branch = multiprocess.run_command(cmd, cwd=git_repo_path)
|
||||||
|
|
||||||
# get tracking branch
|
|
||||||
cmd = "git rev-parse --abbrev-ref --symbolic-full-name @{u}"
|
|
||||||
debug.verbose("execute : " + cmd)
|
|
||||||
ret_track = multiprocess.run_command(cmd, cwd=git_repo_path)
|
|
||||||
|
|
||||||
is_modify = True
|
is_modify = True
|
||||||
if ret_diff[0] == 0:
|
if ret_diff[0] == 0:
|
||||||
is_modify = False
|
is_modify = False
|
||||||
|
|
||||||
list_branch = ret_branch[1].split('\n')
|
list_branch = ret_branch[1].split('\n')
|
||||||
list_branch2 = []
|
list_branch2 = []
|
||||||
|
list_branch3 = []
|
||||||
select_branch = ""
|
select_branch = ""
|
||||||
for elem_branch in list_branch:
|
for elem_branch in list_branch:
|
||||||
|
if len(elem_branch.split(" -> ")) != 1:
|
||||||
|
continue
|
||||||
|
if elem_branch[2:10] == "remotes/":
|
||||||
|
elem_branch = elem_branch[:2] + elem_branch[10:]
|
||||||
if elem_branch[:2] == "* ":
|
if elem_branch[:2] == "* ":
|
||||||
list_branch2.append([elem_branch[2:], True])
|
list_branch2.append([elem_branch[2:], True])
|
||||||
select_branch = elem_branch[2:]
|
select_branch = elem_branch[2:]
|
||||||
else:
|
else:
|
||||||
list_branch2.append([elem_branch[2:], False])
|
list_branch2.append([elem_branch[2:], False])
|
||||||
|
list_branch3.append(elem_branch[2:])
|
||||||
|
debug.verbose("List all branch: " + str(list_branch3))
|
||||||
|
# get tracking branch
|
||||||
|
if origin_name == "":
|
||||||
|
cmd = "git rev-parse --abbrev-ref --symbolic-full-name @{u}"
|
||||||
|
debug.verbose("execute : " + cmd)
|
||||||
|
ret_track = multiprocess.run_command(cmd, cwd=git_repo_path)
|
||||||
|
else:
|
||||||
|
debug.extreme_verbose("check if exist " + origin_name + "/" + select_branch + " in " + str(list_branch3))
|
||||||
|
if origin_name + "/" + select_branch not in list_branch3:
|
||||||
|
debug.info("" + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name) + "\r\t\t\t\t\t\t\t (NO BRANCH)")
|
||||||
|
continue;
|
||||||
|
else:
|
||||||
|
ret_track = [True, origin_name + "/" + select_branch]
|
||||||
|
|
||||||
modify_status = " "
|
modify_status = " "
|
||||||
if is_modify == True:
|
if is_modify == True:
|
||||||
@ -111,6 +128,8 @@ def execute(arguments):
|
|||||||
if in_forward != 0:
|
if in_forward != 0:
|
||||||
behind_forward_comment += "forward=" + str(in_forward)
|
behind_forward_comment += "forward=" + str(in_forward)
|
||||||
if in_behind != 0:
|
if in_behind != 0:
|
||||||
|
if in_forward != 0:
|
||||||
|
behind_forward_comment += " "
|
||||||
behind_forward_comment += "behind=" + str(in_behind)
|
behind_forward_comment += "behind=" + str(in_behind)
|
||||||
if behind_forward_comment != "":
|
if behind_forward_comment != "":
|
||||||
behind_forward_comment = "\r\t\t\t\t\t\t\t\t\t\t\t\t[" + behind_forward_comment + "]"
|
behind_forward_comment = "\r\t\t\t\t\t\t\t\t\t\t\t\t[" + behind_forward_comment + "]"
|
||||||
|
@ -26,6 +26,16 @@ def get_system_base_name():
|
|||||||
return system_base_name
|
return system_base_name
|
||||||
|
|
||||||
|
|
||||||
|
fetch_manifest = True
|
||||||
|
|
||||||
|
def set_fetch_manifest(val):
|
||||||
|
global fetch_manifest
|
||||||
|
fetch_manifest = val
|
||||||
|
|
||||||
|
def get_fetch_manifest():
|
||||||
|
global fetch_manifest
|
||||||
|
return fetch_manifest
|
||||||
|
|
||||||
|
|
||||||
island_root_path = os.path.join(os.getcwd())
|
island_root_path = os.path.join(os.getcwd())
|
||||||
if os.path.exists(os.path.join(island_root_path, "." + get_system_base_name())) == True:
|
if os.path.exists(os.path.join(island_root_path, "." + get_system_base_name())) == True:
|
||||||
|
Loading…
Reference in New Issue
Block a user