diff --git a/island/__init__.py b/island/__init__.py index a724357..1a36661 100755 --- a/island/__init__.py +++ b/island/__init__.py @@ -64,9 +64,18 @@ debug.verbose("List of actions: " + str(actions.get_list_of_action())) my_args = arguments.Arguments() my_args.add_section("option", "Can be set one time in all case") my_args.add("h", "help", desc="Display this help") -my_args.add("v", "verbose", list=[["0","None"],["1","error"],["2","warning"],["3","info"],["4","debug"],["5","verbose"],["6","extreme_verbose"]], desc="display debug level (verbose) default =2") +my_args.add("v", "verbose", list=[ + ["0","None"], + ["1","error"], + ["2","warning"], + ["3","info"], + ["4","debug"], + ["5","verbose"], + ["6","extreme_verbose"], + ], desc="display debug level (verbose) default =2") my_args.add("c", "color", desc="Display message in color") my_args.add("n", "no-fetch-manifest", haveParam=False, desc="Disable the fetch of the manifest") +my_args.add("f", "folder", haveParam=False, desc="Display the folder instead of the git repository name") my_args.set_stop_at(actions.get_list_of_action()) local_argument = my_args.parse() @@ -104,7 +113,7 @@ def check_boolean(value): return False # preparse the argument to get the verbose element for debug mode -def parseGenericArg(argument, active): +def parse_generic_arg(argument, active): debug.extreme_verbose("parse arg : " + argument.get_option_name() + " " + argument.get_arg() + " active=" + str(active)) if argument.get_option_name() == "help": if active == False: @@ -123,6 +132,10 @@ def parseGenericArg(argument, active): if active == True: debug.set_level(int(argument.get_arg())) return True + elif argument.get_option_name() == "folder": + if active == True: + env.set_display_folder_instead_of_git_name(True) + return True elif argument.get_option_name() == "color": if active == True: if check_boolean(argument.get_arg()) == True: @@ -190,12 +203,12 @@ if os.path.isfile(config_file) == True: # parse default unique argument: for argument in local_argument: - parseGenericArg(argument, True) + parse_generic_arg(argument, True) # remove all generic arguments: new_argument_list = [] for argument in local_argument: - if parseGenericArg(argument, False) == True: + if parse_generic_arg(argument, False) == True: continue new_argument_list.append(argument) diff --git a/island/actions/islandAction_checkout.py b/island/actions/islandAction_checkout.py index 2009a44..3b279ce 100644 --- a/island/actions/islandAction_checkout.py +++ b/island/actions/islandAction_checkout.py @@ -60,16 +60,17 @@ def execute(arguments): id_element = 0 for elem in all_project: id_element += 1 - debug.verbose("checkout : " + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name)) + base_display = tools.get_list_base_display(id_element, len(all_project), elem) + debug.verbose("checkout : " + base_display) git_repo_path = os.path.join(env.get_island_root_path(), elem.path) if os.path.exists(git_repo_path) == False: - debug.warning("checkout " + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name) + " ==> repository does not exist ...") + debug.warning("checkout " + base_display + " ==> repository does not exist ...") continue # check if the repository is modify is_modify = commands.check_repository_is_modify(git_repo_path) if is_modify == True: - debug.warning("checkout " + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name) + " ==> modify data can not checkout new branch") + debug.warning("checkout " + base_display + " ==> modify data can not checkout new branch") continue list_branch_local = commands.get_list_branch_local(git_repo_path) @@ -77,7 +78,7 @@ def execute(arguments): # check if we are on the good branch: if branch_to_checkout == select_branch: - debug.info("checkout " + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name) + " ==> No change already on good branch") + debug.info("checkout " + base_display + " ==> No change already on good branch") continue # check if we have already checkout the branch before @@ -90,9 +91,9 @@ def execute(arguments): and ret[1] != "" \ and ret != False: debug.info("'" + str(ret) + "'") - debug.error("checkout " + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name) + " ==> Can not checkout to the correct branch") + debug.error("checkout " + base_display + " ==> Can not checkout to the correct branch") continue - debug.info("checkout " + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name) + " ==> switch branch") + debug.info("checkout " + base_display + " ==> switch branch") # TODO : Check the number of commit to the origin/XXX branch .... continue @@ -101,7 +102,7 @@ def execute(arguments): if elem.select_remote["name"] + "/" + branch_to_checkout in list_branch_remote: debug.info(" ==> find ...") else: - debug.info("checkout " + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name) + " ==> NO remote branch") + debug.info("checkout " + base_display + " ==> NO remote branch") continue # checkout the new branch: @@ -112,9 +113,9 @@ def execute(arguments): if ret[1] != "" \ and ret != False: debug.info("'" + str(ret) + "'") - debug.error("checkout " + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name) + " ==> Can not checkout to the correct branch") + debug.error("checkout " + base_display + " ==> Can not checkout to the correct branch") continue - debug.info("checkout " + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name) + " ==> create new branch") + debug.info("checkout " + base_display + " ==> create new branch") continue diff --git a/island/actions/islandAction_command.py b/island/actions/islandAction_command.py index 8727da5..82c395e 100644 --- a/island/actions/islandAction_command.py +++ b/island/actions/islandAction_command.py @@ -50,11 +50,12 @@ def execute(arguments): for elem in all_project: debug.info("------------------------------------------") id_element += 1 - debug.info("execute command : " + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name)) + base_display = tools.get_list_base_display(id_element, len(all_project), elem) + debug.info("execute command : " + base_display) #debug.debug("elem : " + str(elem)) git_repo_path = os.path.join(env.get_island_root_path(), elem.path) if os.path.exists(git_repo_path) == False: - debug.info("" + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name) + "\r\t\t\t\t\t\t\t\t\t" + " (not download)") + debug.info("" + base_display + "\r\t\t\t\t\t\t\t\t\t" + " (not download)") continue debug.verbose("execute : " + cmd) diff --git a/island/actions/islandAction_commit.py b/island/actions/islandAction_commit.py index b26ec74..c755328 100644 --- a/island/actions/islandAction_commit.py +++ b/island/actions/islandAction_commit.py @@ -69,7 +69,8 @@ def execute(arguments): id_element = 0 for elem in all_project: id_element += 1 - debug.info("commit: " + str(id_element) + "/" + str(len(all_project)) + ": " + str(elem.name)) + base_display = tools.get_list_base_display(id_element, len(all_project), elem) + debug.info("commit: " + base_display) git_repo_path = os.path.join(env.get_island_root_path(), elem.path) if os.path.exists(git_repo_path) == False: debug.error("can not commit project that not exist") diff --git a/island/actions/islandAction_deliver.py b/island/actions/islandAction_deliver.py index 8a36f01..ebbbda5 100644 --- a/island/actions/islandAction_deliver.py +++ b/island/actions/islandAction_deliver.py @@ -57,34 +57,35 @@ def execute(arguments): deliver_availlable = True for elem in all_project: id_element += 1 - debug.verbose("deliver-ckeck: " + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name)) + base_display = tools.get_list_base_display(id_element, len(all_project), elem) + debug.verbose("deliver-ckeck: " + base_display) # Check the repo exist git_repo_path = os.path.join(env.get_island_root_path(), elem.path) if os.path.exists(git_repo_path) == False: - debug.warning("deliver-ckeck: " + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name) + " ==> MUST be download") + debug.warning("deliver-ckeck: " + base_display + " ==> MUST be download") deliver_availlable = False continue # check if we are on "master" select_branch = commands.get_current_branch(git_repo_path) if select_branch != "master": - debug.warning("deliver-ckeck: " + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name) + " ==> MUST be on master") + debug.warning("deliver-ckeck: " + base_display + " ==> MUST be on master") deliver_availlable = False # check if we have a remote traking branch tracking_remote_branch = commands.get_tracking_branch(git_repo_path, argument_remote_name, select_branch) if tracking_remote_branch == None: - debug.warning("deliver-ckeck: " + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name) + " ==> MUST have a remote tracking branch") + debug.warning("deliver-ckeck: " + base_display + " ==> MUST have a remote tracking branch") deliver_availlable = False # check if we have a local branch list_branch_local = commands.get_list_branch_local(git_repo_path) if "develop" not in list_branch_local: - debug.warning("deliver-ckeck: " + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name) + " ==> MUST have local branch named develop") + debug.warning("deliver-ckeck: " + base_display + " ==> MUST have local branch named develop") deliver_availlable = False # TODO: check develop is up to date # check if the curent repo is modify is_modify = commands.check_repository_is_modify(git_repo_path) if is_modify == True: - debug.warning("deliver-ckeck: " + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name) + " ==> MUST not be modify") + debug.warning("deliver-ckeck: " + base_display + " ==> MUST not be modify") deliver_availlable = False # check the remote branch and the local branch are the same #sha_tracking = get_sha1_for_branch(git_repo_path, tracking_remote_branch) @@ -96,8 +97,9 @@ def execute(arguments): id_element = 0 for elem in all_project: id_element += 1 + base_display = tools.get_list_base_display(id_element, len(all_project), elem) debug.info("deliver: ========================================================================") - debug.info("deliver: == " + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name)) + debug.info("deliver: == " + base_display) debug.info("deliver: ========================================================================") git_repo_path = os.path.join(env.get_island_root_path(), elem.path) @@ -189,7 +191,7 @@ def execute(arguments): # get tracking branch tracking_remote_branch = get_tracking_branch(git_repo_path, argument_remote_name, select_branch) if tracking_remote_branch == None: - debug.info("" + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name) + "\r\t\t\t\t\t\t\t (NO BRANCH)") + debug.info("" + base_display + "\r\t\t\t\t\t\t\t (NO BRANCH)") continue modify_status = " " @@ -239,8 +241,8 @@ def execute(arguments): if len(tags_comment) != 0: tags_comment = "\r\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[" + tags_comment + "]" - #debug.info("" + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name) + "\r\t\t\t\t\t\t\t" + modify_status + "(" + select_branch + " -> " + ret_track[1] + " -> " + elem.select_remote["name"] + "/" + elem.branch + ")") - debug.info("" + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name) + "\r\t\t\t\t\t\t\t" + modify_status + "(" + select_branch + " -> " + ret_track[1] + ")" + behind_forward_comment + tags_comment) + #debug.info("" + base_display + "\r\t\t\t\t\t\t\t" + modify_status + "(" + select_branch + " -> " + ret_track[1] + " -> " + elem.select_remote["name"] + "/" + elem.branch + ")") + debug.info("" + base_display + "\r\t\t\t\t\t\t\t" + modify_status + "(" + select_branch + " -> " + ret_track[1] + ")" + behind_forward_comment + tags_comment) if is_modify == True: cmd = "git status --short" debug.verbose("execute : " + cmd) diff --git a/island/actions/islandAction_fetch.py b/island/actions/islandAction_fetch.py index 581a3af..41ee55f 100644 --- a/island/actions/islandAction_fetch.py +++ b/island/actions/islandAction_fetch.py @@ -58,7 +58,8 @@ def execute(arguments): id_element = 0 for elem in all_project: id_element += 1 - debug.info("fetch: " + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name)) + base_display = tools.get_list_base_display(id_element, len(all_project), elem) + debug.info("fetch: " + base_display) #debug.debug("elem : " + str(elem)) git_repo_path = os.path.join(env.get_island_root_path(), elem.path) if os.path.exists(git_repo_path) == False: diff --git a/island/actions/islandAction_push.py b/island/actions/islandAction_push.py index 222e40f..cbc1d0b 100644 --- a/island/actions/islandAction_push.py +++ b/island/actions/islandAction_push.py @@ -62,7 +62,8 @@ def execute(arguments): id_element = 0 for elem in all_project: id_element += 1 - debug.info("push: " + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name)) + base_display = tools.get_list_base_display(id_element, len(all_project), elem) + debug.info("push: " + base_display) #debug.debug("elem : " + str(elem)) git_repo_path = os.path.join(env.get_island_root_path(), elem.path) if os.path.exists(git_repo_path) == False: diff --git a/island/actions/islandAction_status.py b/island/actions/islandAction_status.py index 6741ab6..03c8989 100644 --- a/island/actions/islandAction_status.py +++ b/island/actions/islandAction_status.py @@ -24,6 +24,7 @@ def help(): def add_specific_arguments(_my_args, _section): _my_args.add("r", "remote", haveParam=True, desc="Name of the remote server") + _my_args.add("t", "tags", haveParam=False, desc="Display if the commit is on a tag (and display it)") @@ -58,11 +59,12 @@ def execute(arguments): id_element = 0 for elem in all_project: id_element += 1 - debug.verbose("status : " + str(id_element) + " / " + str(len(all_project)) + " : " + str(elem.name)) + base_display = tools.get_list_base_display(id_element, len(all_project), elem) + debug.verbose("status : " + base_display) #debug.debug("elem : " + str(elem)) git_repo_path = os.path.join(env.get_island_root_path(), elem.path) if os.path.exists(git_repo_path) == False: - debug.info("" + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name) + "\r\t\t\t\t\t\t\t\t\t" + " (not download)") + debug.info(base_display + "\r\t\t\t\t\t\t\t\t\t" + " (not download)") continue is_modify = commands.check_repository_is_modify(git_repo_path) @@ -72,7 +74,7 @@ def execute(arguments): # get tracking branch tracking_remote_branch = commands.get_tracking_branch(git_repo_path, argument_remote_name, select_branch) if tracking_remote_branch == None: - debug.info("" + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name) + "\r\t\t\t\t\t\t\t (NO BRANCH)") + debug.info(base_display + "\r\t\t\t\t\t\t\t (NO BRANCH)") continue modify_status = " " @@ -118,8 +120,7 @@ def execute(arguments): if len(tags_comment) != 0: tags_comment = "\r\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[" + tags_comment + "]" - #debug.info("" + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name) + "\r\t\t\t\t\t\t\t" + modify_status + "(" + select_branch + " -> " + tracking_remote_branch + " -> " + elem.select_remote["name"] + "/" + elem.branch + ")") - debug.info("" + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name) + "\r\t\t\t\t\t\t\t" + modify_status + "(" + select_branch + " -> " + tracking_remote_branch + ")" + behind_forward_comment + tags_comment) + debug.info(base_display + "\r\t\t\t\t\t\t\t" + modify_status + "(" + select_branch + " -> " + tracking_remote_branch + ")" + behind_forward_comment + tags_comment) if is_modify == True: cmd = "git status --short" debug.verbose("execute : " + cmd) diff --git a/island/actions/islandAction_sync.py b/island/actions/islandAction_sync.py index 2d25dea..e2b8f79 100644 --- a/island/actions/islandAction_sync.py +++ b/island/actions/islandAction_sync.py @@ -59,7 +59,8 @@ def execute(arguments): id_element = 0 for elem in all_project: id_element += 1 - debug.info("sync : " + str(id_element) + "/" + str(len(all_project)) + " : " + str(elem.name)) + base_display = tools.get_list_base_display(id_element, len(all_project), elem) + debug.info("sync : " + base_display) #debug.debug("elem : " + str(elem)) git_repo_path = os.path.join(env.get_island_root_path(), elem.path) if os.path.exists(git_repo_path) == False: diff --git a/island/env.py b/island/env.py index a77d427..52d7737 100644 --- a/island/env.py +++ b/island/env.py @@ -36,6 +36,15 @@ def get_fetch_manifest(): global fetch_manifest return fetch_manifest +display_folder_instead_of_git_name = True + +def set_display_folder_instead_of_git_name(val): + global display_folder_instead_of_git_name + display_folder_instead_of_git_name = val + +def get_display_folder_instead_of_git_name(): + global display_folder_instead_of_git_name + return display_folder_instead_of_git_name island_root_path = os.path.join(os.getcwd()) if os.path.exists(os.path.join(island_root_path, "." + get_system_base_name())) == True: diff --git a/island/tools.py b/island/tools.py index 8980760..eea9edf 100644 --- a/island/tools.py +++ b/island/tools.py @@ -289,3 +289,10 @@ def remove_element(data, to_remove): return out; +def get_list_base_display(id, count, elem): + if env.get_display_folder_instead_of_git_name() == False: + return str(id) + "/" + str(count) + " : " + str(elem.name) + return str(id) + "/" + str(count) + " : " + str(elem.path) + + +