[DEV] add a path filter in the island request

This commit is contained in:
Edouard DUPIN 2019-07-30 23:33:26 +02:00
parent d31e66ac73
commit 4c50fb154d
3 changed files with 33 additions and 0 deletions

View File

@ -75,6 +75,7 @@ my_args.add("v", "verbose", list=[
], 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", "filter", haveParam=True, desc="Filter the action on a list of path or subpath: -f library")
my_args.add("f", "folder", haveParam=False, desc="Display the folder instead of the git repository name")
my_args.add("w", "wait", haveParam=True, desc="Wait between 2 acces on the server (needed when the server is really slow to remove ssh connection) (default=" + str(env.get_wait_between_sever_command()) + ")")
my_args.set_stop_at(actions.get_list_of_action())
@ -144,6 +145,10 @@ def parse_generic_arg(argument, active):
else:
debug.disable_color()
return True
elif argument.get_option_name() == "filter":
if active == True:
env.set_filter_command(str(argument.get_arg()))
return True
elif argument.get_option_name() == "no-fetch-manifest":
if active == False:
env.set_fetch_manifest(False)
@ -185,6 +190,11 @@ if os.path.isfile(config_file) == True:
debug.debug(" get default config 'get_default_wait' val='" + str(data) + "'")
parse_generic_arg(arg_element.ArgElement("wait", str(data)), True)
if "get_default_filter" in dir(configuration_file):
data = configuration_file.get_default_filter()
debug.debug(" get default config 'get_default_filter' val='" + str(data) + "'")
parse_generic_arg(arg_element.ArgElement("filter", str(data)), True)
# parse default unique argument:

View File

@ -47,6 +47,26 @@ def get_wait_between_sever_command():
global wait_between_sever_command
return wait_between_sever_command
filter_command = ""
def set_filter_command(val):
global filter_command
filter_command = val
def get_filter_command():
global filter_command
return filter_command
def need_process_with_filter(data):
global filter_command
if filter_command == "":
return True
if len(data) < len(filter_command):
return False
if data[:len(filter_command)] == filter_command:
return True
return False
display_folder_instead_of_git_name = True
def set_display_folder_instead_of_git_name(val):

View File

@ -243,6 +243,9 @@ class Manifest():
# add all local project
for elem in self.projects:
debug.verbose("parse element " + str(elem))
if env.need_process_with_filter(elem["name"]) == False:
debug.info("Filter repository: " + str(elem["name"]))
continue
conf = RepoConfig()
conf.name = elem["name"]
conf.path = self._create_path_with_elem(elem)