[DEV] continue mutation

This commit is contained in:
Edouard DUPIN 2021-06-18 23:53:13 +02:00
parent 5a05e0eb77
commit 9148d9242c
37 changed files with 734 additions and 651 deletions

View File

@ -51,7 +51,7 @@ public class Actions {
* @return The first line of description
* @throws ActionException
*/
private String getFullActionHelp(final String action_name) throws ActionException {
private static String getFullActionHelp(final String action_name) throws ActionException {
Class<ActionInterface> actionClass = Actions.actions.get(action_name);
if (actionClass == null) {
throw new ActionException("Action does not registered");
@ -68,7 +68,7 @@ public class Actions {
return action.help();
}
private String getActionHelpExample(final String action_name) throws ActionException {
private static String getActionHelpExample(final String action_name) throws ActionException {
Class<ActionInterface> actionClass = Actions.actions.get(action_name);
if (actionClass == null) {
throw new ActionException("Action does not registered");
@ -91,16 +91,16 @@ public class Actions {
* @return The first line of description
* @throws ActionException
*/
public String getActionHelp(final String action_name) throws ActionException {
return getFullActionHelp(action_name).split("\n")[0];
public static String getActionHelp(final String action_name) throws ActionException {
return Actions.getFullActionHelp(action_name).split("\n")[0];
}
public void usage(final String action_name, final Arguments arguments) throws ActionException {
String help = getFullActionHelp(action_name);
public static void usage(final String action_name, final Arguments arguments) throws ActionException {
String help = Actions.getFullActionHelp(action_name);
Log.print("Description:");
Log.print("\t" + help);
//TODO: ??? arguments.display(action_name);
String helpExample = getActionHelpExample(action_name);
String helpExample = Actions.getActionHelpExample(action_name);
if (helpExample != null) {
Log.print("Example:");
for (String elem : helpExample.split("\n")) {
@ -110,7 +110,7 @@ public class Actions {
System.exit(0);
}
public void execute(final String action_name, final List<String> arguments) throws ActionException {
public static void execute(final String action_name, final List<String> arguments) throws ActionException {
Class<ActionInterface> actionClass = Actions.actions.get(action_name);
if (actionClass == null) {
throw new ActionException("Action does not registered");
@ -132,8 +132,8 @@ public class Actions {
List<ArgElement> my_under_args = my_under_args_parser.parse(arguments, have_unknow_argument);
// search help if needed ==> permit to not duplicating code
for (ArgElement elem : my_under_args) {
if (elem.getOptionName() == "help") {
usage(action_name, my_under_args_parser);
if (elem.getOptionName().equals("help") {
Actions.usage(action_name, my_under_args_parser);
System.exit(0);
}
}
@ -144,4 +144,7 @@ public class Actions {
}
action.execute(my_under_args);
}
public static boolean exist(final String action_to_do) {
return Actions.actions.get(action_to_do) != null;
}
}

View File

@ -143,4 +143,4 @@ public class Env {
}
}
}

View File

@ -0,0 +1,34 @@
package org.atriasoft.island;
import java.nio.file.Path;
class IncludeConfig {
private String name;
private Path path;
private Manifest manifest;
public IncludeConfig(final String name, final Path path, final Manifest manifest) {
this.name = name;
this.path = path;
this.manifest = manifest;
}
public String getName() {
return this.name;
}
public void setName(final String name) {
this.name = name;
}
public Path getPath() {
return this.path;
}
public void setPath(final Path path) {
this.path = path;
}
public Manifest getManifest() {
return this.manifest;
}
public void setManifest(final Manifest manifest) {
this.manifest = manifest;
}
}

View File

@ -1,189 +1,229 @@
package org.atriasoft.island;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import org.atriasoft.death.ArgChoice;
import org.atriasoft.death.ArgElement;
import org.atriasoft.death.Arguments;
import org.atriasoft.island.internal.Log;
import org.atriasoft.island.model.ActionException;
public class MainIsland {
private static Arguments my_args = new Arguments();
//Log.verbose("List of actions: " + str(actions.get_list_of_action()))
static {
my_args.addSection("option", "Can be set one time in all case");
my_args.add("h", "help", null, "Display this help");
my_args.add("v", "verbose", Arrays.asList(
new ArgChoice("0","None"),
new ArgChoice("1","error"),
new ArgChoice("2","warning"),
new ArgChoice("3","info"),
new ArgChoice("4","Log"),
new ArgChoice("5","verbose"),
new ArgChoice("6","extreme_verbose")), "display Log level (verbose) default =2");
my_args.add("c", "color", null, "Display message in color");
my_args.add("n", "no-fetch-manifest", null, "Disable the fetch of the manifest", false);
my_args.add("F", "filter", null, "Filter the action on a list of path or subpath: -f library", true);
my_args.add("f", "folder", null, "Display the folder instead of the git repository name", false);
my_args.add("w", "wait", null, "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()) + ")", false);
my_args.set_stop_at(new ArrayList<Actions.getListOfAction()));
//Log.verbose("List of actions: " + str(actions.get_list_of_action()))
static {
MainIsland.my_args.addSection("option", "Can be set one time in all case");
MainIsland.my_args.add("h", "help", null, "Display this help");
MainIsland.my_args.add("v", "verbose", Arrays.asList(
new ArgChoice("0","None"),
new ArgChoice("1","error"),
new ArgChoice("2","warning"),
new ArgChoice("3","info"),
new ArgChoice("4","debug"),
new ArgChoice("5","verbose"),
new ArgChoice("6","extreme_verbose")
), "display debug level (verbose) default =2");
MainIsland.my_args.add("c", "color", null, "Display message in color");
MainIsland.my_args.add("n", "no-fetch-manifest", null, "Disable the fetch of the manifest", false);
MainIsland.my_args.add("F", "filter", null, "Filter the action on a list of path or subpath: -f library", true);
MainIsland.my_args.add("f", "folder", null, "Display the folder instead of the git repository name", false);
MainIsland.my_args.add("w", "wait", null, "Wait between 2 acces on the server (needed when the server is really slow to remove ssh connection) (default=" + Env.get_wait_between_sever_command() + ")", true);
//my_args.setStopAt(actions.get_list_of_action());
}
local_argument = my_args.parse();
//
// @brief Display the help of this makefile.
//
public void usage():
color = Log.get_color_set()
// generic argument displayed :
my_args.display()
print(" Action availlable" )
list_actions = actions.get_list_of_action();
for elem in list_actions:
print(" " + color['green'] + elem + color['default'])
print(" " + actions.get_action_help(elem))
"""
print(" " + color['green'] + "init" + color['default'])
print(" initialize a 'island' interface with a manifest in a git ")
print(" " + color['green'] + "sync" + color['default'])
print(" Syncronise the currect environement")
print(" " + color['green'] + "status" + color['default'])
print(" Dump the status of the environement")
"""
print(" ex: " + sys.argv[0] + " -c init http://github.com/atria-soft/manifest.git")
print(" ex: " + sys.argv[0] + " sync")
exit(0)
public void check_boolean(value):
if value == "" \
or value == "1" \
or value == "true" \
or value == "true" \
or value == true:
return true
return false
// preparse the argument to get the verbose element for Log mode
public void parse_generic_arg(argument, active):
Log.extreme_verbose("parse arg : " + argument.getOptionName() + " " + argument.getArg() + " active=" + str(active))
if argument.getOptionName() == "help":
if active == false:
usage()
return true
} else if argument.getOptionName()=="jobs":
if active == true:
//multiprocess.set_core_number(int(argument.getArg()))
pass
return true
} else if argument.getOptionName()=="wait":
if active == true:
env.set_wait_between_sever_command(int(argument.getArg()))
return true
} else if argument.getOptionName() == "verbose":
if active == true:
Log.set_level(int(argument.getArg()))
return true
} else if argument.getOptionName() == "folder":
if active == true:
env.set_display_folder_instead_of_git_name(true)
return true
} else if argument.getOptionName() == "color":
if active == true:
if check_boolean(argument.getArg()) == true:
Log.enable_color()
else:
Log.disable_color()
return true
} else if argument.getOptionName() == "filter":
if active == true:
env.set_filter_command(str(argument.getArg()))
return true
} else if argument.getOptionName() == "no-fetch-manifest":
if active == false:
env.set_fetch_manifest(false)
return true
return false
// open configuration of island:
config_file = env.get_island_path_user_config()
if os.path.isfile(config_file) == true:
sys.path.append(os.path.dirname(config_file))
Log.debug("Find basic configuration file: '" + config_file + "'")
// the file exist, we can open it and get the initial configuration:
configuration_file = __import__(env.get_system_config_name()[:-3])
//
// @brief Display the help of this makefile.
//
public static void usage() {
// generic argument displayed :
MainIsland.my_args.display("");
Log.print(" Action availlable" );
Set<String> list_actions = Actions.getListOfAction();
for (String elem : list_actions) {
Log.print(" " + elem);
try {
Log.print(" " + Actions.getActionHelp(elem));
} catch (ActionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.print(" ????? ERROR ?????");
}
}
/*
Log.print(" " + color['green'] + "init" + color['default'])
Log.print(" initialize a 'island' interface with a manifest in a git ")
Log.print(" " + color['green'] + "sync" + color['default'])
Log.print(" Syncronise the currect environement")
Log.print(" " + color['green'] + "status" + color['default'])
Log.print(" Dump the status of the environement")
*/
Log.print(" ex: xxx -c init http://github.com/atria-soft/manifest.git");
Log.print(" ex: xxx sync");
System.exit(0);
}
if "get_exclude_path" in dir(configuration_file):
data = configuration_file.get_exclude_path()
Log.debug(" get default config 'get_exclude_path' val='" + str(data) + "'")
env.set_exclude_search_path(data)
public boolean check_boolean(final String value) {
if (value.isEmpty() || value.equals("1") || value.equalsIgnoreCase("true")) {
return true;
}
return false;
}
// preparse the argument to get the verbose element for Log mode
public static boolean parse_generic_arg(final ArgElement argument, final boolean active) {
Log.verbose("parse arg : " + argument.getOptionName() + " " + argument.getArg() + " active=" + active);
if (argument.getOptionName().equals("help") ){
if (!active) {
MainIsland.usage();
}
return true;
}
if (argument.getOptionName().equals("jobs") ){
if (active) {
//multiprocess.set_core_number(Integer.valueOf(argument.getArg()));
}
return true;
}
if (argument.getOptionName().equals("wait") ){
if (active) {
Env.set_wait_between_sever_command(Integer.parseInt(argument.getArg()));
}
return true;
}
if (argument.getOptionName() .equals( "verbose") ){
if (active) {
//Logger.setLevel(Integer.valueOf(argument.getArg()));
}
return true;
}
if (argument.getOptionName() .equals( "folder") ){
if (active) {
Env.set_display_folder_instead_of_git_name(true);
}
return true;
}
if (argument.getOptionName() .equals( "color") ){
/*
if (active) {
if (check_boolean(argument.getArg())) {
Log.enable_color();
} else {
Log.disable_color();
}
}
*/
return true;
}
if (argument.getOptionName() .equals( "filter") ){
if (active) {
Env.set_filter_command(argument.getArg());
}
return true;
}
if (argument.getOptionName() .equals( "no-fetch-manifest")) {
if (!active) {
Env.set_fetch_manifest(false);
}
return true;
}
return false;
}
private void loadConfigUser() {
// open configuration of island:
// Path config_file = Env.get_island_path_user_config();
// if (Files.isDirectory(config_file)) {
// sys.path.append(os.path.dirname(config_file));
// Log.debug("Find basic configuration file: '" + config_file + "'");
// // the file exist, we can open it and get the initial configuration:
// configuration_file = __import__(Env.get_system_config_name()[:-3]);
//
// if ("get_exclude_path" in dir(configuration_file) {
// data = configuration_file.get_exclude_path();
// Log.debug(" get default config 'get_exclude_path' val='" + str(data) + "'");
// Env.set_exclude_search_path(data);
//
// if ("get_default_color" in dir(configuration_file) {
// data = configuration_file.get_default_color();
// Log.debug(" get default config 'get_default_color' val='" + str(data) + "'");
// parse_generic_arg(arg_element.ArgElement("color", str(data)), true);
//
// if ("get_default_debug_level" in dir(configuration_file) {
// data = configuration_file.get_default_debug_level();
// Log.debug(" get default config 'get_default_debug_level' val='" + str(data) + "'");
// parse_generic_arg(arg_element.ArgElement("verbose", str(data)), true);
//
// if ("get_default_folder" in dir(configuration_file) {
// data = configuration_file.get_default_folder();
// Log.debug(" get default config 'get_default_folder' val='" + str(data) + "'");
// parse_generic_arg(arg_element.ArgElement("folder", str(data)), true);
//
// if ("get_default_wait" in dir(configuration_file) {
// data = configuration_file.get_default_wait();
// Log.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();
// Log.debug(" get default config 'get_default_filter' val='" + str(data) + "'");
// parse_generic_arg(arg_element.ArgElement("filter", str(data)), true);
// }
// }
}
public MainIsland() {
}
if "get_default_color" in dir(configuration_file):
data = configuration_file.get_default_color()
Log.debug(" get default config 'get_default_color' val='" + str(data) + "'")
parse_generic_arg(arg_element.ArgElement("color", str(data)), true)
void run(final String[] args) throws ActionException {
List<String> argss = Arrays.asList(args);
List<ArgElement> local_argument = MainIsland.my_args.parse(argss);
if "get_default_Log_level" in dir(configuration_file):
data = configuration_file.get_default_Log_level()
Log.debug(" get default config 'get_default_debug_level' val='" + str(data) + "'")
parse_generic_arg(arg_element.ArgElement("verbose", str(data)), true)
// parse default unique argument:
for (ArgElement argument : local_argument) {
MainIsland.parse_generic_arg(argument, true);
}
// remove all generic arguments:
List<ArgElement> new_argument_list = new ArrayList<>();
for (ArgElement argument : local_argument) {
if (MainIsland.parse_generic_arg(argument, false)) {
continue;
}
new_argument_list.add(argument);
}
if "get_default_folder" in dir(configuration_file):
data = configuration_file.get_default_folder()
Log.debug(" get default config 'get_default_folder' val='" + str(data) + "'")
parse_generic_arg(arg_element.ArgElement("folder", str(data)), true)
if "get_default_wait" in dir(configuration_file):
data = configuration_file.get_default_wait()
Log.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()
Log.debug(" get default config 'get_default_filter' val='" + str(data) + "'")
parse_generic_arg(arg_element.ArgElement("filter", str(data)), true)
// now the first argument is: the action:
if (new_argument_list.size() == 0) {
Log.warning("--------------------------------------");
Log.warning("Missing the action to do ...");
Log.warning("--------------------------------------");
MainIsland.usage();
}
String action_to_do = new_argument_list.get(0).getArg();
new_argument_list.remove(0);
if (!Actions.exist(action_to_do)) {
Log.warning("--------------------------------------");
Log.warning("Wrong action type : '" + action_to_do + "' availlable list: " + Actions.getListOfAction());
Log.warning("--------------------------------------");
MainIsland.usage();
}
// todo : Remove this
if (!action_to_do.equals("init") && !Files.exists(Env.get_island_path())) {
Log.error("Can not execute a island cmd if we have not initialize a config: '" + "." + Env.get_system_base_name() + "' in upper 6 parent path");
System.exit(-1);
}
argss = argss.subList(MainIsland.my_args.getLastParsed()+1, argss.size());
Actions.execute(action_to_do, argss);
}
public static void main(final String[] args) throws ActionException {
MainIsland tmp = new MainIsland();
tmp.run(args);
}
// parse default unique argument:
for argument in local_argument:
parse_generic_arg(argument, true)
// remove all generic arguments:
new_argument_list = []
for argument in local_argument:
if parse_generic_arg(argument, false) == true:
continue
new_argument_list.append(argument)
// now the first argument is: the action:
if len(new_argument_list) == 0:
Log.warning("--------------------------------------")
Log.warning("Missing the action to do ...")
Log.warning("--------------------------------------")
usage()
// TODO : move tin in actions ...
list_actions = actions.get_list_of_action();
action_to_do = new_argument_list[0].getArg()
new_argument_list = new_argument_list[1:]
if action_to_do not in list_actions:
Log.warning("--------------------------------------")
Log.warning("Wrong action type : '" + str(action_to_do) + "' availlable list: " + str(list_actions) )
Log.warning("--------------------------------------")
usage()
// todo : Remove this
if action_to_do != "init" \
and os.path.exists(env.get_island_path()) == false:
Log.error("Can not execute a island cmd if we have not initialize a config: '" + str("." + env.get_system_base_name()) + "' in upper 6 parent path")
exit(-1)
ret = actions.execute(action_to_do, my_args.get_last_parsed()+1)
exit (ret)
// stop all started threads;
//multiprocess.un_init()
}

View File

@ -15,186 +15,14 @@ import org.atriasoft.exml.model.XmlNode;
import org.atriasoft.exml.model.XmlNodeType;
import org.atriasoft.island.internal.Log;
import org.atriasoft.island.model.Link;
import org.atriasoft.island.model.MirrorConfig;
import org.atriasoft.island.model.ProjectConfig;
import org.atriasoft.island.model.RemoteConfig;
import org.atriasoft.island.model.RepositoryConfig;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.RemoteListCommand;
class RepositoryCongig {
private String remote = "origin";
private String revision = "master";
private boolean sync = false;
public RepositoryCongig(final String remote, final String revision, final boolean sync) {
this.remote = remote;
this.revision = revision;
this.sync = sync;
}
public RepositoryCongig() {
}
public String getRemote() {
return this.remote;
}
public void setRemote(final String remote) {
this.remote = remote;
}
public String getRevision() {
return this.revision;
}
public void setRevision(final String revision) {
this.revision = revision;
}
public boolean isSync() {
return this.sync;
}
public void setSync(final boolean sync) {
this.sync = sync;
}
@Override
protected RepositoryCongig clone() {
// TODO Auto-generated method stub
return new RepositoryCongig(this.remote, this.revision, this.sync);
}
}
class MirrorConfig {
private String name;
private String fetch;
public MirrorConfig(final String name, final String fetch) {
this.name = name;
this.fetch = fetch;
}
public String getName() {
return this.name;
}
public void setName(final String name) {
this.name = name;
}
public String getFetch() {
return this.fetch;
}
public void setFetch(final String fetch) {
this.fetch = fetch;
}
}
class RemoteConfig {
private String name;
private String fetch;
List<MirrorConfig> mirror;
public RemoteConfig(final String name, final String fetch, final List<MirrorConfig> mirror) {
this.name = name;
this.fetch = fetch;
this.mirror = mirror;
}
public String getName() {
return this.name;
}
public void setName(final String name) {
this.name = name;
}
public String getFetch() {
return this.fetch;
}
public void setFetch(final String fetch) {
this.fetch = fetch;
}
public List<MirrorConfig> getMirror() {
return this.mirror;
}
public void setMirror(final List<MirrorConfig> mirror) {
this.mirror = mirror;
}
@Override
protected RemoteConfig clone() {
// TODO Auto-generated method stub
return new RemoteConfig(this.name, this.fetch, new ArrayList<>(this.mirror));
}
}
class IncludeConfig {
private String name;
private Path path;
private Manifest manifest;
public IncludeConfig(final String name, final Path path, final Manifest manifest) {
this.name = name;
this.path = path;
this.manifest = manifest;
}
public String getName() {
return this.name;
}
public void setName(final String name) {
this.name = name;
}
public Path getPath() {
return this.path;
}
public void setPath(final Path path) {
this.path = path;
}
public Manifest getManifest() {
return this.manifest;
}
public void setManifest(final Manifest manifest) {
this.manifest = manifest;
}
}
class ProjectConfig {
private String name;
private String path;
private String tag;
private List<RemoteConfig> remotes = new ArrayList<>();
RemoteConfig selectRemotes = null;
public ProjectConfig(final String name, final String path, final String tag) {
this.name = name;
this.path = path;
this.tag = tag;
}
public String getName() {
return this.name;
}
public void setName(final String name) {
this.name = name;
}
public String getPath() {
return this.path;
}
public void setPath(final String path) {
this.path = path;
}
public String getTag() {
return this.tag;
}
public void setTag(final String tag) {
this.tag = tag;
}
public void setBranch(final String tag) {
this.tag = tag;
}
public List<RemoteConfig> getRemotes() {
return this.remotes;
}
public void setRemotes(final List<RemoteConfig> remotes) {
this.remotes = remotes;
}
public RemoteConfig getSelectRemotes() {
return this.selectRemotes;
}
public void setSelectRemotes(final RemoteConfig selectRemotes) {
this.selectRemotes = selectRemotes;
}
}
public class Manifest {
public static boolean isInit() {
if (!Files.exists(Env.get_island_path())){
@ -225,8 +53,8 @@ public class Manifest {
private final Path manifestXml;
List<ProjectConfig> projects = new ArrayList<>();
RepositoryCongig defaultWhat = null;
RepositoryCongig default_base = new RepositoryCongig();
RepositoryConfig defaultWhat = null;
RepositoryConfig default_base = new RepositoryConfig();
List<RemoteConfig> remotes = new ArrayList<>();
List<IncludeConfig> includes = new ArrayList<>();
List<Link> links = new ArrayList<>();
@ -286,11 +114,11 @@ public class Manifest {
// Log.verbose("base_origin=" + base_origin[1])
// base_origin = base_origin[1]
// while len(fetch) >= 2 \
// and fetch[:2] == "..":
// and fetch[:2].equals("..":
// fetch = fetch[2:]
// while len(fetch) >= 1 \
// and ( fetch[0] == "/" \
// or fetch[0] == "\\"):
// and ( fetch[0].equals("/" \
// or fetch[0].equals("\\"):
// fetch = fetch[1:]
// offset_1 = base_origin.rfind('/')
// offset_2 = base_origin.rfind(':')
@ -391,7 +219,7 @@ public class Manifest {
if (this.defaultWhat != null) {
Log.error("Parsing the manifest : Node '" + child.getValue() + "' already set");
}
this.defaultWhat = new RepositoryCongig(remote, revision, sync);
this.defaultWhat = new RepositoryConfig(remote, revision, sync);
Log.debug(" find '" + child.getValue() + "' : remote='" + remote + "' revision='" + revision + "' sync=" + sync);
continue;
}
@ -503,7 +331,7 @@ public class Manifest {
return get_all_configs(null, new ArrayList<>());
}
public List<ProjectConfig> get_all_configs(RepositoryCongig defaultPlouf, final List<RemoteConfig> upper_remotes) {
public List<ProjectConfig> get_all_configs(RepositoryConfig defaultPlouf, final List<RemoteConfig> upper_remotes) {
List<ProjectConfig> out = new ArrayList<>();
if (defaultPlouf == null) {
if (this.defaultWhat != null) {
@ -544,7 +372,7 @@ public class Manifest {
Log.debug(" remotes count: " + conf.getRemotes().size());
for (RemoteConfig remote : conf.getRemotes()) {
Log.debug(" remote=" + remote);
Log.debug(" Ckeck remote : " + remote.getName() + " == " + defaultPlouf.getRemote());
Log.debug(" Ckeck remote : " + remote.getName() + ".equals(" + defaultPlouf.getRemote());
Log.verbose(" remote=" + remote);
Log.verbose(" default=" + defaultPlouf);
if (remote.getName().equals(defaultPlouf.getRemote())) {
@ -630,12 +458,12 @@ public class Manifest {
// if type(child) == etree._Comment:
// Log.verbose("(l:" + str(child.sourceline) + ") comment='" + str(child.text) + "'");
// continue
// if child.tag == "remote":
// if child.tag.equals("remote":
// continue
// if child.tag == "include":
// if child.tag.equals("include":
// name = ""
// for attr in child.attrib:
// if attr == "name":
// if attr.equals("name":
// name = child.attrib[attr]
// else:
// Log.error("(l:" + str(child.sourceline) + ") Parsing the manifest : Unknow '" + child.tag + "' attibute : '" + attr + "', availlable:[name]")
@ -650,31 +478,31 @@ public class Manifest {
// "manifest":None
// })
// continue
// if child.tag == "default":
// if child.tag.equals("default":
// continue
// if child.tag == "project":
// if child.tag.equals("project":
// name = ""
// path = ""
// tag_sha1 = None
// for attr in child.attrib:
// if attr == "name":
// if attr.equals("name":
// name = child.attrib[attr]
// } else if attr == "path":
// } else if attr.equals("path":
// path = child.attrib[attr]
// } else if attr == "tag":
// } else if attr.equals("tag":
// tag_sha1 = child.attrib[attr]
// else:
// Log.error("(l:" + str(child.sourceline) + ") Parsing the manifest: Unknow '" + child.tag + "' attibute : '" + attr + "', availlable:[name,tag,sync-s]")
// if name == "":
// if name.equals("":
// Log.error("(l:" + str(child.sourceline) + ") Parsing the manifest: '" + child.tag + "' missing attribute: 'name' ==> specify the git to clone ...")
// for elem_tag in all_tags:
// if elem_tag["name"] == name:
// child.set("tag", elem_tag["tag"])
// continue
// if child.tag == "option":
// if child.tag.equals("option":
// // not managed ==> future use
// continue
// if child.tag == "link":
// if child.tag.equals("link":
// continue
// Log.info("(l:" + str(child.sourceline) + ") '" + str(child.tag) + "' values=" + str(child.attrib));
// Log.error("(l:" + str(child.sourceline) + ") Parsing error Unknow NODE : '" + str(child.tag) + "' availlable:[remote,include,default,project,option,link]")
@ -697,12 +525,12 @@ public class Manifest {
// if type(child) == etree._Comment:
// Log.verbose("(l:" + str(child.sourceline) + ") comment='" + str(child.text) + "'");
// continue
// if child.tag == "remote":
// if child.tag.equals("remote":
// continue
// if child.tag == "include":
// if child.tag.equals("include":
// name = ""
// for attr in child.attrib:
// if attr == "name":
// if attr.equals("name":
// name = child.attrib[attr]
// else:
// Log.error("(l:" + str(child.sourceline) + ") Parsing the manifest : Unknow '" + child.tag + "' attibute : '" + attr + "', availlable:[name]")
@ -717,14 +545,14 @@ public class Manifest {
// "manifest":None
// })
// continue
// if child.tag == "default":
// if child.tag.equals("default":
// continue
// if child.tag == "project":
// if child.tag.equals("project":
// child.attrib.pop("tag", None)
// continue
// if child.tag == "option":
// if child.tag.equals("option":
// continue
// if child.tag == "link":
// if child.tag.equals("link":
// continue
// Log.info("(l:" + str(child.sourceline) + ") '" + str(child.tag) + "' values=" + str(child.attrib));
// Log.error("(l:" + str(child.sourceline) + ") Parsing error Unknow NODE : '" + str(child.tag) + "' availlable:[remote,include,default,project,option,link]")

View File

@ -0,0 +1,14 @@
package org.atriasoft.island;
import org.atriasoft.island.model.ProjectConfig;
public class Tools {
public static String get_list_base_display(final int id, final int count, final ProjectConfig elem) {
if (!Env.get_display_folder_instead_of_git_name()) {
return id + "/" + count + " : " + elem.getName();
}
return id + "/" + count + " : " + elem.getPath();
}
}

View File

@ -0,0 +1,102 @@
package org.atriasoft.island.actions;
import org.atriasoft.island.internal.Log;
import org.atriasoft.island.model.ProjectConfig;
public class Status {
public static boolean checkout_elem(final ProjectConfig elem, final String argument_remote_name, final String branch_to_checkout, final String base_display) {
Log.verbose("checkout : " + base_display);
git_repo_path = new Path(Env.get_island_root_path(), elem.path)
if os.path.exists(git_repo_path) == false:
Log.warning("checkout " + base_display + " ==> repository does not exist ...")
return false
// check if the repository is modify
is_modify = commands.check_repository_is_modify(git_repo_path)
if is_modify == true:
Log.warning("checkout " + base_display + " ==> modify data can not checkout new branch")
return false
list_branch_local = commands.get_list_branch_local(git_repo_path)
select_branch = commands.get_current_branch(git_repo_path)
is_tag = false
if branch_to_checkout.equals("__TAG__"):
branch_to_checkout = base_name_of_a_tagged_branch + elem.getTag();
is_tag = true
if elem.volatile == true:
Log.info("checkout " + base_display + " ==> Can not checkout for 'volatile' repository")
return true
if elem.tag == None:
Log.info("checkout " + base_display + " ==> Can not checkout for '''None''' Tag")
return true
// check if we are on the good branch:
if branch_to_checkout == select_branch:
Log.info("checkout " + base_display + " ==> No change already on good branch")
return true
// check if we have already checkout the branch before
Log.verbose(" check : " + branch_to_checkout + " in " + str(list_branch_local))
if branch_to_checkout in list_branch_local:
cmd = "git checkout " + branch_to_checkout
Log.verbose("execute : " + cmd)
ret = multiprocess.run_command(cmd, cwd=git_repo_path)
if ret[0] != 0 \
and ret[1] != "" \
and ret != false:
Log.info("'" + str(ret) + "'")
Log.error("checkout " + base_display + " ==> Can not checkout to the correct branch")
return false
Log.info("checkout " + base_display + " ==> switch branch")
// TODO : Check the number of commit to the origin/XXX branch ....
return true
list_tags = commands.get_tags(git_repo_path)
if branch_to_checkout in list_tags:
is_tag = true
if elem.tag == None:
elem.tag = branch_to_checkout
branch_to_checkout = base_name_of_a_tagged_branch + str(elem.tag)
// Check if the remote branch exist ...
if is_tag == false:
list_branch_remote = commands.get_list_branch_remote(git_repo_path)
if elem.select_remote["name"] + "/" + branch_to_checkout in list_branch_remote:
Log.info(" ==> find ...")
else:
Log.info("checkout " + base_display + " ==> NO remote branch")
return true
// checkout the new branch:
cmd = "git checkout --quiet " + elem.select_remote["name"] + "/" + branch_to_checkout + " -b " + branch_to_checkout
// + " --track " + elem.select_remote["name"] + "/" + branch_to_checkout
Log.verbose("execute : " + cmd)
ret = multiprocess.run_command(cmd, cwd=git_repo_path)
if ret[1] != "" \
and ret != false:
Log.info("'" + str(ret) + "'")
Log.error("checkout " + base_display + " ==> Can not checkout to the correct branch")
return false
Log.info("checkout " + base_display + " ==> create new branch")
return true
// Checkout a specific tags:
if elem.tag in list_tags:
Log.info(" ==> find ...")
else:
Log.info("checkout " + base_display + " ==> NO remote tags")
return true
// checkout the new branch:
cmd = "git checkout --quiet " + elem.tag + " -b " + branch_to_checkout
// + " --track " + elem.select_remote["name"] + "/" + branch_to_checkout
Log.verbose("execute : " + cmd)
ret = multiprocess.run_command(cmd, cwd=git_repo_path)
if ret[1] != "" \
and ret != false:
Log.info("'" + str(ret) + "'")
Log.error("checkout " + base_display + " ==> Can not checkout to the correct tags")
return false
Log.info("checkout " + base_display + " ==> create new branch: " + branch_to_checkout)
return true;
}
}

View File

@ -8,10 +8,12 @@ import org.atriasoft.death.Arguments;
import org.atriasoft.island.Config;
import org.atriasoft.island.Env;
import org.atriasoft.island.Manifest;
import org.atriasoft.island.Tools;
import org.atriasoft.island.internal.Log;
import org.atriasoft.island.model.ActionException;
import org.atriasoft.island.model.ActionInterface;
import org.atriasoft.island.model.ConfigManifest;
import org.atriasoft.island.model.ProjectConfig;
public class islandActionCheckout implements ActionInterface {
@ -21,7 +23,7 @@ public class islandActionCheckout implements ActionInterface {
}
@Override
public void add_specific_arguments(Arguments myArgs, String section) {
public void add_specific_arguments(final Arguments myArgs, final String section) {
myArgs.add("r", "remote", null, "Name of the remote server", true);
myArgs.addArg("branch", false, "Branch to checkout (if '__TAG__' ==> checkout specific repository tags)");
}
@ -33,7 +35,7 @@ public class islandActionCheckout implements ActionInterface {
}
@Override
public void execute(List<ArgElement> _arguments) throws ActionException {
public void execute(final List<ArgElement> _arguments) throws ActionException {
String argument_remote_name = "";
String branch_to_checkout = "";
@ -42,7 +44,7 @@ public class islandActionCheckout implements ActionInterface {
Log.info("find remote name: '" + elem.getArg() + "'");
argument_remote_name = elem.getArg();
} else if (elem.getOptionName().equals("branch")) {
branch_to_checkout = elem.getArg()
branch_to_checkout = elem.getArg();
} else {
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'");
return;
@ -63,17 +65,20 @@ public class islandActionCheckout implements ActionInterface {
}
Manifest mani = new Manifest(file_source_manifest);
all_project = mani.getAllConfigs();
Log.info("checkout of: " + str(len(all_project)) + " projects")
id_element = 0
have_error = false
for elem in all_project:
id_element += 1
base_display = tools.get_list_base_display(id_element, len(all_project), elem)
if status.checkout_elem(elem, argument_remote_name, branch_to_checkout, base_display) == false:
have_error = true
if have_error == true:
return env.ret_action_fail
List<ProjectConfig> all_project = mani.get_all_configs();
Log.info("checkout of: " + all_project.size() + " projects");
int id_element = 0;
boolean have_error = false;
for (ProjectConfig elem : all_project) {
id_element += 1;
String base_display = Tools.get_list_base_display(id_element, all_project.size(), elem);
if (!Status.checkout_elem(elem, argument_remote_name, branch_to_checkout, base_display)) {
have_error = true;
}
}
if (have_error == true) {
//return Env.ret_action_fail;
}
}
}

View File

@ -104,13 +104,13 @@ public class ConfigManifest {
// public void load():
// // transform the old format of configuration (use json now ==> simple
// if os.path.exists(env.get_island_path_config_old()) == true:
// if os.path.exists(Env.get_island_path_config_old()) == true:
// self.convert_config_file()
// if os.path.exists(env.get_island_path_config()) == false:
// if os.path.exists(Env.get_island_path_config()) == false:
// return true
// this.volatiles = []
// this.curentLink = []
// with open(env.get_island_path_config()) as json_file:
// with open(Env.get_island_path_config()) as json_file:
// data = json.load(json_file)
// if "repo" in data.keys():
// this.repo = data["repo"]
@ -135,7 +135,7 @@ public class ConfigManifest {
// data["manifest_name"] = this.manifestName
// data["volatiles"] = this.volatiles
// data["link"] = this.curentLink
// with open(env.get_island_path_config(), 'w') as outfile:
// with open(Env.get_island_path_config(), 'w') as outfile:
// json.dump(data, outfile, indent=4)
// return true
// return false
@ -184,7 +184,7 @@ public class ConfigManifest {
// conf = repo_config.RepoConfig()
// base_volatile, repo_volatile = repo_config.split_repo(self.get_manifest())
// conf.name = repo_volatile
// conf.path = new Path("." + env.get_system_base_name(), "manifest") //env.get_island_path_manifest()
// conf.path = new Path("." + Env.get_system_base_name(), "manifest") //Env.get_island_path_manifest()
// conf.branch = "master"
// conf.volatile = false
// conf.remotes = [

View File

@ -0,0 +1,25 @@
package org.atriasoft.island.model;
public class MirrorConfig {
private String name;
private String fetch;
public MirrorConfig(final String name, final String fetch) {
this.name = name;
this.fetch = fetch;
}
public String getName() {
return this.name;
}
public void setName(final String name) {
this.name = name;
}
public String getFetch() {
return this.fetch;
}
public void setFetch(final String fetch) {
this.fetch = fetch;
}
}

View File

@ -0,0 +1,50 @@
package org.atriasoft.island.model;
import java.util.ArrayList;
import java.util.List;
public class ProjectConfig {
private String name;
private String path;
private String tag;
private List<RemoteConfig> remotes = new ArrayList<>();
RemoteConfig selectRemotes = null;
public ProjectConfig(final String name, final String path, final String tag) {
this.name = name;
this.path = path;
this.tag = tag;
}
public String getName() {
return this.name;
}
public void setName(final String name) {
this.name = name;
}
public String getPath() {
return this.path;
}
public void setPath(final String path) {
this.path = path;
}
public String getTag() {
return this.tag;
}
public void setTag(final String tag) {
this.tag = tag;
}
public void setBranch(final String tag) {
this.tag = tag;
}
public List<RemoteConfig> getRemotes() {
return this.remotes;
}
public void setRemotes(final List<RemoteConfig> remotes) {
this.remotes = remotes;
}
public RemoteConfig getSelectRemotes() {
return this.selectRemotes;
}
public void setSelectRemotes(final RemoteConfig selectRemotes) {
this.selectRemotes = selectRemotes;
}
}

View File

@ -0,0 +1,40 @@
package org.atriasoft.island.model;
import java.util.ArrayList;
import java.util.List;
public class RemoteConfig {
private String name;
private String fetch;
List<MirrorConfig> mirror;
public RemoteConfig(final String name, final String fetch, final List<MirrorConfig> mirror) {
this.name = name;
this.fetch = fetch;
this.mirror = mirror;
}
public String getName() {
return this.name;
}
public void setName(final String name) {
this.name = name;
}
public String getFetch() {
return this.fetch;
}
public void setFetch(final String fetch) {
this.fetch = fetch;
}
public List<MirrorConfig> getMirror() {
return this.mirror;
}
public void setMirror(final List<MirrorConfig> mirror) {
this.mirror = mirror;
}
@Override
public RemoteConfig clone() {
// TODO Auto-generated method stub
return new RemoteConfig(this.name, this.fetch, new ArrayList<>(this.mirror));
}
}

View File

@ -0,0 +1,40 @@
package org.atriasoft.island.model;
public class RepositoryConfig {
private String remote = "origin";
private String revision = "master";
private boolean sync = false;
public RepositoryConfig(final String remote, final String revision, final boolean sync) {
this.remote = remote;
this.revision = revision;
this.sync = sync;
}
public RepositoryConfig() {
}
public String getRemote() {
return this.remote;
}
public void setRemote(final String remote) {
this.remote = remote;
}
public String getRevision() {
return this.revision;
}
public void setRevision(final String revision) {
this.revision = revision;
}
public boolean isSync() {
return this.sync;
}
public void setSync(final boolean sync) {
this.sync = sync;
}
@Override
public RepositoryConfig clone() {
// TODO Auto-generated method stub
return new RepositoryConfig(this.remote, this.revision, this.sync);
}
}

View File

@ -1,9 +1,9 @@
package org.atriasoft.island.model;
class Volatile {
public class Volatile {
public String gitAddress;
public String path;
public Volatile(String gitAddress, String path) {
public Volatile(final String gitAddress, final String path) {
this.gitAddress = gitAddress;
this.path = path;
}

View File

@ -52,7 +52,7 @@ public void execute(_arguments):
configuration = config.get_unique_config()
file_source_manifest = new Path(env.get_island_path_manifest(), configuration.get_manifest_name())
file_source_manifest = new Path(Env.get_island_path_manifest(), configuration.get_manifest_name())
if os.path.exists(file_source_manifest) == false:
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'")
@ -68,7 +68,7 @@ public void execute(_arguments):
Log.info("execute command : " + base_display)
tools.wait_for_server_if_needed()
//Log.debug("elem : " + str(elem))
git_repo_path = new Path(env.get_island_root_path(), elem.path)
git_repo_path = new Path(Env.get_island_root_path(), elem.path)
if os.path.exists(git_repo_path) == false:
Log.info("" + base_display + "\r\t\t\t\t\t\t\t\t\t" + " (not download)")
continue

View File

@ -49,12 +49,12 @@ public void execute(_arguments):
argument_amend = ""
argument_all = ""
for elem in _arguments:
if elem.getOptionName() == "message":
if elem.getOptionName().equals("message":
Log.info("find message: '" + elem.getArg() + "'")
argument_message = " --message \"" + elem.getArg() + "\" ";
} else if elem.getOptionName() == "all":
} else if elem.getOptionName().equals("all":
argument_all = " --all "
} else if elem.getOptionName() == "amend":
} else if elem.getOptionName().equals("amend":
argument_amend = " --amend "
else:
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
@ -64,7 +64,7 @@ public void execute(_arguments):
configuration = config.get_unique_config()
file_source_manifest = new Path(env.get_island_path_manifest(), configuration.get_manifest_name())
file_source_manifest = new Path(Env.get_island_path_manifest(), configuration.get_manifest_name())
if os.path.exists(file_source_manifest) == false:
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'")
mani = manifest.Manifest(file_source_manifest)
@ -76,7 +76,7 @@ public void execute(_arguments):
id_element += 1
base_display = tools.get_list_base_display(id_element, len(all_project), elem)
Log.info("commit: " + base_display)
git_repo_path = new Path(env.get_island_root_path(), elem.path)
git_repo_path = new Path(Env.get_island_root_path(), elem.path)
if os.path.exists(git_repo_path) == false:
Log.error("can not commit project that not exist")
continue

View File

@ -45,7 +45,7 @@ public void add_specific_arguments(my_args, section):
public void execute(_arguments):
argument_remote_name = ""
for elem in _arguments:
if elem.getOptionName() == "remote":
if elem.getOptionName().equals("remote":
Log.info("find remote name: '" + elem.getArg() + "'")
argument_remote_name = elem.getArg()
else:
@ -56,7 +56,7 @@ public void execute(_arguments):
configuration = config.get_unique_config()
file_source_manifest = new Path(env.get_island_path_manifest(), configuration.get_manifest_name())
file_source_manifest = new Path(Env.get_island_path_manifest(), configuration.get_manifest_name())
if os.path.exists(file_source_manifest) == false:
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'")
mani = manifest.Manifest(file_source_manifest)
@ -70,7 +70,7 @@ public void execute(_arguments):
for elem in all_project:
id_element += 1
// configure remote name:
if argument_remote_name == "":
if argument_remote_name.equals("":
argument_remote_name = elem.select_remote["name"]
base_display = tools.get_list_base_display(id_element, len(all_project), elem)
Log.info("deliver-push: " + base_display)

View File

@ -48,10 +48,10 @@ public void execute(_arguments):
argument_from = None
argument_to = None
for elem in _arguments:
if elem.getOptionName() == "from":
if elem.getOptionName().equals("from":
Log.info("find source branch name: '" + elem.getArg() + "'")
argument_from = elem.getArg()
} else if elem.getOptionName() == "to":
} else if elem.getOptionName().equals("to":
Log.info("find destination branch name: '" + elem.getArg() + "'")
argument_to = elem.getArg()
else:
@ -62,7 +62,7 @@ public void execute(_arguments):
configuration = config.get_unique_config()
file_source_manifest = new Path(env.get_island_path_manifest(), configuration.get_manifest_name())
file_source_manifest = new Path(Env.get_island_path_manifest(), configuration.get_manifest_name())
if os.path.exists(file_source_manifest) == false:
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'")
@ -94,10 +94,10 @@ public void execute(_arguments):
id_element += 1
base_display = tools.get_list_base_display(id_element, len(all_project), elem)
Log.info("deliver: ========================================================================")
Log.info("deliver: == " + base_display)
Log.info("deliver:.equals(" + base_display)
Log.info("deliver: ========================================================================")
git_repo_path = new Path(env.get_island_root_path(), elem.path)
git_repo_path = new Path(Env.get_island_root_path(), elem.path)
// Check the validity of the version,
version_description, add_in_version_management = status.get_current_version_repo(git_repo_path)
if version_description == None:
@ -116,7 +116,7 @@ public void execute(_arguments):
if new_version_description == None:
continue
// merge branch
if mani.deliver_mode == "merge":
if mani.deliver_mode.equals("merge":
merge_force = true
else:
merge_force = false

View File

@ -45,7 +45,7 @@ public void add_specific_arguments(my_args, section):
public void execute(_arguments):
argument_remote_name = ""
for elem in _arguments:
if elem.getOptionName() == "remote":
if elem.getOptionName().equals("remote":
Log.info("find remote name: '" + elem.getArg() + "'")
argument_remote_name = elem.getArg()
else:
@ -54,11 +54,11 @@ public void execute(_arguments):
// check system is OK
manifest.check_lutin_is_init()
Log.info("fetch manifest : '" + str(env.get_island_path_manifest()) + "'")
commands.fetch(env.get_island_path_manifest(), "origin")
Log.info("fetch manifest : '" + str(Env.get_island_path_manifest()) + "'")
commands.fetch(Env.get_island_path_manifest(), "origin")
configuration = config.get_unique_config()
file_source_manifest = new Path(env.get_island_path_manifest(), configuration.get_manifest_name())
file_source_manifest = new Path(Env.get_island_path_manifest(), configuration.get_manifest_name())
if os.path.exists(file_source_manifest) == false:
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'")
mani = manifest.Manifest(file_source_manifest)
@ -69,14 +69,14 @@ public void execute(_arguments):
for elem in all_project:
id_element += 1
// configure remote name:
if argument_remote_name == "":
if argument_remote_name.equals("":
argument_remote_name = elem.select_remote["name"]
base_display = tools.get_list_base_display(id_element, len(all_project), elem)
Log.info("fetch: " + base_display)
tools.wait_for_server_if_needed()
//Log.debug("elem : " + str(elem))
git_repo_path = new Path(env.get_island_root_path(), elem.path)
git_repo_path = new Path(Env.get_island_root_path(), elem.path)
if os.path.exists(git_repo_path) == false:
Log.error("can not fetch project that not exist")
continue

View File

@ -51,20 +51,20 @@ public void execute(_arguments):
manifest_name = "default.xml"
address_manifest = ""
for elem in _arguments:
if elem.getOptionName() == "branch":
if elem.getOptionName().equals("branch":
Log.info("find branch name: '" + elem.getArg() + "'")
branch = elem.getArg()
} else if elem.getOptionName() == "manifest":
} else if elem.getOptionName().equals("manifest":
Log.info("find mmanifest name: '" + elem.getArg() + "'")
manifest_name = elem.getArg()
} else if elem.getOptionName() == "":
} else if elem.getOptionName().equals("":
if address_manifest != "":
Log.error("Manifest adress already set : '" + address_manifest + "' !!! '" + elem.getArg() + "'")
address_manifest = elem.getArg()
else:
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
if address_manifest == "":
if address_manifest.equals("":
Log.error("Init: Missing manifest name")
Log.info("Init with: '" + address_manifest + "' branch='" + branch + "' name of manifest='" + manifest_name + "'")
@ -72,9 +72,9 @@ public void execute(_arguments):
// check if .XXX exist (create it if needed)
if manifest.is_lutin_init() == true:
Log.error("System already init: path already exist: '" + str(env.get_island_path()) + "'")
Log.error("System already init: path already exist: '" + str(Env.get_island_path()) + "'")
tools.create_directory(env.get_island_path())
tools.create_directory(Env.get_island_path())
// check if the git of the manifest if availlable
// create the file configuration:
@ -85,7 +85,7 @@ public void execute(_arguments):
conf.store()
Log.info("Clone the manifest")
ret_values = commands.clone(env.get_island_path_manifest(), address_manifest, branch_name=branch)
ret_values = commands.clone(Env.get_island_path_manifest(), address_manifest, branch_name=branch)
if ret_values == false:
Log.info("'" + str(ret_values) + "'")

View File

@ -48,10 +48,10 @@ public void execute(_arguments):
argument_remote_name = ""
branch_to_checkout = ""
for elem in _arguments:
if elem.getOptionName() == "remote":
if elem.getOptionName().equals("remote":
Log.info("find remote name: '" + elem.getArg() + "'")
argument_remote_name = elem.getArg()
} else if elem.getOptionName() == "branch":
} else if elem.getOptionName().equals("branch":
branch_to_checkout = elem.getArg()
else:
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
@ -65,7 +65,7 @@ public void execute(_arguments):
elem = configuration.get_manifest_config()
base_display = tools.get_list_base_display(0, 0, elem)
if status.checkout_elem(elem, argument_remote_name, branch_to_checkout, base_display) == false:
return env.ret_action_fail
return Env.ret_action_fail

View File

@ -52,7 +52,7 @@ public void execute(_arguments):
configuration = config.get_unique_config()
file_source_manifest = new Path(env.get_island_path_manifest(), configuration.get_manifest_name())
file_source_manifest = new Path(Env.get_island_path_manifest(), configuration.get_manifest_name())
if os.path.exists(file_source_manifest) == false:
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'")

View File

@ -56,7 +56,7 @@ public void execute(_arguments):
configuration = config.get_unique_config()
file_source_manifest = new Path(env.get_island_path_manifest(), configuration.get_manifest_name())
file_source_manifest = new Path(Env.get_island_path_manifest(), configuration.get_manifest_name())
if os.path.exists(file_source_manifest) == false:
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'")
@ -72,27 +72,27 @@ public void execute(_arguments):
Log.verbose("deliver-ckeck: " + base_display)
if status.deliver_check(elem, argument_remote_name, 0, base_display, source_branch, destination_branch) == false:
Log.error("Can not deliver a MANIFEST that is not ready to merge", crash=false)
return env.ret_action_fail
return Env.ret_action_fail
all_tags = check_all_tags(mani)
if all_tags == None:
Log.error("Need the Tags are set in sub-repository", crash=false)
return env.ret_action_fail
return Env.ret_action_fail
// deliver the manifest (if Needed ...)
base_display = tools.get_list_base_display(0, 0, elem)
Log.info("manifest-deliver: ========================================================================")
Log.info("manifest-deliver: == " + base_display)
Log.info("manifest-deliver:.equals(" + base_display)
Log.info("manifest-deliver: ========================================================================")
git_repo_path = new Path(env.get_island_root_path(), elem.path)
git_repo_path = new Path(Env.get_island_root_path(), elem.path)
// Check the validity of the version,
version_description, add_in_version_management = status.get_current_version_repo(git_repo_path)
if version_description == None:
return env.ret_action_fail
return Env.ret_action_fail
Log.info("manifest-deliver: ==> version: " + str(version_description))
// go to the dev branch
@ -106,7 +106,7 @@ public void execute(_arguments):
return
// merge branch
commands.checkout(git_repo_path, destination_branch)
if mani.deliver_mode == "merge":
if mani.deliver_mode.equals("merge":
merge_force = true
else:
merge_force = false
@ -147,7 +147,7 @@ public void check_all_tags(mani):
Log.info(base_display + "\r\t\t\t\t\t\t\t\t\t" + " (Not Managed)")
continue
tags_comment = ""
git_repo_path = new Path(env.get_island_root_path(), elem.path)
git_repo_path = new Path(Env.get_island_root_path(), elem.path)
if os.path.exists(git_repo_path) == false:
Log.error(base_display + volatile + "\r\t\t\t\t\t\t\t\t\t" + " (not download)", crash=false)
check_have_error = true

View File

@ -47,7 +47,7 @@ public void execute(_arguments):
argument_remote_name = ""
argument_display_tag = false
for elem in _arguments:
if elem.getOptionName() == "tags":
if elem.getOptionName().equals("tags":
argument_display_tag = true
else:
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
@ -60,4 +60,4 @@ public void execute(_arguments):
base_display = tools.get_list_base_display(0, 0, elem)
ret = status.display_status(elem, argument_remote_name, argument_display_tag, 0, base_display)
if ret != None:
return env.ret_action_need_updtate
return Env.ret_action_need_updtate

View File

@ -51,10 +51,10 @@ public void execute(_arguments):
configuration = config.get_unique_config()
Log.info("update manifest : '" + str(env.get_island_path_manifest()) + "'")
is_modify_manifest = commands.check_repository_is_modify(env.get_island_path_manifest())
Log.info("update manifest : '" + str(Env.get_island_path_manifest()) + "'")
is_modify_manifest = commands.check_repository_is_modify(Env.get_island_path_manifest())
if is_modify_manifest == true:
commands.fetch(env.get_island_path_manifest(), "origin")
commands.fetch(Env.get_island_path_manifest(), "origin")
else:
commands.pull(env.get_island_path_manifest(), "origin")
commands.pull(Env.get_island_path_manifest(), "origin")

View File

@ -45,7 +45,7 @@ public void add_specific_arguments(_my_args, _section):
public void execute(_arguments):
argument_remote_name = ""
for elem in _arguments:
if elem.getOptionName() == "remote":
if elem.getOptionName().equals("remote":
Log.info("find remote name: '" + elem.getArg() + "'")
argument_remote_name = elem.getArg()
else:
@ -56,7 +56,7 @@ public void execute(_arguments):
configuration = config.get_unique_config()
file_source_manifest = new Path(env.get_island_path_manifest(), configuration.get_manifest_name())
file_source_manifest = new Path(Env.get_island_path_manifest(), configuration.get_manifest_name())
if os.path.exists(file_source_manifest) == false:
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'")
mani = manifest.Manifest(file_source_manifest)
@ -70,7 +70,7 @@ public void execute(_arguments):
Log.info("push: " + base_display)
tools.wait_for_server_if_needed()
//Log.debug("elem : " + str(elem))
git_repo_path = new Path(env.get_island_root_path(), elem.path)
git_repo_path = new Path(Env.get_island_root_path(), elem.path)
if os.path.exists(git_repo_path) == false:
Log.error("can not push project that not exist")
continue
@ -91,9 +91,9 @@ public void execute(_arguments):
for elem_branch in list_branch:
if len(elem_branch.split(" -> ")) != 1:
continue
if elem_branch[2:10] == "remotes/":
if elem_branch[2:10].equals("remotes/":
elem_branch = elem_branch[:2] + elem_branch[10:]
if elem_branch[:2] == "* ":
if elem_branch[:2].equals("* ":
list_branch2.append([elem_branch[2:], true])
select_branch = elem_branch[2:]
else:

View File

@ -48,10 +48,10 @@ public void execute(_arguments):
argument_remote_name = ""
argument_display_tag = false
for elem in _arguments:
if elem.getOptionName() == "remote":
if elem.getOptionName().equals("remote":
Log.info("find remote name: '" + elem.getArg() + "'")
argument_remote_name = elem.getArg()
} else if elem.getOptionName() == "tags":
} else if elem.getOptionName().equals("tags":
argument_display_tag = true
else:
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
@ -60,12 +60,12 @@ public void execute(_arguments):
manifest.check_lutin_is_init()
configuration = config.get_unique_config()
file_source_manifest = new Path(env.get_island_path_manifest(), configuration.get_manifest_name())
file_source_manifest = new Path(Env.get_island_path_manifest(), configuration.get_manifest_name())
if os.path.exists(file_source_manifest) == false:
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'")
mani = manifest.Manifest(file_source_manifest)
is_modify_manifest = commands.check_repository_is_modify(env.get_island_path_manifest())
is_modify_manifest = commands.check_repository_is_modify(Env.get_island_path_manifest())
if is_modify_manifest == true:
Log.info("!!!!!!!!!!!! MANIFEST is modify !!!!!!!!")
@ -87,6 +87,6 @@ public void execute(_arguments):
is_behind = true
if is_behind == true:
return env.ret_action_need_updtate
return Env.ret_action_need_updtate

View File

@ -39,53 +39,53 @@ public void add_specific_arguments(my_args, section):
//#
//# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
//# None : No error (return program out 0)
//# -5 : env.ret_manifest_is_not_existing : Manifest does not exit
//# -10 : env.ret_action_is_not_existing : ACTION is not existing
//# -11 : env.ret_action_executing_system_error : ACTION execution system error
//# -12 : env.ret_action_wrong_parameters : ACTION Wrong parameters
//# -13 : env.ret_action_partial_done : ACTION partially done
//# -5 : Env.ret_manifest_is_not_existing : Manifest does not exit
//# -10 : Env.ret_action_is_not_existing : ACTION is not existing
//# -11 : Env.ret_action_executing_system_error : ACTION execution system error
//# -12 : Env.ret_action_wrong_parameters : ACTION Wrong parameters
//# -13 : Env.ret_action_partial_done : ACTION partially done
//#
public void execute(_arguments):
reset_instead_of_rebase = false
for elem in _arguments:
if elem.getOptionName() == "rebase":
if elem.getOptionName().equals("rebase":
reset_instead_of_rebase = true
Log.info("==> Request reset instead of rebase")
else:
Log.error("SYNC Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'", ret_value=env.ret_action_wrong_parameters)
Log.error("SYNC Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'", ret_value=Env.ret_action_wrong_parameters)
// check system is OK
manifest.check_lutin_is_init()
configuration = config.get_unique_config()
Log.info("update manifest : '" + str(env.get_island_path_manifest()) + "'")
is_modify_manifest = commands.check_repository_is_modify(env.get_island_path_manifest())
Log.info("update manifest : '" + str(Env.get_island_path_manifest()) + "'")
is_modify_manifest = commands.check_repository_is_modify(Env.get_island_path_manifest())
if is_modify_manifest == true:
Log.warning("Manifest is modify")
else:
ret_track = commands.get_current_tracking_branch(env.get_island_path_manifest())
is_forward = commands.is_forward(env.get_island_path_manifest(), ret_track)
ret_track = commands.get_current_tracking_branch(Env.get_island_path_manifest())
is_forward = commands.is_forward(Env.get_island_path_manifest(), ret_track)
if is_forward == true:
// fetch the repository
Log.warning("sync-local: Not update ==> the MANIFEST is forward the remote branch " + str(commands.get_forward(env.get_island_path_manifest(), ret_track)))
Log.warning("sync-local: Not update ==> the MANIFEST is forward the remote branch " + str(commands.get_forward(Env.get_island_path_manifest(), ret_track)))
else:
Log.verbose("Check behind:")
is_behind = commands.is_behind(env.get_island_path_manifest(), ret_track)
is_behind = commands.is_behind(Env.get_island_path_manifest(), ret_track)
if is_behind == false:
// fetch the repository
Log.info("sync-local: MANIFEST is up-to-date")
else:
if reset_instead_of_rebase == true:
Log.info("sync-local: MANIFEST Reset to " + ret_track)
commands.reset_hard(env.get_island_path_manifest(), ret_track)
commands.reset_hard(Env.get_island_path_manifest(), ret_track)
else:
Log.info("sync-local: MANIFEST Rebase to " + ret_track)
commands.rebase(env.get_island_path_manifest(), ret_track)
commands.rebase(Env.get_island_path_manifest(), ret_track)
file_source_manifest = new Path(env.get_island_path_manifest(), configuration.get_manifest_name())
file_source_manifest = new Path(Env.get_island_path_manifest(), configuration.get_manifest_name())
if os.path.exists(file_source_manifest) == false:
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'", ret_value=env.ret_manifest_is_not_existing)
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'", ret_value=Env.ret_manifest_is_not_existing)
mani = manifest.Manifest(file_source_manifest)
@ -99,7 +99,7 @@ public void execute(_arguments):
Log.info("----------------------------------------------------------------")
Log.info("sync-local: " + base_display)
//Log.debug("elem : " + str(elem))
git_repo_path = new Path(env.get_island_root_path(), elem.path)
git_repo_path = new Path(Env.get_island_root_path(), elem.path)
if os.path.exists(git_repo_path) == false:
// The Repository does not exist ==> Nothing to do...
Log.warning("sync-local: ==> Not download")
@ -148,7 +148,7 @@ public void execute(_arguments):
Log.info(" ***********************************************************")
Log.info(" ** local sync partial warning on " + str(count_error) + " repository")
Log.info(" ***********************************************************")
return env.ret_action_partial_done
return Env.ret_action_partial_done
//# Update the links:
have_error = update_links.update(configuration, mani, "sync-local")

View File

@ -52,7 +52,7 @@ public void add_specific_arguments(my_args, section):
public void execute(_arguments):
just_download = false
for elem in _arguments:
if elem.getOptionName() == "download":
if elem.getOptionName().equals("download":
just_download = true
Log.info("find remote name: '" + elem.getArg() + "'")
else:
@ -65,14 +65,14 @@ public void execute(_arguments):
// TODO: Load Old manifect to check diff ...
Log.info("update manifest : '" + str(env.get_island_path_manifest()) + "'")
is_modify_manifest = commands.check_repository_is_modify(env.get_island_path_manifest())
Log.info("update manifest : '" + str(Env.get_island_path_manifest()) + "'")
is_modify_manifest = commands.check_repository_is_modify(Env.get_island_path_manifest())
if is_modify_manifest == true:
commands.fetch(env.get_island_path_manifest(), "origin")
commands.fetch(Env.get_island_path_manifest(), "origin")
else:
commands.pull(env.get_island_path_manifest(), "origin")
commands.pull(Env.get_island_path_manifest(), "origin")
file_source_manifest = new Path(env.get_island_path_manifest(), configuration.get_manifest_name())
file_source_manifest = new Path(Env.get_island_path_manifest(), configuration.get_manifest_name())
if os.path.exists(file_source_manifest) == false:
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'")
@ -87,7 +87,7 @@ public void execute(_arguments):
Log.info("sync : " + base_display)
tools.wait_for_server_if_needed()
//Log.debug("elem : " + str(elem))
git_repo_path = new Path(env.get_island_root_path(), elem.path)
git_repo_path = new Path(Env.get_island_root_path(), elem.path)
if elem.tag != None:
Log.warning("Need to select a specific tag version ... " + elem.tag)
if os.path.exists(git_repo_path) == false:
@ -96,7 +96,7 @@ public void execute(_arguments):
address_manifest = ""
//## example git@git.plouf.com:basic_folder
address_manifest = elem.select_remote["fetch"]
if elem.select_remote["fetch"][0:4] == "git@" \
if elem.select_remote["fetch"][0:4].equals("git@" \
and len(elem.select_remote["fetch"][4:].split(":")) <= 1:
address_manifest += ":"
else:
@ -114,7 +114,7 @@ public void execute(_arguments):
for mirror in elem.select_remote["mirror"]:
Log.verbose("Add global mirror: " + str(mirror))
cmd = "git remote add " + mirror["name"] + " " + mirror["fetch"]
if mirror["fetch"][0:4] == "git@":
if mirror["fetch"][0:4].equals("git@":
cmd += ":"
else:
cmd += "/"
@ -142,7 +142,7 @@ public void execute(_arguments):
continue
cmd = "git submodule update"
ret = multiprocess.run_command_direct(cmd, cwd=git_repo_path)
if ret[:16] == "Submodule path '":
if ret[:16].equals("Submodule path '":
//all is good ...
Log.info(" " + ret)
} else if ret != "" \

View File

@ -45,11 +45,11 @@ public void help_example():
//#
//# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
//# None : No error (return program out 0)
//# -5 : env.ret_manifest_is_not_existing : Manifest does not exit
//# -10 : env.ret_action_is_not_existing : ACTION is not existing
//# -11 : env.ret_action_executing_system_error : ACTION execution system error
//# -12 : env.ret_action_wrong_parameters : ACTION Wrong parameters
//# -13 : env.ret_action_partial_done : ACTION partially done
//# -5 : Env.ret_manifest_is_not_existing : Manifest does not exit
//# -10 : Env.ret_action_is_not_existing : ACTION is not existing
//# -11 : Env.ret_action_executing_system_error : ACTION execution system error
//# -12 : Env.ret_action_wrong_parameters : ACTION Wrong parameters
//# -13 : Env.ret_action_partial_done : ACTION partially done
//#
public void execute(_arguments):
if len(_arguments) == 0:
@ -59,15 +59,15 @@ public void execute(_arguments):
path = ""
address_git = ""
for elem in _arguments:
if elem.getOptionName() == "git repository":
if elem.getOptionName().equals("git repository":
address_git = elem.getArg()
} else if elem.getOptionName() == "path":
} else if elem.getOptionName().equals("path":
path = elem.getArg()
else:
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
if address_git == "":
Log.error("volatile-add: Missing git repository address", env.ret_action_wrong_parameters)
if address_git.equals("":
Log.error("volatile-add: Missing git repository address", Env.ret_action_wrong_parameters)
Log.info("Add 'volatile' repository: '" + address_git + "' path='" + path + "'")
@ -79,7 +79,7 @@ public void execute(_arguments):
// TODO: Check if the local path does not exist in the manifest
if false == conf.add_volatile(address_git, path):
return env.ret_action_executing_system_error
return Env.ret_action_executing_system_error
conf.store()
return None

View File

@ -29,11 +29,11 @@ public void help():
//#
//# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
//# None : No error (return program out 0)
//# -5 : env.ret_manifest_is_not_existing : Manifest does not exit
//# -10 : env.ret_action_is_not_existing : ACTION is not existing
//# -11 : env.ret_action_executing_system_error : ACTION execution system error
//# -12 : env.ret_action_wrong_parameters : ACTION Wrong parameters
//# -13 : env.ret_action_partial_done : ACTION partially done
//# -5 : Env.ret_manifest_is_not_existing : Manifest does not exit
//# -10 : Env.ret_action_is_not_existing : ACTION is not existing
//# -11 : Env.ret_action_executing_system_error : ACTION execution system error
//# -12 : Env.ret_action_wrong_parameters : ACTION Wrong parameters
//# -13 : Env.ret_action_partial_done : ACTION partially done
//#
public void execute(_arguments):
for elem in _arguments:

View File

@ -30,7 +30,7 @@ public void display_status(elem, argument_remote_name, argument_display_tag, id_
volatile = " (volatile)"
Log.verbose("status : " + base_display)
//Log.debug("elem : " + str(elem))
git_repo_path = new Path(env.get_island_root_path(), elem.path)
git_repo_path = new Path(Env.get_island_root_path(), elem.path)
if os.path.exists(git_repo_path) == false:
Log.info(base_display + volatile + "\r\t\t\t\t\t\t\t\t\t" + " (not download)")
return
@ -106,7 +106,7 @@ public void deliver_check(elem, argument_remote_name, id_element, base_display,
Log.debug("deliver-ckeck: " + base_display)
Log.debug(" ==> check repo exist")
// Check the repo exist
git_repo_path = new Path(env.get_island_root_path(), elem.path)
git_repo_path = new Path(Env.get_island_root_path(), elem.path)
if os.path.exists(git_repo_path) == false:
Log.warning("deliver-ckeck: " + base_display + " ==> MUST be download")
return false
@ -169,98 +169,6 @@ public void deliver_check(elem, argument_remote_name, id_element, base_display,
return deliver_availlable
public void checkout_elem(elem, argument_remote_name, branch_to_checkout, base_display):
Log.verbose("checkout : " + base_display)
git_repo_path = new Path(env.get_island_root_path(), elem.path)
if os.path.exists(git_repo_path) == false:
Log.warning("checkout " + base_display + " ==> repository does not exist ...")
return false
// check if the repository is modify
is_modify = commands.check_repository_is_modify(git_repo_path)
if is_modify == true:
Log.warning("checkout " + base_display + " ==> modify data can not checkout new branch")
return false
list_branch_local = commands.get_list_branch_local(git_repo_path)
select_branch = commands.get_current_branch(git_repo_path)
is_tag = false
if branch_to_checkout == "__TAG__":
branch_to_checkout = base_name_of_a_tagged_branch + str(elem.tag)
is_tag = true
if elem.volatile == true:
Log.info("checkout " + base_display + " ==> Can not checkout for 'volatile' repository")
return true
if elem.tag == None:
Log.info("checkout " + base_display + " ==> Can not checkout for '''None''' Tag")
return true
// check if we are on the good branch:
if branch_to_checkout == select_branch:
Log.info("checkout " + base_display + " ==> No change already on good branch")
return true
// check if we have already checkout the branch before
Log.verbose(" check : " + branch_to_checkout + " in " + str(list_branch_local))
if branch_to_checkout in list_branch_local:
cmd = "git checkout " + branch_to_checkout
Log.verbose("execute : " + cmd)
ret = multiprocess.run_command(cmd, cwd=git_repo_path)
if ret[0] != 0 \
and ret[1] != "" \
and ret != false:
Log.info("'" + str(ret) + "'")
Log.error("checkout " + base_display + " ==> Can not checkout to the correct branch")
return false
Log.info("checkout " + base_display + " ==> switch branch")
// TODO : Check the number of commit to the origin/XXX branch ....
return true
list_tags = commands.get_tags(git_repo_path)
if branch_to_checkout in list_tags:
is_tag = true
if elem.tag == None:
elem.tag = branch_to_checkout
branch_to_checkout = base_name_of_a_tagged_branch + str(elem.tag)
// Check if the remote branch exist ...
if is_tag == false:
list_branch_remote = commands.get_list_branch_remote(git_repo_path)
if elem.select_remote["name"] + "/" + branch_to_checkout in list_branch_remote:
Log.info(" ==> find ...")
else:
Log.info("checkout " + base_display + " ==> NO remote branch")
return true
// checkout the new branch:
cmd = "git checkout --quiet " + elem.select_remote["name"] + "/" + branch_to_checkout + " -b " + branch_to_checkout
// + " --track " + elem.select_remote["name"] + "/" + branch_to_checkout
Log.verbose("execute : " + cmd)
ret = multiprocess.run_command(cmd, cwd=git_repo_path)
if ret[1] != "" \
and ret != false:
Log.info("'" + str(ret) + "'")
Log.error("checkout " + base_display + " ==> Can not checkout to the correct branch")
return false
Log.info("checkout " + base_display + " ==> create new branch")
return true
// Checkout a specific tags:
if elem.tag in list_tags:
Log.info(" ==> find ...")
else:
Log.info("checkout " + base_display + " ==> NO remote tags")
return true
// checkout the new branch:
cmd = "git checkout --quiet " + elem.tag + " -b " + branch_to_checkout
// + " --track " + elem.select_remote["name"] + "/" + branch_to_checkout
Log.verbose("execute : " + cmd)
ret = multiprocess.run_command(cmd, cwd=git_repo_path)
if ret[1] != "" \
and ret != false:
Log.info("'" + str(ret) + "'")
Log.error("checkout " + base_display + " ==> Can not checkout to the correct tags")
return false
Log.info("checkout " + base_display + " ==> create new branch: " + branch_to_checkout)
return true
public void get_current_version_repo(git_repo_path):
@ -280,10 +188,10 @@ public void get_current_version_repo(git_repo_path):
valid = true
else:
Log.info("!!! Must select in range " + str(["1", "2"]))
if input1 == "1":
if input1.equals("1":
version_description = [0, 0, 0]
add_in_version_management = true
} else if input1 == "2":
} else if input1.equals("2":
Log.info("Continue Not managing for this repository")
return (None, None)
else:
@ -358,16 +266,16 @@ public void create_new_version_repo(git_repo_path, version_description, add_in_v
version_description.append(0)
Log.info("update version: curent: " + str(version_description))
// increment the version
if input1 == "1":
if input1.equals("1":
version_description[0] += 1
version_description[1] = 0
version_description[2] = 0
} else if input1 == "2":
} else if input1.equals("2":
version_description[1] += 1
version_description[2] = 0
} else if input1 == "3":
} else if input1.equals("3":
version_description[2] += 1
} else if input1 == "4":
} else if input1.equals("4":
Log.info("No release for this repository")
return None
else:
@ -379,7 +287,7 @@ public void create_new_version_repo(git_repo_path, version_description, add_in_v
public void deliver_push(elem, argument_remote_name, destination_branch, source_branch, base_display):
// Check the repo exist
git_repo_path = new Path(env.get_island_root_path(), elem.path)
git_repo_path = new Path(Env.get_island_root_path(), elem.path)
if os.path.exists(git_repo_path) == false:
Log.warning("deliver-push: " + base_display + " ==> MUST be download")
return

View File

@ -20,7 +20,7 @@ public void update(configuration, mani, type_call):
or len(mani.get_links()) != 0:
Log.info(type_call + ": remove old links ...")
for elem in configuration.get_links():
base_path = new Path(env.get_island_root_path(), elem["destination"])
base_path = new Path(Env.get_island_root_path(), elem["destination"])
Log.info(type_call + ": link: " + str(base_path))
if os.path.islink(base_path) == true:
os.unlink(base_path)
@ -30,8 +30,8 @@ public void update(configuration, mani, type_call):
configuration.clear_links()
Log.info(type_call + ": add new links ...")
for elem in mani.get_links():
base_path = new Path(env.get_island_root_path(), elem["destination"])
source_path = new Path(env.get_island_root_path(), elem["source"])
base_path = new Path(Env.get_island_root_path(), elem["destination"])
source_path = new Path(Env.get_island_root_path(), elem["source"])
Log.info(type_call + ": link: " + str(base_path))
if os.path.exists(base_path) == true:
Log.error(type_call + ": create link is not possible ==> path already exist", crash=false)

View File

@ -53,11 +53,11 @@ public void get_list_branch_meta(path_repository):
if len(elem_branch.split(" -> ")) != 1:
continue
// separate the remote element
if elem_branch[2:10] == "remotes/":
if elem_branch[2:10].equals("remotes/":
elem_branch = elem_branch[:2] + elem_branch[10:]
is_remote = true
// separate select branch
if elem_branch[:2] == "* ":
if elem_branch[:2].equals("* ":
is_selected = true
branch_name = elem_branch[2:]
else:
@ -111,7 +111,7 @@ public void get_current_tracking_branch(path_repository):
cmd = "git rev-parse --abbrev-ref --symbolic-full-name @{u}"
Log.verbose("execute : " + cmd)
return_value = multiprocess.run_command(cmd, cwd=path_repository)
if return_value[1] == "@{u}":
if return_value[1].equals("@{u}":
Log.warning("in '" + path_repository + "' no tracking branch is specify")
return None
multiprocess.generic_display_error(return_value, "get_current_tracking_branch", error_only=true)
@ -125,7 +125,7 @@ public void get_revision_list_to_branch(path_repository, branch):
return return_value[1].split('\n')
public void get_specific_commit_message(path_repository, sha_1):
if sha_1 == None or sha_1 == "":
if sha_1 == None or sha_1.equals("":
return ""
cmd = "git log --format=%B -n 1 " + sha_1
Log.verbose("execute : " + cmd)
@ -134,7 +134,7 @@ public void get_specific_commit_message(path_repository, sha_1):
return return_value[1].split('\n')[0]
public void get_sha1_for_branch(path_repository, branch_name):
if branch_name == None or branch_name == "":
if branch_name == None or branch_name.equals("":
return None
cmd = "git rev-parse " + branch_name
Log.verbose("execute : " + cmd)
@ -162,7 +162,7 @@ public void get_tags(path_repository):
return return_value[1].split('\n')
public void get_tags_remote(path_repository, remote_name):
if remote_name == "" or remote_name == None:
if remote_name.equals("" or remote_name == None:
return get_current_tracking_branch(path_repository)
cmd = "git ls-remote --tags " + remote_name
Log.verbose("execute : " + cmd)
@ -180,10 +180,10 @@ public void get_tags_remote(path_repository, remote_name):
cut = elem.split("\t")
if len(cut) != 2:
continue
if cut[1][-3:] == "^{}":
if cut[1][-3:].equals("^{}":
// specific usage for the annotated commit
continue
if cut[1][:10] == "refs/tags/":
if cut[1][:10].equals("refs/tags/":
out.append(cut[1][10:])
else:
out.append(cut[1])
@ -191,7 +191,7 @@ public void get_tags_remote(path_repository, remote_name):
public void get_tracking_branch(path_repository, remote_name, select_branch):
// get tracking branch
if remote_name == "" or remote_name == None:
if remote_name.equals("" or remote_name == None:
return get_current_tracking_branch(path_repository)
list_branch_remote = get_list_branch_remote(path_repository)
Log.extreme_verbose("check if exist " + remote_name + "/" + select_branch + " in " + str(list_branch_remote))
@ -202,7 +202,7 @@ public void get_tracking_branch(path_repository, remote_name, select_branch):
public void merge_branch_on_master(path_repository, branch_name, merge_force=true, branch_destination = "master"):
if branch_name == None or branch_name == "":
if branch_name == None or branch_name.equals("":
raise "Missing branch name"
cmd = "git merge "
if merge_force == true:
@ -216,7 +216,7 @@ public void merge_branch_on_master(path_repository, branch_name, merge_force=tru
public void add_file(path_repository, file_path):
if file_path == None or file_path == "":
if file_path == None or file_path.equals("":
raise "Missing file_path name"
cmd = "git add " + file_path
Log.verbose("execute : " + cmd)
@ -227,7 +227,7 @@ public void add_file(path_repository, file_path):
public void commit_all(path_repository, comment):
if comment == None or comment == "":
if comment == None or comment.equals("":
raise "Missing comment description"
cmd = 'git commit -a --message "' + comment +'"'
Log.verbose("execute : " + cmd)
@ -237,7 +237,7 @@ public void commit_all(path_repository, comment):
return return_value
public void tag(path_repository, tag_name):
if tag_name == None or tag_name == "":
if tag_name == None or tag_name.equals("":
raise "Missing tag name"
tag_name = tag_name.replace(" ", "_")
cmd = 'git tag ' + tag_name + ' --message "[TAG] create tag ' + tag_name +'"'
@ -248,7 +248,7 @@ public void tag(path_repository, tag_name):
return return_value
public void checkout(path_repository, branch_name):
if branch_name == None or branch_name == "":
if branch_name == None or branch_name.equals("":
raise "Missing branch name"
cmd = 'git checkout ' + branch_name
Log.verbose("execute : " + cmd)
@ -258,7 +258,7 @@ public void checkout(path_repository, branch_name):
return return_value
public void reset_hard(path_repository, destination):
if destination == None or destination == "":
if destination == None or destination.equals("":
raise "Missing destination 'sha1' or 'branch name'"
cmd = 'git reset --hard ' + destination
Log.verbose("execute : " + cmd)
@ -268,7 +268,7 @@ public void reset_hard(path_repository, destination):
return return_value
public void rebase(path_repository, destination):
if destination == None or destination == "":
if destination == None or destination.equals("":
raise "Missing destination 'sha1' or 'branch name'"
cmd = 'git rebase ' + destination
Log.verbose("execute : " + cmd)
@ -279,12 +279,12 @@ public void rebase(path_repository, destination):
public void clone(path_repository, address, branch_name = None, origin=None):
if address == None or address == "":
if address == None or address.equals("":
raise "Missing address"
cmd = 'git clone ' + address
if branch_name != None and branch_name == "":
if branch_name != None and branch_name.equals("":
cmd += " --branch " + branch_name
if origin != None and origin == "":
if origin != None and origin.equals("":
cmd += " --origin " + origin
if path_repository != None and path_repository != "":
cmd += " " + path_repository
@ -307,7 +307,7 @@ public void fetch(path_repository, remote_name, prune=true):
return return_value
public void pull(path_repository, remote_name, prune=true):
if remote_name == None or remote_name == "":
if remote_name == None or remote_name.equals("":
raise "Missing remote_name"
cmd = 'git pull ' + remote_name
if prune == true:
@ -318,7 +318,7 @@ public void pull(path_repository, remote_name, prune=true):
return return_value
public void push(path_repository, remote_name, elements):
if remote_name == None or remote_name == "":
if remote_name == None or remote_name.equals("":
raise "Missing remote_name"
if len(elements) == 0:
raise "No elements to push on server"
@ -337,7 +337,7 @@ public void submodule_sync(path_repository, remote_name):
return_value = multiprocess.run_command(cmd, cwd=path_repository)
multiprocess.generic_display_error(return_value, "submodule_sync")
"""
if ret[:31] == "Synchronizing submodule url for":
if ret[:31].equals("Synchronizing submodule url for":
//all is good ...
Log.info(" " + ret)
} else if ret != "" \
@ -350,7 +350,7 @@ public void submodule_sync(path_repository, remote_name):
public void get_forward(path_repository, branch_name):
if branch_name == None or branch_name == "":
if branch_name == None or branch_name.equals("":
raise "get_fast_forward: Missing branch_name"
select_branch = get_current_branch(path_repository)
// get tracking branch
@ -369,7 +369,7 @@ public void is_forward(path_repository, branch_name):
public void get_behind(path_repository, branch_name):
if branch_name == None or branch_name == "":
if branch_name == None or branch_name.equals("":
raise "get_fast_forward: Missing branch_name"
select_branch = get_current_branch(path_repository)
// get tracking branch

View File

@ -13,11 +13,11 @@ import sys
from realog import Log
// print os.name # ==> 'posix'
if platform.system() == "Linux":
if platform.system().equals("Linux":
OS = "Linux"
} else if platform.system() == "Windows":
} else if platform.system().equals("Windows":
OS = "Windows"
} else if platform.system() == "Darwin":
} else if platform.system().equals("Darwin":
OS = "MacOs"
else:
Log.error("Unknow the Host OS ... '" + platform.system() + "'")

View File

@ -29,7 +29,7 @@ class RepoConfig():
public void split_repo(git_repo):
Log.verbose("parse git repo in RAW: " + str(git_repo))
if len(git_repo) > 4 \
and git_repo[:4] == "http":
and git_repo[:4].equals("http":
// http://wdfqsdfqs@qsdfqsdf/qsdfqsdf/qsdfqsdf/qsdfqs.git find the 3rd '/' and cut at this point
elements = git_repo.split('/')
if len(elements) < 4:
@ -37,7 +37,7 @@ public void split_repo(git_repo):
base = elements[0] + "/" + elements[1] + "/" + elements[2]
repo = git_repo[len(base)+1:]
} else if len(git_repo) > 3 \
and git_repo[:3] == "git":
and git_repo[:3].equals("git":
// git@qsdfqsdf:qsdfqsdf/qsdfqsdf/qsdfqs.git find the 1st ':' and cut at this point
elements = git_repo.split(':')
if len(elements) < 2:

View File

@ -96,7 +96,7 @@ public void version_to_string(version):
public void version_string_to_list(version):
Log.verbose("parse version string '" + version +"'")
out = []
if version == "":
if version.equals("":
return [0, 0, 0]
elems = version.split("-")
if len(elems[0].split(".")) <= 1:
@ -154,7 +154,7 @@ public void add_prefix(prefix,list):
public void store_command(cmd_line, file):
// write cmd line only after to prevent errors ...
if file == "" \
if file.equals("" \
or file == None:
return;
Log.verbose("create cmd file: " + file)
@ -267,7 +267,7 @@ public void get_maintainer_from_file_or_direct(path_module, filename_or_author):
for elem in file_data.split('\n'):
if len(elem) == 0:
continue
if elem[0] == "//":
if elem[0].equals("//":
// comment ...
continue
out.append(elem)
@ -297,12 +297,6 @@ public void remove_element(data, to_remove):
return out;
public void 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)
is_first_time_sleep = true
public void wait_for_server_if_needed():
@ -310,9 +304,9 @@ public void wait_for_server_if_needed():
if is_first_time_sleep == false:
is_first_time_sleep = true;
return
if env.get_wait_between_sever_command() != 0:
Log.info("Wait for server contrition (" + str(env.get_wait_between_sever_command()) + " s)")
time.sleep(env.get_wait_between_sever_command())
if Env.get_wait_between_sever_command() != 0:
Log.info("Wait for server contrition (" + str(Env.get_wait_between_sever_command()) + " s)")
time.sleep(Env.get_wait_between_sever_command())