Compare commits
3 Commits
1bb1c4638e
...
1351757c48
Author | SHA1 | Date | |
---|---|---|---|
1351757c48 | |||
9148d9242c | |||
5a05e0eb77 |
6
.project
6
.project
@ -11,14 +11,8 @@
|
|||||||
<arguments>
|
<arguments>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
<buildCommand>
|
|
||||||
<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
</buildSpec>
|
||||||
<natures>
|
<natures>
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
|
|
||||||
</natures>
|
</natures>
|
||||||
</projectDescription>
|
</projectDescription>
|
||||||
|
@ -12,16 +12,16 @@ import org.atriasoft.island.model.ActionException;
|
|||||||
import org.atriasoft.island.model.ActionInterface;
|
import org.atriasoft.island.model.ActionInterface;
|
||||||
|
|
||||||
public class Actions {
|
public class Actions {
|
||||||
private static Map<String, Class<ActionInterface>> actions = new HashMap<String,Class<ActionInterface>>();
|
private static Map<String, Class<? extends ActionInterface>> actions = new HashMap<String,Class<? extends ActionInterface>>();
|
||||||
public static void addAction(String name, Class<ActionInterface> klass) {
|
public static <T extends ActionInterface>void addAction(final String name, final Class<T> klass) {
|
||||||
actions.put(name, klass);
|
Actions.actions.put(name, klass);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get the wall list of action availlable
|
* Get the wall list of action availlable
|
||||||
* @return The list of action name
|
* @return The list of action name
|
||||||
*/
|
*/
|
||||||
public static Set<String> getListOfAction() {
|
public static Set<String> getListOfAction() {
|
||||||
return actions.keySet();
|
return Actions.actions.keySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -51,8 +51,8 @@ public class Actions {
|
|||||||
* @return The first line of description
|
* @return The first line of description
|
||||||
* @throws ActionException
|
* @throws ActionException
|
||||||
*/
|
*/
|
||||||
private String getFullActionHelp(String action_name) throws ActionException {
|
private static String getFullActionHelp(final String action_name) throws ActionException {
|
||||||
Class<ActionInterface> actionClass = actions.get(action_name);
|
Class<? extends ActionInterface> actionClass = Actions.actions.get(action_name);
|
||||||
if (actionClass == null) {
|
if (actionClass == null) {
|
||||||
throw new ActionException("Action does not registered");
|
throw new ActionException("Action does not registered");
|
||||||
}
|
}
|
||||||
@ -68,8 +68,8 @@ public class Actions {
|
|||||||
return action.help();
|
return action.help();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getActionHelpExample(String action_name) throws ActionException {
|
private static String getActionHelpExample(final String action_name) throws ActionException {
|
||||||
Class<ActionInterface> actionClass = actions.get(action_name);
|
Class<? extends ActionInterface> actionClass = Actions.actions.get(action_name);
|
||||||
if (actionClass == null) {
|
if (actionClass == null) {
|
||||||
throw new ActionException("Action does not registered");
|
throw new ActionException("Action does not registered");
|
||||||
}
|
}
|
||||||
@ -91,16 +91,16 @@ public class Actions {
|
|||||||
* @return The first line of description
|
* @return The first line of description
|
||||||
* @throws ActionException
|
* @throws ActionException
|
||||||
*/
|
*/
|
||||||
public String getActionHelp(String action_name) throws ActionException {
|
public static String getActionHelp(final String action_name) throws ActionException {
|
||||||
return getFullActionHelp(action_name).split("\n")[0];
|
return Actions.getFullActionHelp(action_name).split("\n")[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void usage(String action_name, Arguments arguments) throws ActionException {
|
public static void usage(final String action_name, final Arguments arguments) throws ActionException {
|
||||||
String help = getFullActionHelp(action_name);
|
String help = Actions.getFullActionHelp(action_name);
|
||||||
Log.print("Description:");
|
Log.print("Description:");
|
||||||
Log.print("\t" + help);
|
Log.print("\t" + help);
|
||||||
//TODO: ??? arguments.display(action_name);
|
//TODO: ??? arguments.display(action_name);
|
||||||
String helpExample = getActionHelpExample(action_name);
|
String helpExample = Actions.getActionHelpExample(action_name);
|
||||||
if (helpExample != null) {
|
if (helpExample != null) {
|
||||||
Log.print("Example:");
|
Log.print("Example:");
|
||||||
for (String elem : helpExample.split("\n")) {
|
for (String elem : helpExample.split("\n")) {
|
||||||
@ -110,8 +110,8 @@ public class Actions {
|
|||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void execute(String action_name, List<String> arguments) throws ActionException {
|
public static void execute(final String action_name, final List<String> arguments) throws ActionException {
|
||||||
Class<ActionInterface> actionClass = actions.get(action_name);
|
Class<? extends ActionInterface> actionClass = Actions.actions.get(action_name);
|
||||||
if (actionClass == null) {
|
if (actionClass == null) {
|
||||||
throw new ActionException("Action does not registered");
|
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);
|
List<ArgElement> my_under_args = my_under_args_parser.parse(arguments, have_unknow_argument);
|
||||||
// search help if needed ==> permit to not duplicating code
|
// search help if needed ==> permit to not duplicating code
|
||||||
for (ArgElement elem : my_under_args) {
|
for (ArgElement elem : my_under_args) {
|
||||||
if (elem.getOptionName() == "help") {
|
if (elem.getOptionName().equals("help")) {
|
||||||
usage(action_name, my_under_args_parser);
|
Actions.usage(action_name, my_under_args_parser);
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,6 +142,14 @@ public class Actions {
|
|||||||
for (ArgElement elem : my_under_args) {
|
for (ArgElement elem : my_under_args) {
|
||||||
Log.debug(" " + elem.getOptionName() + "='" + elem.getArg() + "'");
|
Log.debug(" " + elem.getOptionName() + "='" + elem.getArg() + "'");
|
||||||
}
|
}
|
||||||
action.execute(my_under_args);
|
try {
|
||||||
|
action.execute(my_under_args);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static boolean exist(final String action_to_do) {
|
||||||
|
return Actions.actions.get(action_to_do) != null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
116
src/org/atriasoft/island/Commands.java
Normal file
116
src/org/atriasoft/island/Commands.java
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
package org.atriasoft.island;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.atriasoft.island.internal.Log;
|
||||||
|
|
||||||
|
import org.eclipse.jgit.api.Git;
|
||||||
|
import org.eclipse.jgit.api.ListBranchCommand.ListMode;
|
||||||
|
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||||
|
import org.eclipse.jgit.api.errors.NoHeadException;
|
||||||
|
import org.eclipse.jgit.lib.BranchConfig;
|
||||||
|
import org.eclipse.jgit.lib.ObjectId;
|
||||||
|
import org.eclipse.jgit.lib.Ref;
|
||||||
|
import org.eclipse.jgit.lib.Repository;
|
||||||
|
import org.eclipse.jgit.revwalk.RevCommit;
|
||||||
|
|
||||||
|
public class Commands {
|
||||||
|
private Commands() {}
|
||||||
|
public static List<String> get_list_branch_local(final Git git) throws GitAPIException {
|
||||||
|
List<String> remotes = Commands.get_list_branch_remote(git);
|
||||||
|
List<Ref> list_branch_local = git.branchList().setListMode(ListMode.ALL).call();
|
||||||
|
List<String> out = new ArrayList<>();
|
||||||
|
for (Ref elem1 : list_branch_local) {
|
||||||
|
if (!remotes.contains(elem1.getName())) {
|
||||||
|
out.add(elem1.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
public static List<String> get_list_branch_all(final Git git) throws GitAPIException {
|
||||||
|
List<Ref> list_branch_local = git.branchList().setListMode(ListMode.ALL).call();
|
||||||
|
List<String> out = new ArrayList<>();
|
||||||
|
for (Ref elem1 : list_branch_local) {
|
||||||
|
out.add(elem1.getName());
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<String> get_list_branch_remote(final Git git) throws GitAPIException {
|
||||||
|
List<Ref> list_branch_local = git.branchList().setListMode(ListMode.REMOTE).call();
|
||||||
|
List<String> out = new ArrayList<>();
|
||||||
|
for (Ref elem1 : list_branch_local) {
|
||||||
|
out.add(elem1.getName());
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* better git.getRepository().getBranch();
|
||||||
|
* @param git
|
||||||
|
* @return
|
||||||
|
* @throws GitAPIException
|
||||||
|
* @deprecated use git.getRepository().getBranch();
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static String get_current_branch(final Git git) throws GitAPIException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public static List<String> get_tags(final Git git) throws GitAPIException {
|
||||||
|
List<Ref> list_tag = git.tagList().call();
|
||||||
|
List<String> out = new ArrayList<>();
|
||||||
|
for (Ref elem1 : list_tag) {
|
||||||
|
out.add(elem1.getName());
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
public static String get_tracking_branch(final Git git, final String remote_name, final String select_branch) throws GitAPIException, IOException {
|
||||||
|
// get tracking branch
|
||||||
|
if (remote_name.isEmpty() || remote_name == null) {
|
||||||
|
return Commands.get_current_tracking_branch(git);
|
||||||
|
}
|
||||||
|
List<String> list_branch_remote = Commands.get_list_branch_remote(git);
|
||||||
|
Log.verbose("check if exist " + remote_name + "/" + select_branch + " in " + list_branch_remote);
|
||||||
|
String tmpBranchName = remote_name + "/" + select_branch;
|
||||||
|
if (!list_branch_remote.contains(tmpBranchName)) {
|
||||||
|
Log.debug(" ==> can not get remote branch");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return remote_name + "/" + select_branch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String get_current_tracking_branch(final Git git) throws IOException {
|
||||||
|
Repository repo = git.getRepository();
|
||||||
|
return new BranchConfig(repo.getConfig(), repo.getBranch()).getTrackingBranch();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<ObjectId> get_revision_list_to_branch(final Git git, final String branch) throws NoHeadException, GitAPIException {
|
||||||
|
Iterable<RevCommit> commits = git.log().call();
|
||||||
|
List<ObjectId> out = new ArrayList<>();
|
||||||
|
for(RevCommit commit : commits ) {
|
||||||
|
ObjectId tmp = commit.toObjectId();
|
||||||
|
out.add(tmp);
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<String> get_tags_current(final Git git) {
|
||||||
|
List<String> out = new ArrayList<>();
|
||||||
|
out.add("TODO");
|
||||||
|
out.add("TODO");
|
||||||
|
/*
|
||||||
|
cmd = "git tag --points-at"
|
||||||
|
Log.verbose("execute : " + cmd)
|
||||||
|
return_value = multiprocess.run_command(cmd, cwd=path_repository)
|
||||||
|
multiprocess.generic_display_error(return_value, "get_tags_current", error_only=true)
|
||||||
|
list_tags = []
|
||||||
|
for elem in return_value[1].split('\n'):
|
||||||
|
if elem != "":
|
||||||
|
list_tags.append(elem)
|
||||||
|
*/
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -17,7 +17,7 @@ import java.nio.file.Paths;
|
|||||||
import org.atriasoft.island.internal.Log;
|
import org.atriasoft.island.internal.Log;
|
||||||
|
|
||||||
public class Env {
|
public class Env {
|
||||||
|
private Env() {}
|
||||||
public static final int ret_manifest_is_not_existing = -5;
|
public static final int ret_manifest_is_not_existing = -5;
|
||||||
public static final int ret_action_is_not_existing = -10;
|
public static final int ret_action_is_not_existing = -10;
|
||||||
public static final int ret_action_executing_system_error = -11;
|
public static final int ret_action_executing_system_error = -11;
|
||||||
@ -29,51 +29,51 @@ public class Env {
|
|||||||
|
|
||||||
public static String system_base_name = "island";
|
public static String system_base_name = "island";
|
||||||
|
|
||||||
public static void set_system_base_name(String val) {
|
public static void set_system_base_name(final String val) {
|
||||||
system_base_name = val;
|
Env.system_base_name = val;
|
||||||
}
|
}
|
||||||
public static String get_system_base_name() {
|
public static String get_system_base_name() {
|
||||||
return system_base_name;
|
return Env.system_base_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String get_system_config_name() {
|
public static String get_system_config_name() {
|
||||||
return "." + system_base_name + "Config.json";
|
return "." + Env.system_base_name + "Config.json";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean fetch_manifest = true;
|
private static boolean fetch_manifest = true;
|
||||||
|
|
||||||
public static void set_fetch_manifest(boolean val) {
|
public static void set_fetch_manifest(final boolean val) {
|
||||||
fetch_manifest = val;
|
Env.fetch_manifest = val;
|
||||||
}
|
}
|
||||||
public static boolean get_fetch_manifest() {
|
public static boolean get_fetch_manifest() {
|
||||||
return fetch_manifest;
|
return Env.fetch_manifest;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int wait_between_sever_command = 0;
|
private static int wait_between_sever_command = 0;
|
||||||
|
|
||||||
public static void set_wait_between_sever_command(int val) {
|
public static void set_wait_between_sever_command(final int val) {
|
||||||
wait_between_sever_command = val;
|
Env.wait_between_sever_command = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int get_wait_between_sever_command() {
|
public static int get_wait_between_sever_command() {
|
||||||
return wait_between_sever_command;
|
return Env.wait_between_sever_command;
|
||||||
}
|
}
|
||||||
public static String filter_command = "";
|
public static String filter_command = "";
|
||||||
|
|
||||||
public static void set_filter_command(String val) {
|
public static void set_filter_command(final String val) {
|
||||||
filter_command = val;
|
Env.filter_command = val;
|
||||||
}
|
}
|
||||||
public static String get_filter_command() {
|
public static String get_filter_command() {
|
||||||
return filter_command;
|
return Env.filter_command;
|
||||||
}
|
}
|
||||||
public static boolean need_process_with_filter(String data) {
|
public static boolean need_process_with_filter(final String data) {
|
||||||
if (filter_command.equals("")) {
|
if (Env.filter_command.equals("")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (data.length() < filter_command.length()) {
|
if (data.length() < Env.filter_command.length()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (data.substring(0,filter_command.length()).equals(filter_command)) {
|
if (data.substring(0,Env.filter_command.length()).equals(Env.filter_command)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -81,11 +81,11 @@ public class Env {
|
|||||||
|
|
||||||
private static boolean display_folder_instead_of_git_name = true;
|
private static boolean display_folder_instead_of_git_name = true;
|
||||||
|
|
||||||
public static void set_display_folder_instead_of_git_name(boolean val) {
|
public static void set_display_folder_instead_of_git_name(final boolean val) {
|
||||||
display_folder_instead_of_git_name = val;
|
Env.display_folder_instead_of_git_name = val;
|
||||||
}
|
}
|
||||||
public static boolean get_display_folder_instead_of_git_name() {
|
public static boolean get_display_folder_instead_of_git_name() {
|
||||||
return display_folder_instead_of_git_name;
|
return Env.display_folder_instead_of_git_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Path island_root_path = null;
|
private static Path island_root_path = null;
|
||||||
@ -97,50 +97,51 @@ public class Env {
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
//String tmp = island_root_path.toAbsolutePath().toString();
|
//String tmp = island_root_path.toAbsolutePath().toString();
|
||||||
//Log.info("Current absolute path is: " + tmp);
|
Env.island_root_path = Paths.get("");
|
||||||
island_root_path = Paths.get("");
|
Path tmpPath = Env.island_root_path.toAbsolutePath();
|
||||||
Path tmpPath = island_root_path;
|
Log.info("Current absolute path is: " + tmpPath);
|
||||||
while (!Files.isDirectory(tmpPath.resolve("." + get_system_base_name()))) {
|
while (!Files.isDirectory(tmpPath.resolve("." + Env.get_system_base_name()))) {
|
||||||
tmpPath = tmpPath.getParent();
|
tmpPath = tmpPath.getParent();
|
||||||
|
Log.info("test upper path: " + tmpPath);
|
||||||
if (tmpPath == null) {
|
if (tmpPath == null) {
|
||||||
Log.critical("the root path of " + get_system_base_name() + " must not be upper parent paths of (" + island_root_path.toAbsolutePath() + ")");
|
Log.critical("the root path of " + Env.get_system_base_name() + " must not be upper parent paths of (" + Env.island_root_path.toAbsolutePath() + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
island_root_path = tmpPath;
|
Env.island_root_path = tmpPath;
|
||||||
island_path_user_config = island_root_path.resolve(get_system_config_name());
|
Env.island_path_user_config = Env.island_root_path.resolve(Env.get_system_config_name());
|
||||||
island_path = island_root_path.resolve("." + get_system_base_name());
|
Env.island_path = Env.island_root_path.resolve("." + Env.get_system_base_name());
|
||||||
island_path_config = island_path.resolve("config.xml");
|
Env.island_path_config = Env.island_path.resolve("config.xml");
|
||||||
island_path_manifest = island_path.resolve("manifest");
|
Env.island_path_manifest = Env.island_path.resolve("manifest");
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* To use later to know where the ".island" parent path is ...
|
* To use later to know where the ".island" parent path is ...
|
||||||
* @return the parent path of the ".island"
|
* @return the parent path of the ".island"
|
||||||
*/
|
*/
|
||||||
public static Path get_island_root_path() {
|
public static Path get_island_root_path() {
|
||||||
return island_root_path;
|
return Env.island_root_path;
|
||||||
}
|
}
|
||||||
public static Path get_island_path() {
|
public static Path get_island_path() {
|
||||||
return island_path;
|
return Env.island_path;
|
||||||
}
|
}
|
||||||
public static Path get_island_path_config() {
|
public static Path get_island_path_config() {
|
||||||
return island_path_config;
|
return Env.island_path_config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Path get_island_path_manifest() {
|
public static Path get_island_path_manifest() {
|
||||||
return island_path_manifest;
|
return Env.island_path_manifest;
|
||||||
}
|
}
|
||||||
public static Path get_island_path_user_config() {
|
public static Path get_island_path_user_config() {
|
||||||
return island_path_user_config;
|
return Env.island_path_user_config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(final String[] args) {
|
||||||
Log.error("island_root_path = " + island_root_path.toAbsolutePath());
|
Log.error("island_root_path = " + Env.island_root_path.toAbsolutePath());
|
||||||
Log.error("island_path_user_config = " + island_path_user_config.toAbsolutePath());
|
Log.error("island_path_user_config = " + Env.island_path_user_config.toAbsolutePath());
|
||||||
Log.error("island_path = " + island_path.toAbsolutePath());
|
Log.error("island_path = " + Env.island_path.toAbsolutePath());
|
||||||
Log.error("island_path_config = " + island_path_config.toAbsolutePath());
|
Log.error("island_path_config = " + Env.island_path_config.toAbsolutePath());
|
||||||
Log.error("island_path_manifest = " + island_path_manifest.toAbsolutePath());
|
Log.error("island_path_manifest = " + Env.island_path_manifest.toAbsolutePath());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
34
src/org/atriasoft/island/IncludeConfig.java
Normal file
34
src/org/atriasoft/island/IncludeConfig.java
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,189 +1,228 @@
|
|||||||
package org.atriasoft.island;
|
package org.atriasoft.island;
|
||||||
|
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.atriasoft.death.ArgChoice;
|
import org.atriasoft.death.ArgChoice;
|
||||||
|
import org.atriasoft.death.ArgElement;
|
||||||
import org.atriasoft.death.Arguments;
|
import org.atriasoft.death.Arguments;
|
||||||
|
import org.atriasoft.island.actions.IslandActionCheckout;
|
||||||
|
import org.atriasoft.island.actions.IslandActionStatus;
|
||||||
|
import org.atriasoft.island.internal.Log;
|
||||||
|
import org.atriasoft.island.model.ActionException;
|
||||||
|
|
||||||
public class MainIsland {
|
public class MainIsland {
|
||||||
private static Arguments my_args = new Arguments();
|
private final Arguments my_args = new Arguments();
|
||||||
|
|
||||||
//Log.verbose("List of actions: " + str(actions.get_list_of_action()))
|
//
|
||||||
static {
|
// @brief Display the help of this makefile.
|
||||||
my_args.addSection("option", "Can be set one time in all case");
|
//
|
||||||
my_args.add("h", "help", null, "Display this help");
|
public void usage() {
|
||||||
my_args.add("v", "verbose", Arrays.asList(
|
// generic argument displayed :
|
||||||
new ArgChoice("0","None"),
|
this.my_args.display("");
|
||||||
new ArgChoice("1","error"),
|
Log.print(" Action availlable" );
|
||||||
new ArgChoice("2","warning"),
|
Set<String> list_actions = Actions.getListOfAction();
|
||||||
new ArgChoice("3","info"),
|
for (String elem : list_actions) {
|
||||||
new ArgChoice("4","Log"),
|
Log.print(" " + elem);
|
||||||
new ArgChoice("5","verbose"),
|
try {
|
||||||
new ArgChoice("6","extreme_verbose")), "display Log level (verbose) default =2");
|
Log.print(" " + Actions.getActionHelp(elem));
|
||||||
my_args.add("c", "color", null, "Display message in color");
|
} catch (ActionException e) {
|
||||||
my_args.add("n", "no-fetch-manifest", null, "Disable the fetch of the manifest", false);
|
// TODO Auto-generated catch block
|
||||||
my_args.add("F", "filter", null, "Filter the action on a list of path or subpath: -f library", true);
|
e.printStackTrace();
|
||||||
my_args.add("f", "folder", null, "Display the folder instead of the git repository name", false);
|
Log.print(" ????? ERROR ?????");
|
||||||
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.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);
|
||||||
|
}
|
||||||
|
|
||||||
local_argument = my_args.parse();
|
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
|
||||||
// @brief Display the help of this makefile.
|
public boolean parse_generic_arg(final ArgElement argument, final boolean active) {
|
||||||
//
|
Log.verbose("parse arg : " + argument.getOptionName() + " " + argument.getArg() + " active=" + active);
|
||||||
public void usage():
|
if (argument.getOptionName().equals("help") ){
|
||||||
color = Log.get_color_set()
|
if (!active) {
|
||||||
// generic argument displayed :
|
usage();
|
||||||
my_args.display()
|
}
|
||||||
print(" Action availlable" )
|
return true;
|
||||||
list_actions = actions.get_list_of_action();
|
}
|
||||||
for elem in list_actions:
|
if (argument.getOptionName().equals("jobs") ){
|
||||||
print(" " + color['green'] + elem + color['default'])
|
if (active) {
|
||||||
print(" " + actions.get_action_help(elem))
|
//multiprocess.set_core_number(Integer.valueOf(argument.getArg()));
|
||||||
"""
|
}
|
||||||
print(" " + color['green'] + "init" + color['default'])
|
return true;
|
||||||
print(" initialize a 'island' interface with a manifest in a git ")
|
}
|
||||||
print(" " + color['green'] + "sync" + color['default'])
|
if (argument.getOptionName().equals("wait") ){
|
||||||
print(" Syncronise the currect environement")
|
if (active) {
|
||||||
print(" " + color['green'] + "status" + color['default'])
|
Env.set_wait_between_sever_command(Integer.parseInt(argument.getArg()));
|
||||||
print(" Dump the status of the environement")
|
}
|
||||||
"""
|
return true;
|
||||||
print(" ex: " + sys.argv[0] + " -c init http://github.com/atria-soft/manifest.git")
|
}
|
||||||
print(" ex: " + sys.argv[0] + " sync")
|
if (argument.getOptionName() .equals( "verbose") ){
|
||||||
exit(0)
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
public void check_boolean(value):
|
private void loadConfigUser() {
|
||||||
if value == "" \
|
// open configuration of island:
|
||||||
or value == "1" \
|
// Path config_file = Env.get_island_path_user_config();
|
||||||
or value == "true" \
|
// if (Files.isDirectory(config_file)) {
|
||||||
or value == "true" \
|
// sys.path.append(os.path.dirname(config_file));
|
||||||
or value == true:
|
// Log.debug("Find basic configuration file: '" + config_file + "'");
|
||||||
return true
|
// // the file exist, we can open it and get the initial configuration:
|
||||||
return false
|
// configuration_file = __import__(Env.get_system_config_name()[:-3]);
|
||||||
|
//
|
||||||
// preparse the argument to get the verbose element for Log mode
|
// if ("get_exclude_path" in dir(configuration_file) {
|
||||||
public void parse_generic_arg(argument, active):
|
// data = configuration_file.get_exclude_path();
|
||||||
Log.extreme_verbose("parse arg : " + argument.getOptionName() + " " + argument.getArg() + " active=" + str(active))
|
// Log.debug(" get default config 'get_exclude_path' val='" + str(data) + "'");
|
||||||
if argument.getOptionName() == "help":
|
// Env.set_exclude_search_path(data);
|
||||||
if active == false:
|
//
|
||||||
usage()
|
// if ("get_default_color" in dir(configuration_file) {
|
||||||
return true
|
// data = configuration_file.get_default_color();
|
||||||
} else if argument.getOptionName()=="jobs":
|
// Log.debug(" get default config 'get_default_color' val='" + str(data) + "'");
|
||||||
if active == true:
|
// parse_generic_arg(arg_element.ArgElement("color", str(data)), true);
|
||||||
//multiprocess.set_core_number(int(argument.getArg()))
|
//
|
||||||
pass
|
// if ("get_default_debug_level" in dir(configuration_file) {
|
||||||
return true
|
// data = configuration_file.get_default_debug_level();
|
||||||
} else if argument.getOptionName()=="wait":
|
// Log.debug(" get default config 'get_default_debug_level' val='" + str(data) + "'");
|
||||||
if active == true:
|
// parse_generic_arg(arg_element.ArgElement("verbose", str(data)), true);
|
||||||
env.set_wait_between_sever_command(int(argument.getArg()))
|
//
|
||||||
return true
|
// if ("get_default_folder" in dir(configuration_file) {
|
||||||
} else if argument.getOptionName() == "verbose":
|
// data = configuration_file.get_default_folder();
|
||||||
if active == true:
|
// Log.debug(" get default config 'get_default_folder' val='" + str(data) + "'");
|
||||||
Log.set_level(int(argument.getArg()))
|
// parse_generic_arg(arg_element.ArgElement("folder", str(data)), true);
|
||||||
return true
|
//
|
||||||
} else if argument.getOptionName() == "folder":
|
// if ("get_default_wait" in dir(configuration_file) {
|
||||||
if active == true:
|
// data = configuration_file.get_default_wait();
|
||||||
env.set_display_folder_instead_of_git_name(true)
|
// Log.debug(" get default config 'get_default_wait' val='" + str(data) + "'");
|
||||||
return true
|
// parse_generic_arg(arg_element.ArgElement("wait", str(data)), true);
|
||||||
} else if argument.getOptionName() == "color":
|
//
|
||||||
if active == true:
|
// if ("get_default_filter" in dir(configuration_file) {
|
||||||
if check_boolean(argument.getArg()) == true:
|
// data = configuration_file.get_default_filter();
|
||||||
Log.enable_color()
|
// Log.debug(" get default config 'get_default_filter' val='" + str(data) + "'");
|
||||||
else:
|
// parse_generic_arg(arg_element.ArgElement("filter", str(data)), true);
|
||||||
Log.disable_color()
|
// }
|
||||||
return true
|
// }
|
||||||
} else if argument.getOptionName() == "filter":
|
}
|
||||||
if active == true:
|
public MainIsland() {
|
||||||
env.set_filter_command(str(argument.getArg()))
|
Actions.addAction("status", IslandActionStatus.class);
|
||||||
return true
|
Actions.addAction("checkout", IslandActionCheckout.class);
|
||||||
} else if argument.getOptionName() == "no-fetch-manifest":
|
this.my_args.addSection("option", "Can be set one time in all case");
|
||||||
if active == false:
|
this.my_args.add("h", "help", null, "Display this help");
|
||||||
env.set_fetch_manifest(false)
|
this.my_args.add("v", "verbose", Arrays.asList(
|
||||||
return true
|
new ArgChoice("0","None"),
|
||||||
return false
|
new ArgChoice("1","error"),
|
||||||
|
new ArgChoice("2","warning"),
|
||||||
// open configuration of island:
|
new ArgChoice("3","info"),
|
||||||
config_file = env.get_island_path_user_config()
|
new ArgChoice("4","debug"),
|
||||||
if os.path.isfile(config_file) == true:
|
new ArgChoice("5","verbose"),
|
||||||
sys.path.append(os.path.dirname(config_file))
|
new ArgChoice("6","extreme_verbose")
|
||||||
Log.debug("Find basic configuration file: '" + config_file + "'")
|
), "display debug level (verbose) default =2");
|
||||||
// the file exist, we can open it and get the initial configuration:
|
this.my_args.add("c", "color", null, "Display message in color");
|
||||||
configuration_file = __import__(env.get_system_config_name()[:-3])
|
this.my_args.add("n", "no-fetch-manifest", null, "Disable the fetch of the manifest", false);
|
||||||
|
this.my_args.add("F", "filter", null, "Filter the action on a list of path or subpath: -f library", true);
|
||||||
|
this.my_args.add("f", "folder", null, "Display the folder instead of the git repository name", false);
|
||||||
|
this.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);
|
||||||
|
this.my_args.setStopAt(List.copyOf(Actions.getListOfAction()));
|
||||||
|
}
|
||||||
|
|
||||||
if "get_exclude_path" in dir(configuration_file):
|
void run(final String[] args) throws ActionException {
|
||||||
data = configuration_file.get_exclude_path()
|
List<String> argss = Arrays.asList(args);
|
||||||
Log.debug(" get default config 'get_exclude_path' val='" + str(data) + "'")
|
List<ArgElement> local_argument = this.my_args.parse(argss);
|
||||||
env.set_exclude_search_path(data)
|
|
||||||
|
|
||||||
if "get_default_color" in dir(configuration_file):
|
// parse default unique argument:
|
||||||
data = configuration_file.get_default_color()
|
for (ArgElement argument : local_argument) {
|
||||||
Log.debug(" get default config 'get_default_color' val='" + str(data) + "'")
|
parse_generic_arg(argument, true);
|
||||||
parse_generic_arg(arg_element.ArgElement("color", str(data)), true)
|
}
|
||||||
|
// remove all generic arguments:
|
||||||
|
List<ArgElement> new_argument_list = new ArrayList<>();
|
||||||
|
for (ArgElement argument : local_argument) {
|
||||||
|
if (parse_generic_arg(argument, false)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
new_argument_list.add(argument);
|
||||||
|
}
|
||||||
|
|
||||||
if "get_default_Log_level" in dir(configuration_file):
|
// now the first argument is: the action:
|
||||||
data = configuration_file.get_default_Log_level()
|
if (new_argument_list.size() == 0) {
|
||||||
Log.debug(" get default config 'get_default_debug_level' val='" + str(data) + "'")
|
Log.warning("--------------------------------------");
|
||||||
parse_generic_arg(arg_element.ArgElement("verbose", str(data)), true)
|
Log.warning("Missing the action to do ...");
|
||||||
|
Log.warning("--------------------------------------");
|
||||||
if "get_default_folder" in dir(configuration_file):
|
usage();
|
||||||
data = configuration_file.get_default_folder()
|
}
|
||||||
Log.debug(" get default config 'get_default_folder' val='" + str(data) + "'")
|
String action_to_do = new_argument_list.get(0).getArg();
|
||||||
parse_generic_arg(arg_element.ArgElement("folder", str(data)), true)
|
new_argument_list.remove(0);
|
||||||
|
if (!Actions.exist(action_to_do)) {
|
||||||
if "get_default_wait" in dir(configuration_file):
|
Log.warning("--------------------------------------");
|
||||||
data = configuration_file.get_default_wait()
|
Log.warning("Wrong action type : '" + action_to_do + "' availlable list: " + Actions.getListOfAction());
|
||||||
Log.debug(" get default config 'get_default_wait' val='" + str(data) + "'")
|
Log.warning("--------------------------------------");
|
||||||
parse_generic_arg(arg_element.ArgElement("wait", str(data)), true)
|
usage();
|
||||||
|
}
|
||||||
if "get_default_filter" in dir(configuration_file):
|
// todo : Remove this
|
||||||
data = configuration_file.get_default_filter()
|
if (!action_to_do.equals("init") && !Files.exists(Env.get_island_path())) {
|
||||||
Log.debug(" get default config 'get_default_filter' val='" + str(data) + "'")
|
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");
|
||||||
parse_generic_arg(arg_element.ArgElement("filter", str(data)), true)
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
argss = argss.subList(this.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()
|
|
||||||
|
|
||||||
|
|
@ -1,35 +1,28 @@
|
|||||||
package org.atriasoft.island;
|
package org.atriasoft.island;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.atriasoft.exml.Exml;
|
import org.atriasoft.exml.Exml;
|
||||||
|
import org.atriasoft.exml.exception.ExmlBuilderException;
|
||||||
|
import org.atriasoft.exml.exception.ExmlParserErrorMulti;
|
||||||
import org.atriasoft.exml.model.XmlAttribute;
|
import org.atriasoft.exml.model.XmlAttribute;
|
||||||
import org.atriasoft.exml.model.XmlElement;
|
import org.atriasoft.exml.model.XmlElement;
|
||||||
import org.atriasoft.exml.model.XmlNode;
|
import org.atriasoft.exml.model.XmlNode;
|
||||||
import org.atriasoft.exml.model.XmlNodeType;
|
import org.atriasoft.exml.model.XmlNodeType;
|
||||||
import org.atriasoft.exml.parser.ParseXml;
|
|
||||||
import org.atriasoft.island.internal.Log;
|
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.Git;
|
||||||
import org.eclipse.jgit.api.RemoteListCommand;
|
import org.eclipse.jgit.api.RemoteListCommand;
|
||||||
|
|
||||||
class RepositoryCongig {
|
|
||||||
String remote = "origin";
|
|
||||||
String revision = "master";
|
|
||||||
boolean sync = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
record MirrorConfig(String name, String fetch) {
|
|
||||||
}
|
|
||||||
|
|
||||||
record RemoteConfig(String name, String fetch, List<MirrorConfig> mirror) {
|
|
||||||
}
|
|
||||||
record IncludeConfig(String name, String path, Object manifest) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Manifest {
|
public class Manifest {
|
||||||
public static boolean isInit() {
|
public static boolean isInit() {
|
||||||
if (!Files.exists(Env.get_island_path())){
|
if (!Files.exists(Env.get_island_path())){
|
||||||
@ -48,7 +41,7 @@ public class Manifest {
|
|||||||
}
|
}
|
||||||
public static void checkIsInit() {
|
public static void checkIsInit() {
|
||||||
// check if .XXX exist (create it if needed)
|
// check if .XXX exist (create it if needed)
|
||||||
if (!isInit()) {
|
if (!Manifest.isInit()) {
|
||||||
Log.error("System not init: missing config: '" + Env.get_island_path() + "'. Call <island init> first");
|
Log.error("System not init: missing config: '" + Env.get_island_path() + "'. Call <island init> first");
|
||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
@ -57,34 +50,40 @@ public class Manifest {
|
|||||||
private String deliver_master = "master";
|
private String deliver_master = "master";
|
||||||
private String deliver_develop = "develop";
|
private String deliver_develop = "develop";
|
||||||
private String deliver_mode = "merge";
|
private String deliver_mode = "merge";
|
||||||
private Path manifestXml;
|
private final Path manifestXml;
|
||||||
|
|
||||||
List<Object> projects = new ArrayList<>();
|
List<ProjectConfig> projects = new ArrayList<>();
|
||||||
RepositoryCongig defaultWhat = null;
|
RepositoryConfig defaultWhat = null;
|
||||||
RepositoryCongig default_base = new RepositoryCongig();
|
RepositoryConfig default_base = new RepositoryConfig();
|
||||||
List<RemoteConfig> remotes = new ArrayList<>();
|
List<RemoteConfig> remotes = new ArrayList<>();
|
||||||
List<IncludeConfig> includes = new ArrayList<>();
|
List<IncludeConfig> includes = new ArrayList<>();
|
||||||
List<Object> links = new ArrayList<>();
|
List<Link> links = new ArrayList<>();
|
||||||
public Manifest(Path manifest_xml) {
|
public Manifest(final Path manifestXml) throws IOException {
|
||||||
manifestXml = manifest_xml;
|
this.manifestXml = manifestXml;
|
||||||
// load the manifest
|
// load the manifest
|
||||||
load();
|
try {
|
||||||
|
load();
|
||||||
|
} catch (ExmlBuilderException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
// check error in manifest (double path ...)
|
// check error in manifest (double path ...)
|
||||||
// TODO checkDoublePath();
|
// TODO checkDoublePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Object> getLinks() {
|
public List<Link> getLinks() {
|
||||||
return this.links;
|
return this.links;
|
||||||
}
|
}
|
||||||
String removeEndSlash(String value) {
|
String removeEndSlash(String value) {
|
||||||
while (value.length() > 1
|
while (value.length() > 1
|
||||||
&& ( value.charAt(value.length()-1) == '\\'
|
&& ( value.charAt(value.length()-1) == '\\'
|
||||||
|| value.charAt(value.length()-1) == '/')) {
|
|| value.charAt(value.length()-1) == '/') ) {
|
||||||
value = value.substring(0, value.length()-1);
|
value = value.substring(0, value.length()-1);
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
public void load() {
|
|
||||||
|
public void load() throws ExmlParserErrorMulti, ExmlBuilderException, IOException {
|
||||||
XmlElement rootNode = Exml.parse(this.manifestXml);
|
XmlElement rootNode = Exml.parse(this.manifestXml);
|
||||||
Log.debug("manifest : '" + this.manifestXml + "'");
|
Log.debug("manifest : '" + this.manifestXml + "'");
|
||||||
if (!rootNode.getValue().equals("manifest")) {
|
if (!rootNode.getValue().equals("manifest")) {
|
||||||
@ -115,11 +114,11 @@ public class Manifest {
|
|||||||
// Log.verbose("base_origin=" + base_origin[1])
|
// Log.verbose("base_origin=" + base_origin[1])
|
||||||
// base_origin = base_origin[1]
|
// base_origin = base_origin[1]
|
||||||
// while len(fetch) >= 2 \
|
// while len(fetch) >= 2 \
|
||||||
// and fetch[:2] == "..":
|
// and fetch[:2].equals("..":
|
||||||
// fetch = fetch[2:]
|
// fetch = fetch[2:]
|
||||||
// while len(fetch) >= 1 \
|
// while len(fetch) >= 1 \
|
||||||
// and ( fetch[0] == "/" \
|
// and ( fetch[0].equals("/" \
|
||||||
// or fetch[0] == "\\"):
|
// or fetch[0].equals("\\"):
|
||||||
// fetch = fetch[1:]
|
// fetch = fetch[1:]
|
||||||
// offset_1 = base_origin.rfind('/')
|
// offset_1 = base_origin.rfind('/')
|
||||||
// offset_2 = base_origin.rfind(':')
|
// offset_2 = base_origin.rfind(':')
|
||||||
@ -137,14 +136,14 @@ public class Manifest {
|
|||||||
}
|
}
|
||||||
fetch = removeEndSlash(fetch);
|
fetch = removeEndSlash(fetch);
|
||||||
} else {
|
} else {
|
||||||
Log.error("Parsing the manifest : Unknow '" + child.getName() + "' attibute : '" + attr.getName() + "', availlable:[name,fetch]")
|
Log.error("Parsing the manifest : Unknow '" + child.getValue() + "' attibute : '" + attr.getName() + "', availlable:[name,fetch]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log.debug(" find '" + child.getName() + "' : name='" + name + "' fetch='" + fetch + "'");
|
Log.debug(" find '" + child.getValue() + "' : name='" + name + "' fetch='" + fetch + "'");
|
||||||
// parse the sub global mirror list
|
// parse the sub global mirror list
|
||||||
List<MirrorConfig> mirror_list = new ArrayList<>();
|
List<MirrorConfig> mirror_list = new ArrayList<>();
|
||||||
for (XmlNode child_2 : child.toElement().getNodes()) {
|
for (XmlNode child_2 : child.toElement().getNodes()) {
|
||||||
if (child_2.getValue().equals("mirror")):
|
if (child_2.getValue().equals("mirror")) {
|
||||||
// find a new mirror
|
// find a new mirror
|
||||||
String mirror_name = "";
|
String mirror_name = "";
|
||||||
String mirror_fetch = "";
|
String mirror_fetch = "";
|
||||||
@ -167,147 +166,156 @@ public class Manifest {
|
|||||||
}
|
}
|
||||||
mirror_list.add(new MirrorConfig(mirror_name, mirror_fetch));
|
mirror_list.add(new MirrorConfig(mirror_name, mirror_fetch));
|
||||||
} else {
|
} else {
|
||||||
Log.critical("Parsing the manifest : Unknow '" + child_2.getName() + "', availlable:[mirror]");
|
Log.critical("Parsing the manifest : Unknow '" + child_2.getValue() + "', availlable:[mirror]");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this.remotes.add(new RemoteConfig(name, fetch, mirror_list));
|
this.remotes.add(new RemoteConfig(name, fetch, mirror_list));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (child.getName().equals("include") {
|
if (child.getValue().equals("include")) {
|
||||||
String name = "";
|
String name = "";
|
||||||
for (XmlAttribute attr : child.toElement.getAttributes()) {
|
for (XmlAttribute attr : child.toElement().getAttributes()) {
|
||||||
if (attr.getName().equals("name")) {
|
if (attr.getName().equals("name")) {
|
||||||
name = attr.getValue();
|
name = attr.getValue();
|
||||||
} else {
|
} else {
|
||||||
Log.error("Parsing the manifest : Unknow '" + child.getName() + "' attibute : '" + attr + "', availlable:[name]")
|
Log.error("Parsing the manifest : Unknow '" + child.getValue() + "' attibute : '" + attr + "', availlable:[name]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log.debug(" find '" + child.getName() + "' : name='" + name + "'");
|
Log.debug(" find '" + child.getValue() + "' : name='" + name + "'");
|
||||||
// check if the file exist ...
|
// check if the file exist ...
|
||||||
Path new_name_xml = this.manifest_xml.resolve(name);
|
Path new_name_xml = this.manifestXml.resolve(name);
|
||||||
if (!Files.exists(new_name_xml)) {
|
if (!Files.exists(new_name_xml)) {
|
||||||
Log.critical("The file does not exist: " + new_name_xml)
|
Log.critical("The file does not exist: " + new_name_xml);
|
||||||
}
|
}
|
||||||
this.includes.add(new IncludeConfig(name, new_name_xml, null));
|
this.includes.add(new IncludeConfig(name, new_name_xml, null));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (child.getName().equals("default") {
|
if (child.getValue().equals("default")) {
|
||||||
String remote = "origin";
|
String remote = "origin";
|
||||||
String revision = "master";
|
String revision = "master";
|
||||||
boolean sync = false;
|
boolean sync = false;
|
||||||
for (XmlAttribute attr : child.toElement.getAttributes()) {
|
for (XmlAttribute attr : child.toElement().getAttributes()) {
|
||||||
if (attr.getName().equals("remote")) {
|
if (attr.getName().equals("remote")) {
|
||||||
remote = attr.getValue();
|
remote = attr.getValue();
|
||||||
} else if (attr.getName().equals("revision")) {
|
} else if (attr.getName().equals("revision")) {
|
||||||
revision = attr.getValue();
|
revision = attr.getValue();
|
||||||
} else if (attr.getName().equals("sync-s")) { // synchronize submodule ... automaticaly
|
} else if (attr.getName().equals("sync-s")) { // synchronize submodule ... automaticaly
|
||||||
sync = attr.getValue();
|
String syncBase = attr.getValue();
|
||||||
if (sync.lower().equals("true")
|
if (syncBase.equalsIgnoreCase("true")
|
||||||
|| sync.equals("1")
|
|| syncBase.equals("1")
|
||||||
|| sync.lower().equals("yes")) {
|
|| syncBase.toLowerCase().equals("yes")) {
|
||||||
sync = true;
|
sync = true;
|
||||||
} else if (sync.lower().equals("false")
|
} else if (syncBase.equalsIgnoreCase("false")
|
||||||
|| sync.equals("0")
|
|| syncBase.equals("0")
|
||||||
|| sync.lower().equals("no")) {
|
|| syncBase.equalsIgnoreCase("no")) {
|
||||||
sync = false
|
sync = false;
|
||||||
} else {
|
} else {
|
||||||
Log.critical("Parsing the manifest : Unknow '" + child.getName() + "' attibute : '" + attr + "', value:'" + sync + "' availlable:[true,1,yes,false,0,no]");
|
Log.critical("Parsing the manifest : Unknow '" + child.getValue() + "' attibute : '" + attr + "', value:'" + sync + "' availlable:[true,1,yes,false,0,no]");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.error("Parsing the manifest : Unknow '" + child.getName() + "' attibute : '" + attr + "', availlable:[remote,revision,sync-s]");
|
Log.error("Parsing the manifest : Unknow '" + child.getValue() + "' attibute : '" + attr + "', availlable:[remote,revision,sync-s]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.defaultWhat != null) {
|
if (this.defaultWhat != null) {
|
||||||
Log.error("Parsing the manifest : Node '" + child.getName() + "' already set")
|
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.getName() + "' : remote='" + remote + "' revision='" + revision + "' sync=" + sync);
|
Log.debug(" find '" + child.getValue() + "' : remote='" + remote + "' revision='" + revision + "' sync=" + sync);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if child.tag == "project":
|
if (child.getValue().equals("project")) {
|
||||||
name = ""
|
String name = "";
|
||||||
path = ""
|
String path = "";
|
||||||
tag_sha1 = None
|
String tag_sha1 = null;
|
||||||
for attr in child.attrib:
|
for (XmlAttribute attr : child.toElement().getAttributes()) {
|
||||||
if attr == "name":
|
if (attr.getName().equals("name")) {
|
||||||
name = child.attrib[attr]
|
name = attr.getValue();
|
||||||
} else if attr == "path":
|
} else if (attr.getName().equals("path")) {
|
||||||
path = child.attrib[attr]
|
path = attr.getValue();
|
||||||
} else if attr == "tag":
|
} else if (attr.getName().equals("tag")) {
|
||||||
tag_sha1 = child.attrib[attr]
|
tag_sha1 = attr.getValue();
|
||||||
else:
|
} else {
|
||||||
Log.error("(l:" + str(child.sourceline) + ") Parsing the manifest: Unknow '" + child.tag + "' attibute : '" + attr + "', availlable:[name,tag,sync-s]")
|
Log.error("Parsing the manifest: Unknow '" + child.getValue() + "' attibute : '" + attr + "', availlable:[name,tag,sync-s]");
|
||||||
if name == "":
|
}
|
||||||
Log.error("(l:" + str(child.sourceline) + ") Parsing the manifest: '" + child.tag + "' missing attribute: 'name' ==> specify the git to clone ...")
|
}
|
||||||
this.projects.append({
|
if (name.isEmpty()) {
|
||||||
"name":name,
|
Log.error("Parsing the manifest: '" + child.getValue() + "' missing attribute: 'name' ==> specify the git to clone ...");
|
||||||
"path":path,
|
}
|
||||||
"tag":tag_sha1,
|
this.projects.add(new ProjectConfig(name, path, tag_sha1));
|
||||||
})
|
Log.debug(" find '" + child.getValue() + "' : name='" + name + "' path='" + path + "' tag='" + tag_sha1 + "'");
|
||||||
Log.debug("(l:" + str(child.sourceline) + ") find '" + child.tag + "' : name='" + name + "' path='" + path + "' tag='" + str(tag_sha1) + "'");
|
continue;
|
||||||
continue
|
}
|
||||||
if child.tag == "option":
|
if (child.getValue().equals("option")) {
|
||||||
// not managed ==> future use
|
// not managed ==> future use
|
||||||
type_option = ""
|
String type_option = "";
|
||||||
value_option = ""
|
String value_option = "";
|
||||||
for attr in child.attrib:
|
for (XmlAttribute attr : child.toElement().getAttributes()) {
|
||||||
if attr == "type":
|
if (attr.getName().equals("type")) {
|
||||||
type_option = child.attrib[attr]
|
type_option = attr.getValue();
|
||||||
} else if attr == "value":
|
} else if (attr.getName().equals("value")) {
|
||||||
value_option = child.attrib[attr]
|
value_option = attr.getValue();
|
||||||
else:
|
} else {
|
||||||
Log.error("(l:" + str(child.sourceline) + ") Parsing the manifest: Unknow '" + child.tag + "' attibute : '" + attr + "', availlable:[type,value]")
|
Log.error("Parsing the manifest: Unknow '" + child.getValue() + "' attibute : '" + attr + "', availlable:[type,value]");
|
||||||
if type_option == "deliver_master":
|
}
|
||||||
this.deliver_master = value_option
|
}
|
||||||
} else if type_option == "deliver_develop":
|
if (type_option.equals("deliver_master")) {
|
||||||
this.deliver_develop = value_option
|
this.deliver_master = value_option;
|
||||||
} else if type_option == "deliver_mode":
|
} else if (type_option.equals("deliver_develop")) {
|
||||||
this.deliver_mode = value_option
|
this.deliver_develop = value_option;
|
||||||
if this.deliver_mode not in ["merge","fast_forward"]:
|
} else if (type_option.equals("deliver_mode")) {
|
||||||
Log.error("(l:" + str(child.sourceline) + ") Parsing the manifest: option 'deliver_mode' value availlable: [merge,fast_forward]")
|
this.deliver_mode = value_option;
|
||||||
else:
|
if (this.deliver_mode.equals("merge") || this.deliver_mode.equals("fast_forward")) {
|
||||||
Log.error("(l:" + str(child.sourceline) + ") Parsing the manifest: Unknow 'type' value availlable: [deliver_master,deliver_develop,deliver_mode]")
|
Log.critical("Parsing the manifest: option 'deliver_mode' value availlable: [merge,fast_forward]");
|
||||||
continue
|
}
|
||||||
if child.tag == "link":
|
} else {
|
||||||
|
Log.critical("Parsing the manifest: Unknow 'type' value availlable: [deliver_master,deliver_develop,deliver_mode]");
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (child.getValue().equals("link")) {
|
||||||
// not managed ==> future use
|
// not managed ==> future use
|
||||||
source = ""
|
String source = "";
|
||||||
destination = ""
|
String destination = "";
|
||||||
for attr in child.attrib:
|
for (XmlAttribute attr : child.toElement().getAttributes()) {
|
||||||
if attr == "source":
|
if (attr.getName().equals("source")) {
|
||||||
source = child.attrib[attr]
|
source = attr.getValue();
|
||||||
} else if attr == "destination":
|
} else if (attr.getName().equals("destination")) {
|
||||||
destination = child.attrib[attr]
|
destination = attr.getValue();
|
||||||
else:
|
} else {
|
||||||
Log.error("(l:" + str(child.sourceline) + ") Parsing the manifest: Unknow '" + child.tag + "' attibute : '" + attr + "', availlable:[source,destination]")
|
Log.critical("Parsing the manifest: Unknow '" + child.getValue() + "' attibute : '" + attr + "', availlable:[source,destination]");
|
||||||
if source == "":
|
}
|
||||||
Log.error("(l:" + str(child.sourceline) + ") Parsing the manifest: '" + child.tag + "' missing attribute: 'source' ==> specify the git to clone ...")
|
}
|
||||||
if destination == "":
|
if (source.isEmpty()) {
|
||||||
Log.error("(l:" + str(child.sourceline) + ") Parsing the manifest: '" + child.tag + "' missing attribute: 'destination' ==> specify the git to clone ...")
|
Log.error("Parsing the manifest: '" + child.getValue() + "' missing attribute: 'source' ==> specify the git to clone ...");
|
||||||
this.links.append({
|
}
|
||||||
"source":source,
|
if (destination.isEmpty()) {
|
||||||
"destination":destination,
|
Log.error("Parsing the manifest: '" + child.getValue() + "' missing attribute: 'destination' ==> specify the git to clone ...");
|
||||||
})
|
}
|
||||||
Log.debug("Add link: '" + str(destination) + "' ==> '" + str(source) + "'")
|
this.links.add(new Link(source, destination));
|
||||||
continue
|
Log.debug("Add link: '" + destination + "' ==> '" + source + "'");
|
||||||
Log.info("(l:" + str(child.sourceline) + ") '" + str(child.tag) + "' values=" + str(child.attrib));
|
continue;
|
||||||
Log.error("(l:" + str(child.sourceline) + ") Parsing error Unknow NODE : '" + str(child.tag) + "' availlable:[remote,include,default,project,option,link]")
|
}
|
||||||
|
Log.info(" '" + child.getValue() + "' values=" + child.toElement().getAttributes());
|
||||||
|
Log.error("Parsing error Unknow NODE : '" + child.getValue() + "' availlable:[remote,include,default,project,option,link]");
|
||||||
|
}
|
||||||
// now we parse all sub repo:
|
// now we parse all sub repo:
|
||||||
for elem in this.includes:
|
for (IncludeConfig elem : this.includes) {
|
||||||
elem["manifest"] = Manifest(elem["path"])
|
elem.setManifest(new Manifest(elem.getPath()));
|
||||||
|
}
|
||||||
|
}
|
||||||
// inside data child.text
|
|
||||||
|
|
||||||
|
|
||||||
// public void _create_path_with_elem(this, element):
|
public String createPathWithElem(final ProjectConfig element) {
|
||||||
// path = element["path"]
|
String path = element.getPath();
|
||||||
// if path == "":
|
if (path.isEmpty()) {
|
||||||
// path = element["name"]
|
path = element.getName();
|
||||||
// if len(path) >= 4 \
|
if (path.endsWith(".git")) {
|
||||||
// and path[-4:] == ".git":
|
path = path.substring(0, path.length()-4);
|
||||||
// path = path[:-4]
|
}
|
||||||
// return path
|
}
|
||||||
//
|
return path;
|
||||||
// public void checkDoublePath(this, list_path = [], space=""):
|
}
|
||||||
|
// public void checkDoublePath(this, list_path = [], space="") {
|
||||||
// Log.debug(space + "check path : '" + this.manifest_xml + "'")
|
// Log.debug(space + "check path : '" + this.manifest_xml + "'")
|
||||||
// for elem in this.projects:
|
// for elem in this.projects:
|
||||||
// path = this._create_path_with_elem(elem)
|
// path = this._create_path_with_elem(elem)
|
||||||
@ -317,107 +325,126 @@ public class Manifest {
|
|||||||
// list_path.append(path)
|
// list_path.append(path)
|
||||||
// for elem in this.includes:
|
// for elem in this.includes:
|
||||||
// elem["manifest"]._check_double_path(list_path, space + " ")
|
// elem["manifest"]._check_double_path(list_path, space + " ")
|
||||||
//
|
// }
|
||||||
// public void get_all_configs(this, default=None, upper_remotes=[]):
|
|
||||||
// out = []
|
public List<ProjectConfig> get_all_configs() {
|
||||||
// if default == None:
|
return get_all_configs(null, new ArrayList<>());
|
||||||
// if this.default != None:
|
}
|
||||||
// default = copy.deepcopy(this.default)
|
|
||||||
// else:
|
public List<ProjectConfig> get_all_configs(RepositoryConfig defaultPlouf, final List<RemoteConfig> upper_remotes) {
|
||||||
// default = copy.deepcopy(this.default_base)
|
List<ProjectConfig> out = new ArrayList<>();
|
||||||
// // Log.error(" this.default=" + str(this.default))
|
if (defaultPlouf == null) {
|
||||||
// // add all local project
|
if (this.defaultWhat != null) {
|
||||||
// for elem in this.projects:
|
defaultPlouf = this.defaultWhat.clone();
|
||||||
// Log.verbose("parse element " + str(elem))
|
} else {
|
||||||
// if Env.need_process_with_filter(elem["name"]) == false:
|
defaultPlouf = this.default_base.clone();
|
||||||
// Log.info("Filter repository: " + str(elem["name"]))
|
}
|
||||||
// continue
|
}
|
||||||
// conf = repo_config.RepoConfig()
|
// Log.error(" this.default=" + str(this.default))
|
||||||
// conf.name = elem["name"]
|
// add all local project
|
||||||
// conf.tag = elem["tag"]
|
for (ProjectConfig elem : this.projects) {
|
||||||
// conf.path = this._create_path_with_elem(elem)
|
Log.verbose("parse element " + elem);
|
||||||
//
|
if (!Env.need_process_with_filter(elem.getName())) {
|
||||||
// // add default remote for the project (search in herited element)
|
Log.info("Filter repository: " + elem.getName());
|
||||||
// for remote in this.remotes:
|
continue;
|
||||||
// Log.verbose(" Local Remote: " + str(remote))
|
}
|
||||||
// if remote["name"] == default["remote"]:
|
ProjectConfig conf = new ProjectConfig(elem.getName(), createPathWithElem(elem), elem.getTag());
|
||||||
// conf.remotes.append(remote)
|
|
||||||
// if len(conf.remotes) == 0:
|
// add default remote for the project (search in herited element)
|
||||||
// for remote in upper_remotes:
|
for (RemoteConfig remote : this.remotes) {
|
||||||
// Log.verbose(" upper Remote: " + str(remote))
|
Log.verbose(" Local Remote: " + remote);
|
||||||
// if remote["name"] == default["remote"]:
|
if (remote.getName().equals(defaultPlouf.getRemote())) {
|
||||||
// conf.remotes.append(remote)
|
conf.getRemotes().add(remote);
|
||||||
// if len(conf.remotes) == 0:
|
}
|
||||||
// Log.error(" No remote detected: " + str(len(conf.remotes)) + " for " + conf.name + " with default remote name : " + default["remote"] + " this remote: " + str(this.remotes))
|
}
|
||||||
//
|
if (conf.getRemotes().size() == 0) {
|
||||||
// // select default remote:
|
for (RemoteConfig remote : upper_remotes) {
|
||||||
// conf.select_remote = None
|
Log.verbose(" upper Remote: " + remote);
|
||||||
// Log.debug(" remotes count: " + str(len(conf.remotes)))
|
if (remote.getName().equals(defaultPlouf.getRemote())) {
|
||||||
// for remote in conf.remotes:
|
conf.getRemotes().add(remote);
|
||||||
// Log.debug(" remote=" + str(remote))
|
}
|
||||||
// Log.debug(" Ckeck remote : " + remote["name"] + " == " + default["remote"])
|
}
|
||||||
// Log.verbose(" remote=" + str(remote))
|
}
|
||||||
// Log.verbose(" default=" + str(default))
|
if (conf.getRemotes().size() == 0) {
|
||||||
// if remote["name"] == default["remote"]:
|
Log.error(" No remote detected: " + conf.getRemotes().size() + " for " + conf.getName() + " with default remote name : " + defaultPlouf.getRemote() + " this remote: " + this.remotes);
|
||||||
// conf.select_remote = copy.deepcopy(remote)
|
}
|
||||||
// Log.debug(" copy select=" + str(conf.select_remote))
|
// select default remote:
|
||||||
//
|
Log.debug(" remotes count: " + conf.getRemotes().size());
|
||||||
// // copy the submodule synchronisation
|
for (RemoteConfig remote : conf.getRemotes()) {
|
||||||
// conf.select_remote["sync"] = default["sync"]
|
Log.debug(" remote=" + remote);
|
||||||
// break
|
Log.debug(" Ckeck remote : " + remote.getName() + ".equals(" + defaultPlouf.getRemote());
|
||||||
// if conf.select_remote == None:
|
Log.verbose(" remote=" + remote);
|
||||||
// Log.error("missing remote for project: " + str(conf.name))
|
Log.verbose(" default=" + defaultPlouf);
|
||||||
//
|
if (remote.getName().equals(defaultPlouf.getRemote())) {
|
||||||
// conf.branch = default["revision"]
|
conf.setSelectRemotes(remote.clone());
|
||||||
// out.append(conf)
|
Log.debug(" copy select=" + conf.getSelectRemotes());
|
||||||
// // create a temporary variable to transmit the remote to includes
|
|
||||||
// upper_remotes_forward = copy.deepcopy(upper_remotes)
|
// copy the submodule synchronisation
|
||||||
// for remote in this.remotes:
|
// TODO: ????? conf.getSelectRemotes().setSync(defaultPlouf.isSync());
|
||||||
// upper_remotes_forward.append(remote)
|
break;
|
||||||
// // add all include project
|
}
|
||||||
// for elem in this.includes:
|
}
|
||||||
// list_project = elem["manifest"].get_all_configs(default, upper_remotes_forward)
|
if (conf.getSelectRemotes() == null) {
|
||||||
// for elem_proj in list_project:
|
Log.error("missing remote for project: " + conf.getName());
|
||||||
// out.append(elem_proj)
|
}
|
||||||
//
|
conf.setBranch(defaultPlouf.getRevision());
|
||||||
// //# -------------------------------------------------------------
|
out.add(conf);
|
||||||
// //# -- add Volatile ...
|
}
|
||||||
// //# -------------------------------------------------------------
|
// create a temporary variable to transmit the remote to includes
|
||||||
// Log.verbose("include volatile config")
|
List<RemoteConfig> upper_remotes_forward = new ArrayList<>(upper_remotes);
|
||||||
// // TODO: maybe find a better way to do this...
|
for (RemoteConfig remote : this.remotes) {
|
||||||
// conf_global = config.get_unique_config()
|
upper_remotes_forward.add(remote);
|
||||||
// for elem in conf_global.get_volatile():
|
}
|
||||||
// conf = repo_config.RepoConfig()
|
// add all include project
|
||||||
// base_volatile, repo_volatile = repo_config.split_repo(elem["git_address"])
|
for (IncludeConfig elem : this.includes) {
|
||||||
// conf.name = repo_volatile
|
List<ProjectConfig> list_project = elem.getManifest().get_all_configs(defaultPlouf, upper_remotes_forward);
|
||||||
// conf.path = elem["path"]
|
for (ProjectConfig elem_proj : list_project) {
|
||||||
// conf.branch = "master"
|
out.add(elem_proj);
|
||||||
// conf.volatile = true
|
}
|
||||||
// conf.remotes = [
|
}
|
||||||
// {
|
|
||||||
// 'name': 'origin',
|
// DEPRECIATE volatile for a while?.????
|
||||||
// 'fetch': base_volatile,
|
//# -------------------------------------------------------------
|
||||||
// 'mirror': []
|
//# -- add Volatile ...
|
||||||
// }
|
//# -------------------------------------------------------------
|
||||||
// ]
|
Log.verbose("include volatile config");
|
||||||
// conf.select_remote = {
|
// TODO: maybe find a better way to do this...
|
||||||
// 'name': 'origin',
|
/*
|
||||||
// 'fetch': base_volatile,
|
conf_global = config.get_unique_config()
|
||||||
// 'sync': false,
|
for elem in conf_global.get_volatile():
|
||||||
// 'mirror': []
|
conf = repo_config.RepoConfig()
|
||||||
// }
|
base_volatile, repo_volatile = repo_config.split_repo(elem["git_address"])
|
||||||
// out.append(conf)
|
conf.name = repo_volatile
|
||||||
// //# -------------------------------------------------------------
|
conf.path = elem["path"]
|
||||||
// if false:
|
conf.branch = "master"
|
||||||
// Log.info("list of all repo:")
|
conf.volatile = true
|
||||||
// for elem in out:
|
conf.remotes = [
|
||||||
// Log.info(" '" + elem.name + "'")
|
{
|
||||||
// Log.info(" path: " + elem.path)
|
'name': 'origin',
|
||||||
// Log.info(" remotes: " + str(elem.remotes))
|
'fetch': base_volatile,
|
||||||
// Log.info(" select_remote: " + str(elem.select_remote))
|
'mirror': []
|
||||||
// Log.info(" branch: " + elem.branch)
|
}
|
||||||
// return out
|
]
|
||||||
//
|
conf.select_remote = {
|
||||||
|
'name': 'origin',
|
||||||
|
'fetch': base_volatile,
|
||||||
|
'sync': false,
|
||||||
|
'mirror': []
|
||||||
|
}
|
||||||
|
out.append(conf)
|
||||||
|
//# -------------------------------------------------------------
|
||||||
|
if false:
|
||||||
|
Log.info("list of all repo:")
|
||||||
|
for elem in out:
|
||||||
|
Log.info(" '" + elem.name + "'")
|
||||||
|
Log.info(" path: " + elem.path)
|
||||||
|
Log.info(" remotes: " + str(elem.remotes))
|
||||||
|
Log.info(" select_remote: " + str(elem.select_remote))
|
||||||
|
Log.info(" branch: " + elem.branch)
|
||||||
|
*/
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
//public void tag_manifest(manifest_xml_filename, all_tags):
|
//public void tag_manifest(manifest_xml_filename, all_tags):
|
||||||
// tree = etree.parse(manifest_xml_filename)
|
// tree = etree.parse(manifest_xml_filename)
|
||||||
@ -431,12 +458,12 @@ public class Manifest {
|
|||||||
// if type(child) == etree._Comment:
|
// if type(child) == etree._Comment:
|
||||||
// Log.verbose("(l:" + str(child.sourceline) + ") comment='" + str(child.text) + "'");
|
// Log.verbose("(l:" + str(child.sourceline) + ") comment='" + str(child.text) + "'");
|
||||||
// continue
|
// continue
|
||||||
// if child.tag == "remote":
|
// if child.tag.equals("remote":
|
||||||
// continue
|
// continue
|
||||||
// if child.tag == "include":
|
// if child.tag.equals("include":
|
||||||
// name = ""
|
// name = ""
|
||||||
// for attr in child.attrib:
|
// for attr in child.attrib:
|
||||||
// if attr == "name":
|
// if attr.equals("name":
|
||||||
// name = child.attrib[attr]
|
// name = child.attrib[attr]
|
||||||
// else:
|
// else:
|
||||||
// Log.error("(l:" + str(child.sourceline) + ") Parsing the manifest : Unknow '" + child.tag + "' attibute : '" + attr + "', availlable:[name]")
|
// Log.error("(l:" + str(child.sourceline) + ") Parsing the manifest : Unknow '" + child.tag + "' attibute : '" + attr + "', availlable:[name]")
|
||||||
@ -451,31 +478,31 @@ public class Manifest {
|
|||||||
// "manifest":None
|
// "manifest":None
|
||||||
// })
|
// })
|
||||||
// continue
|
// continue
|
||||||
// if child.tag == "default":
|
// if child.tag.equals("default":
|
||||||
// continue
|
// continue
|
||||||
// if child.tag == "project":
|
// if child.tag.equals("project":
|
||||||
// name = ""
|
// name = ""
|
||||||
// path = ""
|
// path = ""
|
||||||
// tag_sha1 = None
|
// tag_sha1 = None
|
||||||
// for attr in child.attrib:
|
// for attr in child.attrib:
|
||||||
// if attr == "name":
|
// if attr.equals("name":
|
||||||
// name = child.attrib[attr]
|
// name = child.attrib[attr]
|
||||||
// } else if attr == "path":
|
// } else if attr.equals("path":
|
||||||
// path = child.attrib[attr]
|
// path = child.attrib[attr]
|
||||||
// } else if attr == "tag":
|
// } else if attr.equals("tag":
|
||||||
// tag_sha1 = child.attrib[attr]
|
// tag_sha1 = child.attrib[attr]
|
||||||
// else:
|
// else:
|
||||||
// Log.error("(l:" + str(child.sourceline) + ") Parsing the manifest: Unknow '" + child.tag + "' attibute : '" + attr + "', availlable:[name,tag,sync-s]")
|
// 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 ...")
|
// 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:
|
// for elem_tag in all_tags:
|
||||||
// if elem_tag["name"] == name:
|
// if elem_tag["name"] == name:
|
||||||
// child.set("tag", elem_tag["tag"])
|
// child.set("tag", elem_tag["tag"])
|
||||||
// continue
|
// continue
|
||||||
// if child.tag == "option":
|
// if child.tag.equals("option":
|
||||||
// // not managed ==> future use
|
// // not managed ==> future use
|
||||||
// continue
|
// continue
|
||||||
// if child.tag == "link":
|
// if child.tag.equals("link":
|
||||||
// continue
|
// continue
|
||||||
// Log.info("(l:" + str(child.sourceline) + ") '" + str(child.tag) + "' values=" + str(child.attrib));
|
// 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]")
|
// Log.error("(l:" + str(child.sourceline) + ") Parsing error Unknow NODE : '" + str(child.tag) + "' availlable:[remote,include,default,project,option,link]")
|
||||||
@ -498,12 +525,12 @@ public class Manifest {
|
|||||||
// if type(child) == etree._Comment:
|
// if type(child) == etree._Comment:
|
||||||
// Log.verbose("(l:" + str(child.sourceline) + ") comment='" + str(child.text) + "'");
|
// Log.verbose("(l:" + str(child.sourceline) + ") comment='" + str(child.text) + "'");
|
||||||
// continue
|
// continue
|
||||||
// if child.tag == "remote":
|
// if child.tag.equals("remote":
|
||||||
// continue
|
// continue
|
||||||
// if child.tag == "include":
|
// if child.tag.equals("include":
|
||||||
// name = ""
|
// name = ""
|
||||||
// for attr in child.attrib:
|
// for attr in child.attrib:
|
||||||
// if attr == "name":
|
// if attr.equals("name":
|
||||||
// name = child.attrib[attr]
|
// name = child.attrib[attr]
|
||||||
// else:
|
// else:
|
||||||
// Log.error("(l:" + str(child.sourceline) + ") Parsing the manifest : Unknow '" + child.tag + "' attibute : '" + attr + "', availlable:[name]")
|
// Log.error("(l:" + str(child.sourceline) + ") Parsing the manifest : Unknow '" + child.tag + "' attibute : '" + attr + "', availlable:[name]")
|
||||||
@ -518,14 +545,14 @@ public class Manifest {
|
|||||||
// "manifest":None
|
// "manifest":None
|
||||||
// })
|
// })
|
||||||
// continue
|
// continue
|
||||||
// if child.tag == "default":
|
// if child.tag.equals("default":
|
||||||
// continue
|
// continue
|
||||||
// if child.tag == "project":
|
// if child.tag.equals("project":
|
||||||
// child.attrib.pop("tag", None)
|
// child.attrib.pop("tag", None)
|
||||||
// continue
|
// continue
|
||||||
// if child.tag == "option":
|
// if child.tag.equals("option":
|
||||||
// continue
|
// continue
|
||||||
// if child.tag == "link":
|
// if child.tag.equals("link":
|
||||||
// continue
|
// continue
|
||||||
// Log.info("(l:" + str(child.sourceline) + ") '" + str(child.tag) + "' values=" + str(child.attrib));
|
// 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]")
|
// Log.error("(l:" + str(child.sourceline) + ") Parsing error Unknow NODE : '" + str(child.tag) + "' availlable:[remote,include,default,project,option,link]")
|
||||||
@ -533,4 +560,6 @@ public class Manifest {
|
|||||||
// // now we parse all sub repo:
|
// // now we parse all sub repo:
|
||||||
// for elem in includes:
|
// for elem in includes:
|
||||||
// tag_clear(elem["path"])
|
// tag_clear(elem["path"])
|
||||||
//
|
//
|
||||||
|
|
||||||
|
}
|
||||||
|
14
src/org/atriasoft/island/Tools.java
Normal file
14
src/org/atriasoft/island/Tools.java
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
@ -8,12 +8,14 @@ import org.atriasoft.death.Arguments;
|
|||||||
import org.atriasoft.island.Config;
|
import org.atriasoft.island.Config;
|
||||||
import org.atriasoft.island.Env;
|
import org.atriasoft.island.Env;
|
||||||
import org.atriasoft.island.Manifest;
|
import org.atriasoft.island.Manifest;
|
||||||
|
import org.atriasoft.island.Tools;
|
||||||
import org.atriasoft.island.internal.Log;
|
import org.atriasoft.island.internal.Log;
|
||||||
import org.atriasoft.island.model.ActionException;
|
import org.atriasoft.island.model.ActionException;
|
||||||
import org.atriasoft.island.model.ActionInterface;
|
import org.atriasoft.island.model.ActionInterface;
|
||||||
import org.atriasoft.island.model.ConfigManifest;
|
import org.atriasoft.island.model.ConfigManifest;
|
||||||
|
import org.atriasoft.island.model.ProjectConfig;
|
||||||
|
|
||||||
public class islandActionCheckout implements ActionInterface {
|
public class IslandActionCheckout extends ActionInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String help() {
|
public String help() {
|
||||||
@ -21,7 +23,7 @@ public class islandActionCheckout implements ActionInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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.add("r", "remote", null, "Name of the remote server", true);
|
||||||
myArgs.addArg("branch", false, "Branch to checkout (if '__TAG__' ==> checkout specific repository tags)");
|
myArgs.addArg("branch", false, "Branch to checkout (if '__TAG__' ==> checkout specific repository tags)");
|
||||||
}
|
}
|
||||||
@ -33,18 +35,18 @@ public class islandActionCheckout implements ActionInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(List<ArgElement> _arguments) throws ActionException {
|
public void execute(final List<ArgElement> _arguments) throws ActionException, Exception {
|
||||||
|
|
||||||
String argument_remote_name = "";
|
String argument_remote_name = "";
|
||||||
String branch_to_checkout = "";
|
String branch_to_checkout = "";
|
||||||
for (ArgElement elem : _arguments) {
|
for (ArgElement elem : _arguments) {
|
||||||
if (elem.getOptionName().equals("remote")) {
|
if (elem.getOptionName().equals("remote")) {
|
||||||
Log.info("find remote name: '" + elem.getArg() + "'");
|
Log.info("find remote name{ '" + elem.getArg() + "'");
|
||||||
argument_remote_name = elem.getArg();
|
argument_remote_name = elem.getArg();
|
||||||
} else if (elem.getOptionName().equals("branch")) {
|
} else if (elem.getOptionName().equals("branch")) {
|
||||||
branch_to_checkout = elem.getArg()
|
branch_to_checkout = elem.getArg();
|
||||||
} else {
|
} else {
|
||||||
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'");
|
Log.error("Wrong argument{ '" + elem.getOptionName() + "' '" + elem.getArg() + "'");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -53,27 +55,30 @@ public class islandActionCheckout implements ActionInterface {
|
|||||||
|
|
||||||
ConfigManifest configuration = Config.getUniqueConfig();
|
ConfigManifest configuration = Config.getUniqueConfig();
|
||||||
|
|
||||||
// update the local configuration file:
|
// update the local configuration file{
|
||||||
configuration.setBranch(branch_to_checkout);
|
configuration.setBranch(branch_to_checkout);
|
||||||
configuration.store();
|
configuration.store();
|
||||||
|
|
||||||
Path file_source_manifest = Env.get_island_path_manifest().resolve(configuration.getManifestName());
|
Path file_source_manifest = Env.get_island_path_manifest().resolve(configuration.getManifestName());
|
||||||
if (!Files.exists(file_source_manifest)) {
|
if (!Files.exists(file_source_manifest)) {
|
||||||
Log.critical("Missing manifest file : '" + file_source_manifest.toAbsolutePath() + "'");
|
Log.critical("Missing manifest file { '" + file_source_manifest.toAbsolutePath() + "'");
|
||||||
}
|
}
|
||||||
Manifest mani = new Manifest(file_source_manifest);
|
Manifest mani = new Manifest(file_source_manifest);
|
||||||
|
|
||||||
all_project = mani.getAllConfigs();
|
List<ProjectConfig> all_project = mani.get_all_configs();
|
||||||
Log.info("checkout of: " + str(len(all_project)) + " projects")
|
Log.info("checkout of{ " + all_project.size() + " projects");
|
||||||
id_element = 0
|
int id_element = 0;
|
||||||
have_error = false
|
boolean have_error = false;
|
||||||
for elem in all_project:
|
for (ProjectConfig elem : all_project) {
|
||||||
id_element += 1
|
id_element += 1;
|
||||||
base_display = tools.get_list_base_display(id_element, len(all_project), elem)
|
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) == false:
|
if (!Status.checkout_elem(elem, argument_remote_name, branch_to_checkout, base_display)) {
|
||||||
have_error = true
|
have_error = true;
|
||||||
if have_error == true:
|
}
|
||||||
return env.ret_action_fail
|
}
|
||||||
|
if (have_error == true) {
|
||||||
|
//return Env.ret_action_fail;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
92
src/org/atriasoft/island/actions/IslandActionStatus.java
Normal file
92
src/org/atriasoft/island/actions/IslandActionStatus.java
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
package org.atriasoft.island.actions;
|
||||||
|
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.atriasoft.death.ArgElement;
|
||||||
|
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;
|
||||||
|
|
||||||
|
import org.eclipse.jgit.api.Git;
|
||||||
|
|
||||||
|
public class IslandActionStatus extends ActionInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String help() {
|
||||||
|
return "Get the status of all the repositories";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void add_specific_arguments(final Arguments myArgs, final String section) {
|
||||||
|
myArgs.add("r", "remote", null, "Name of the remote server", true);
|
||||||
|
myArgs.add("t", "tags", null, "Display if the commit is on a tag (and display it)", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(final List<ArgElement> _arguments) throws ActionException, Exception {
|
||||||
|
String argument_remote_name = "";
|
||||||
|
boolean argument_display_tag = false;
|
||||||
|
for (ArgElement elem : _arguments) {
|
||||||
|
if (elem.getOptionName().equals("remote")) {
|
||||||
|
Log.info("find remote name: '" + elem.getArg() + "'");
|
||||||
|
argument_remote_name = elem.getArg();
|
||||||
|
} else if (elem.getOptionName().equals("tags")) {
|
||||||
|
argument_display_tag = true;
|
||||||
|
} else {
|
||||||
|
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// check system is OK
|
||||||
|
Manifest.checkIsInit();
|
||||||
|
ConfigManifest configuration = Config.getUniqueConfig();
|
||||||
|
|
||||||
|
Path file_source_manifest = Env.get_island_path_manifest().resolve(configuration.getManifestName());
|
||||||
|
if (!Files.exists(file_source_manifest)) {
|
||||||
|
Log.critical("Missing manifest file : '" + file_source_manifest + "'");
|
||||||
|
}
|
||||||
|
Manifest mani = new Manifest(file_source_manifest);
|
||||||
|
Git git = Git.open(Env.get_island_path_manifest().toFile());
|
||||||
|
boolean is_modify_manifest = git.status().call().hasUncommittedChanges();
|
||||||
|
if (is_modify_manifest) {
|
||||||
|
Log.info("!!!!!!!!!!!! MANIFEST is modify !!!!!!!!");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ProjectConfig> all_project = mani.get_all_configs();
|
||||||
|
Log.info("status of: " + all_project.size() + " projects");
|
||||||
|
int id_element = 0;
|
||||||
|
|
||||||
|
/* Display status of manifest ==> todo later ...
|
||||||
|
elem = configuration.get_manifest_config()
|
||||||
|
base_display = tools.get_list_base_display(id_element, len(all_project), elem)
|
||||||
|
status.display_status(elem, argument_remote_name, argument_display_tag, id_element, base_display)
|
||||||
|
*/
|
||||||
|
boolean is_behind = false;
|
||||||
|
for (ProjectConfig elem : all_project) {
|
||||||
|
id_element++;
|
||||||
|
String base_display = Tools.get_list_base_display(id_element, all_project.size(), elem);
|
||||||
|
int ret = Status.displayStatus(elem, argument_remote_name, argument_display_tag, id_element, base_display);
|
||||||
|
if (ret != 0) {
|
||||||
|
is_behind = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (is_behind == true) {
|
||||||
|
//return Env.ret_action_need_updtate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String helpExample() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
214
src/org/atriasoft/island/actions/Status.java
Normal file
214
src/org/atriasoft/island/actions/Status.java
Normal file
@ -0,0 +1,214 @@
|
|||||||
|
package org.atriasoft.island.actions;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.atriasoft.island.Commands;
|
||||||
|
import org.atriasoft.island.Env;
|
||||||
|
import org.atriasoft.island.internal.Log;
|
||||||
|
import org.atriasoft.island.model.ProjectConfig;
|
||||||
|
|
||||||
|
import org.eclipse.jgit.api.Git;
|
||||||
|
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||||
|
import org.eclipse.jgit.lib.ObjectId;
|
||||||
|
|
||||||
|
public class Status {
|
||||||
|
|
||||||
|
private static String default_behind_message = "[DEV] update dev tag version";
|
||||||
|
private static String default_update_message = "[VERSION] update dev tag version";
|
||||||
|
private static String base_name_of_a_tagged_branch = "branch_on_tag_";
|
||||||
|
|
||||||
|
public static boolean checkout_elem(final ProjectConfig elem, final String argument_remote_name, String branch_to_checkout, final String base_display) throws Exception {
|
||||||
|
Log.verbose("checkout : " + base_display);
|
||||||
|
Path git_repo_path = Env.get_island_root_path().resolve(elem.getPath());
|
||||||
|
if (!Files.exists(git_repo_path)){
|
||||||
|
Log.warning("checkout " + base_display + " ==> repository does not exist ...");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// check if the repository is modify
|
||||||
|
Git git = Git.open(git_repo_path.toFile());
|
||||||
|
boolean is_modify = git.status().call().hasUncommittedChanges();
|
||||||
|
if (is_modify == true){
|
||||||
|
Log.warning("checkout " + base_display + " ==> modify data can not checkout new branch");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
List<String> list_branch_local = Commands.get_list_branch_local(git);
|
||||||
|
String select_branch = git.getRepository().getBranch();
|
||||||
|
|
||||||
|
boolean is_tag = false;
|
||||||
|
if (branch_to_checkout.equals("__TAG__")) {
|
||||||
|
branch_to_checkout = Status.base_name_of_a_tagged_branch + elem.getTag();
|
||||||
|
is_tag = true;
|
||||||
|
if (elem.isVolatile()) {
|
||||||
|
Log.info("checkout " + base_display + " ==> Can not checkout for 'volatile' repository");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (elem.getTag() == null) {
|
||||||
|
Log.info("checkout " + base_display + " ==> Can not checkout for 'null' Tag");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// check if we are on the good branch{
|
||||||
|
if (branch_to_checkout.equals(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 " + list_branch_local);
|
||||||
|
if (list_branch_local.contains(branch_to_checkout)) {
|
||||||
|
git.checkout().setCreateBranch(false).setName(branch_to_checkout).call();
|
||||||
|
Log.info("checkout " + base_display + " ==> switch branch");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> list_tags = Commands.get_tags(git);
|
||||||
|
if (list_tags.contains(branch_to_checkout)) {
|
||||||
|
is_tag = true;
|
||||||
|
if (elem.getTag() == null) {
|
||||||
|
elem.setTag(branch_to_checkout);
|
||||||
|
branch_to_checkout = Status.base_name_of_a_tagged_branch + elem.getTag();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Check if the remote branch exist ...
|
||||||
|
if (is_tag) {
|
||||||
|
Log.info("checkout " + base_display + " ==> NO remote branch");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
List<String> list_branch_remote = Commands.get_list_branch_remote(git);
|
||||||
|
String tryRemoteBranch = elem.getSelectRemotes().getName() + "/" + branch_to_checkout;
|
||||||
|
if (list_branch_remote.contains(tryRemoteBranch)) {
|
||||||
|
Log.info(" ==> find ...");
|
||||||
|
try {
|
||||||
|
git.checkout().setCreateBranch(true).setName(tryRemoteBranch).call();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
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 (!list_tags.contains(elem.getTag())) {
|
||||||
|
Log.info("checkout " + base_display + " ==> NO remote tags");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
Log.info(" ==> find ...");
|
||||||
|
Log.todo("checkout " + base_display + " ==> Can not checkout to the correct tags MUST be inplemented");
|
||||||
|
return false;
|
||||||
|
/*
|
||||||
|
// 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 static int displayStatus(final ProjectConfig elem, final String argument_remote_name, final boolean argument_display_tag, final int id_element, final String base_display) throws IOException, GitAPIException {
|
||||||
|
String volatileString = "";
|
||||||
|
if (elem.isVolatile()) {
|
||||||
|
volatileString = " (volatile)";
|
||||||
|
}
|
||||||
|
Log.verbose("status : " + base_display);
|
||||||
|
//Log.debug("elem : " + str(elem))
|
||||||
|
Path git_repo_path = Env.get_island_root_path().resolve(elem.getPath());
|
||||||
|
if (!Files.exists(git_repo_path)) {
|
||||||
|
Log.info(base_display + volatileString + "\r\t\t\t\t\t\t\t\t\t" + " (not download)");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
Git git = Git.open(git_repo_path.toFile());
|
||||||
|
boolean is_modify = git.status().call().hasUncommittedChanges();
|
||||||
|
|
||||||
|
List<String> list_branch = Commands.get_list_branch_all(git);
|
||||||
|
String select_branch = git.getRepository().getBranch();
|
||||||
|
Log.verbose("List all branch: " + list_branch);
|
||||||
|
String tracking_remote_branch = null;
|
||||||
|
if (!select_branch.startsWith(Status.base_name_of_a_tagged_branch)) {
|
||||||
|
// get tracking branch
|
||||||
|
tracking_remote_branch = Commands.get_tracking_branch(git, argument_remote_name, select_branch);
|
||||||
|
if (tracking_remote_branch == null) {
|
||||||
|
Log.info(base_display + volatileString + "\r\t\t\t\t\t\t\t (NO BRANCH)");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tracking_remote_branch = select_branch.substring(Status.base_name_of_a_tagged_branch.length());
|
||||||
|
}
|
||||||
|
String modify_status = " ";
|
||||||
|
if (is_modify == true) {
|
||||||
|
modify_status = " *** ";
|
||||||
|
}
|
||||||
|
Log.verbose("select branch = '" + select_branch + "' is modify : " + is_modify + " track: '" + tracking_remote_branch + "'");
|
||||||
|
|
||||||
|
List<ObjectId> ret_current_branch_sha1 = Commands.get_revision_list_to_branch(git, select_branch);
|
||||||
|
List<ObjectId> ret_track_branch_sha1 = Commands.get_revision_list_to_branch(git, tracking_remote_branch);
|
||||||
|
// remove all identical sha1 ==> not needed for this
|
||||||
|
int in_forward = 0;
|
||||||
|
for (ObjectId elem_sha1 : ret_current_branch_sha1) {
|
||||||
|
if (!ret_track_branch_sha1.contains(elem_sha1)) {
|
||||||
|
in_forward++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int in_behind = 0;
|
||||||
|
for (ObjectId elem_sha1 : ret_track_branch_sha1) {
|
||||||
|
if (!ret_current_branch_sha1.contains(elem_sha1)) {
|
||||||
|
in_behind++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String behind_forward_comment = "";
|
||||||
|
if (in_forward != 0) {
|
||||||
|
behind_forward_comment += "forward=" + in_forward;
|
||||||
|
}
|
||||||
|
if (in_behind != 0) {
|
||||||
|
if (in_forward != 0) {
|
||||||
|
behind_forward_comment += " ";
|
||||||
|
}
|
||||||
|
behind_forward_comment += "behind=" + in_behind;
|
||||||
|
}
|
||||||
|
if (behind_forward_comment != "") {
|
||||||
|
behind_forward_comment = "\r\t\t\t\t\t\t\t\t\t\t\t\t[" + behind_forward_comment + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
String tags_comment = "";
|
||||||
|
// check the current tags of the repository
|
||||||
|
if (argument_display_tag) {
|
||||||
|
List<String> ret_current_tags = Commands.get_tags_current(git);
|
||||||
|
Log.verbose("tags found: " + ret_current_tags);
|
||||||
|
for (String elem_tag : ret_current_tags) {
|
||||||
|
if (!tags_comment.isEmpty()) {
|
||||||
|
tags_comment += ",";
|
||||||
|
}
|
||||||
|
tags_comment += elem_tag;
|
||||||
|
}
|
||||||
|
if (!tags_comment.isEmpty()) {
|
||||||
|
tags_comment = "\r\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[" + tags_comment + "]";
|
||||||
|
} else {
|
||||||
|
tags_comment = "\r\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t- - - - -";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Log.info(base_display + volatileString + "\r\t\t\t\t\t\t\t" + modify_status + "(" + select_branch + " -> " + tracking_remote_branch + ")" + behind_forward_comment + tags_comment);
|
||||||
|
if (is_modify) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
cmd = "git status --short"
|
||||||
|
Log.verbose("execute : " + cmd)
|
||||||
|
ret_diff = multiprocess.run_command(cmd, cwd=git_repo_path)
|
||||||
|
tmp_color_red = "\033[31m"
|
||||||
|
tmp_color_default= "\033[00m"
|
||||||
|
Log.info(tmp_color_red + ret_diff[1] + tmp_color_default)
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
return in_behind;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,30 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
//#
|
|
||||||
//# @brief Get the global description of the current action
|
|
||||||
//# @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
|
||||||
//#
|
|
||||||
public void help():
|
|
||||||
return
|
|
||||||
|
|
||||||
//#
|
|
||||||
//# @brief Add argument to the specific action
|
|
||||||
//# @param[in,out] my_args (death.Arguments) Argument manager
|
|
||||||
//# @param[in] section Name of the currect action
|
|
||||||
//#
|
|
||||||
public void add_specific_arguments(my_args, section):
|
|
||||||
|
|
||||||
//#
|
|
||||||
//# @brief Execute the action required.
|
|
||||||
//#
|
|
||||||
//# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
|
||||||
//# None : No error (return program out 0)
|
|
||||||
//# -10 : ACTION is not existing
|
|
||||||
//# -11 : ACTION execution system error
|
|
||||||
//# -12 : ACTION Wrong parameters
|
|
||||||
//#
|
|
||||||
public void execute(_arguments):
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -4,69 +4,70 @@ import io.scenarium.logger.LogLevel;
|
|||||||
import io.scenarium.logger.Logger;
|
import io.scenarium.logger.Logger;
|
||||||
|
|
||||||
public class Log {
|
public class Log {
|
||||||
|
private static final boolean FORCE = true;
|
||||||
private static final String LIB_NAME = "island";
|
private static final String LIB_NAME = "island";
|
||||||
private static final String LIB_NAME_DRAW = Logger.getDrawableName(LIB_NAME);
|
private static final String LIB_NAME_DRAW = Logger.getDrawableName(Log.LIB_NAME);
|
||||||
private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(LIB_NAME, LogLevel.CRITICAL);
|
private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.CRITICAL);
|
||||||
private static final boolean PRINT_ERROR = Logger.getNeedPrint(LIB_NAME, LogLevel.ERROR);
|
private static final boolean PRINT_ERROR = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.ERROR);
|
||||||
private static final boolean PRINT_WARNING = Logger.getNeedPrint(LIB_NAME, LogLevel.WARNING);
|
private static final boolean PRINT_WARNING = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.WARNING);
|
||||||
private static final boolean PRINT_INFO = Logger.getNeedPrint(LIB_NAME, LogLevel.INFO);
|
private static final boolean PRINT_INFO = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.INFO);
|
||||||
private static final boolean PRINT_DEBUG = Logger.getNeedPrint(LIB_NAME, LogLevel.DEBUG);
|
private static final boolean PRINT_DEBUG = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.DEBUG);
|
||||||
private static final boolean PRINT_VERBOSE = Logger.getNeedPrint(LIB_NAME, LogLevel.VERBOSE);
|
private static final boolean PRINT_VERBOSE = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.VERBOSE);
|
||||||
private static final boolean PRINT_TODO = Logger.getNeedPrint(LIB_NAME, LogLevel.TODO);
|
private static final boolean PRINT_TODO = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.TODO);
|
||||||
private static final boolean PRINT_PRINT = Logger.getNeedPrint(LIB_NAME, LogLevel.PRINT);
|
private static final boolean PRINT_PRINT = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.PRINT);
|
||||||
|
|
||||||
public static void critical(final String data) {
|
public static void critical(final String data) {
|
||||||
if (PRINT_CRITICAL) {
|
if (Log.PRINT_CRITICAL || Log.FORCE) {
|
||||||
Logger.critical(LIB_NAME_DRAW, data);
|
Logger.critical(Log.LIB_NAME_DRAW, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void critical(final String data, final Exception e) {
|
public static void critical(final String data, final Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
if (PRINT_CRITICAL) {
|
if (Log.PRINT_CRITICAL || Log.FORCE) {
|
||||||
Logger.critical(LIB_NAME_DRAW, data + " : " + e.getMessage());
|
Logger.critical(Log.LIB_NAME_DRAW, data + " : " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void debug(final String data) {
|
public static void debug(final String data) {
|
||||||
if (PRINT_DEBUG) {
|
if (Log.PRINT_DEBUG || Log.FORCE) {
|
||||||
Logger.debug(LIB_NAME_DRAW, data);
|
Logger.debug(Log.LIB_NAME_DRAW, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void error(final String data) {
|
public static void error(final String data) {
|
||||||
if (PRINT_ERROR) {
|
if (Log.PRINT_ERROR || Log.FORCE) {
|
||||||
Logger.error(LIB_NAME_DRAW, data);
|
Logger.error(Log.LIB_NAME_DRAW, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void info(final String data) {
|
public static void info(final String data) {
|
||||||
if (PRINT_INFO) {
|
if (Log.PRINT_INFO || Log.FORCE) {
|
||||||
Logger.info(LIB_NAME_DRAW, data);
|
Logger.info(Log.LIB_NAME_DRAW, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void print(final String data) {
|
public static void print(final String data) {
|
||||||
if (PRINT_PRINT) {
|
if (Log.PRINT_PRINT || Log.FORCE) {
|
||||||
Logger.print(LIB_NAME_DRAW, data);
|
Logger.print(Log.LIB_NAME_DRAW, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void todo(final String data) {
|
public static void todo(final String data) {
|
||||||
if (PRINT_TODO) {
|
if (Log.PRINT_TODO || Log.FORCE) {
|
||||||
Logger.todo(LIB_NAME_DRAW, data);
|
Logger.todo(Log.LIB_NAME_DRAW, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void verbose(final String data) {
|
public static void verbose(final String data) {
|
||||||
if (PRINT_VERBOSE) {
|
if (Log.PRINT_VERBOSE || Log.FORCE) {
|
||||||
Logger.verbose(LIB_NAME_DRAW, data);
|
Logger.verbose(Log.LIB_NAME_DRAW, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void warning(final String data) {
|
public static void warning(final String data) {
|
||||||
if (PRINT_WARNING) {
|
if (Log.PRINT_WARNING || Log.FORCE) {
|
||||||
Logger.warning(LIB_NAME_DRAW, data);
|
Logger.warning(Log.LIB_NAME_DRAW, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,19 +5,19 @@ import java.util.List;
|
|||||||
import org.atriasoft.death.ArgElement;
|
import org.atriasoft.death.ArgElement;
|
||||||
import org.atriasoft.death.Arguments;
|
import org.atriasoft.death.Arguments;
|
||||||
|
|
||||||
public interface ActionInterface {
|
public abstract class ActionInterface {
|
||||||
/**
|
/**
|
||||||
* Get the global description of the current action
|
* Get the global description of the current action
|
||||||
* @return the description string (fist line if reserved for the overview, all is for the specific display)
|
* @return the description string (fist line if reserved for the overview, all is for the specific display)
|
||||||
*/
|
*/
|
||||||
String help();
|
public abstract String help();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Add argument to the specific action
|
* @brief Add argument to the specific action
|
||||||
* @param[in,out] my_args (death.Arguments) Argument manager
|
* @param[in,out] my_args (death.Arguments) Argument manager
|
||||||
* @param[in] section Name of the currect action
|
* @param[in] section Name of the currect action
|
||||||
*/
|
*/
|
||||||
default void addSpecificArguments(Arguments myArgs, String section) {
|
public void addSpecificArguments(final Arguments myArgs, final String section) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ public interface ActionInterface {
|
|||||||
* Set the option argument are not able to check if the argument are correct or not
|
* Set the option argument are not able to check if the argument are correct or not
|
||||||
* @return Have parameter without arguments
|
* @return Have parameter without arguments
|
||||||
*/
|
*/
|
||||||
default boolean haveUnknowArgument() {
|
public boolean haveUnknowArgument() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ public interface ActionInterface {
|
|||||||
* @param myArgs (death.Arguments) Argument manager
|
* @param myArgs (death.Arguments) Argument manager
|
||||||
* @param section Name of the current action
|
* @param section Name of the current action
|
||||||
*/
|
*/
|
||||||
void add_specific_arguments(Arguments myArgs, String section);
|
public abstract void add_specific_arguments(Arguments myArgs, String section);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the action required.
|
* Execute the action required.
|
||||||
@ -44,9 +44,9 @@ public interface ActionInterface {
|
|||||||
* -11 : ACTION execution system error
|
* -11 : ACTION execution system error
|
||||||
* -12 : ACTION Wrong parameters
|
* -12 : ACTION Wrong parameters
|
||||||
*/
|
*/
|
||||||
public void execute(List<ArgElement> _arguments) throws ActionException;
|
public abstract void execute(List<ArgElement> _arguments) throws ActionException, Exception;
|
||||||
|
|
||||||
String helpExample();
|
public abstract String helpExample();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,35 +21,35 @@ public class ConfigManifest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getRepo() {
|
public String getRepo() {
|
||||||
return repo;
|
return this.repo;
|
||||||
}
|
}
|
||||||
public void setRepo(String repo) {
|
public void setRepo(final String repo) {
|
||||||
this.repo = repo;
|
this.repo = repo;
|
||||||
}
|
}
|
||||||
public String getBranch() {
|
public String getBranch() {
|
||||||
return branch;
|
return this.branch;
|
||||||
}
|
}
|
||||||
public void setBranch(String branch) {
|
public void setBranch(final String branch) {
|
||||||
this.branch = branch;
|
this.branch = branch;
|
||||||
}
|
}
|
||||||
public String getManifestName() {
|
public String getManifestName() {
|
||||||
return manifestName;
|
return this.manifestName;
|
||||||
}
|
}
|
||||||
public void setManifestName(String manifestName) {
|
public void setManifestName(final String manifestName) {
|
||||||
this.manifestName = manifestName;
|
this.manifestName = manifestName;
|
||||||
}
|
}
|
||||||
public List<Volatile> getVolatiles() {
|
public List<Volatile> getVolatiles() {
|
||||||
return volatiles;
|
return this.volatiles;
|
||||||
}
|
}
|
||||||
public void setVolatiles(List<Volatile> volatiles) {
|
public void setVolatiles(final List<Volatile> volatiles) {
|
||||||
this.volatiles = volatiles;
|
this.volatiles = volatiles;
|
||||||
}
|
}
|
||||||
public void addVolatile(String gitAddress, String path) {
|
public void addVolatile(final String gitAddress, final String path) {
|
||||||
rmVolatile(path);
|
rmVolatile(path);
|
||||||
this.volatiles.add(new Volatile(gitAddress, path));
|
this.volatiles.add(new Volatile(gitAddress, path));
|
||||||
}
|
}
|
||||||
private void rmVolatile(String path) {
|
private void rmVolatile(final String path) {
|
||||||
ListIterator<Volatile> it = volatiles.listIterator();
|
ListIterator<Volatile> it = this.volatiles.listIterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Volatile elem = it.next();
|
Volatile elem = it.next();
|
||||||
if (elem.path.equals(path)) {
|
if (elem.path.equals(path)) {
|
||||||
@ -58,29 +58,29 @@ public class ConfigManifest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public List<Link> getCurentLink() {
|
public List<Link> getCurentLink() {
|
||||||
return curentLink;
|
return this.curentLink;
|
||||||
}
|
}
|
||||||
public void setCurentLink(List<Link> curentLink) {
|
public void setCurentLink(final List<Link> curentLink) {
|
||||||
this.curentLink = curentLink;
|
this.curentLink = curentLink;
|
||||||
}
|
}
|
||||||
public void addLink(String source, String destination) {
|
public void addLink(final String source, final String destination) {
|
||||||
rmLink(destination);
|
rmLink(destination);
|
||||||
this.curentLink.add(new Link(source, destination));
|
this.curentLink.add(new Link(source, destination));
|
||||||
}
|
}
|
||||||
private void rmLink(String destination) {
|
private void rmLink(final String destination) {
|
||||||
ListIterator<Link> it = curentLink.listIterator();
|
ListIterator<Link> it = this.curentLink.listIterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Link elem = it.next();
|
Link elem = it.next();
|
||||||
if (elem.destination.equals(destination)) {
|
if (elem.getDestination().equals(destination)) {
|
||||||
it.remove();
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ConfigManifest load() {
|
public static ConfigManifest load() {
|
||||||
return load(Env.get_island_path_config());
|
return ConfigManifest.load(Env.get_island_path_config());
|
||||||
}
|
}
|
||||||
public static ConfigManifest load(Path path) {
|
public static ConfigManifest load(final Path path) {
|
||||||
ConfigManifest[] root = null;
|
ConfigManifest[] root = null;
|
||||||
try {
|
try {
|
||||||
root = Exml.parse(path, ConfigManifest.class, "config-island");
|
root = Exml.parse(path, ConfigManifest.class, "config-island");
|
||||||
@ -96,7 +96,7 @@ public class ConfigManifest {
|
|||||||
public void store() {
|
public void store() {
|
||||||
store(Env.get_island_path_config());
|
store(Env.get_island_path_config());
|
||||||
}
|
}
|
||||||
public void store(Path path) {
|
public void store(final Path path) {
|
||||||
Log.todo("unimplemented model...");
|
Log.todo("unimplemented model...");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,13 +104,13 @@ public class ConfigManifest {
|
|||||||
|
|
||||||
// public void load():
|
// public void load():
|
||||||
// // transform the old format of configuration (use json now ==> simple
|
// // 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()
|
// 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
|
// return true
|
||||||
// this.volatiles = []
|
// this.volatiles = []
|
||||||
// this.curentLink = []
|
// 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)
|
// data = json.load(json_file)
|
||||||
// if "repo" in data.keys():
|
// if "repo" in data.keys():
|
||||||
// this.repo = data["repo"]
|
// this.repo = data["repo"]
|
||||||
@ -135,7 +135,7 @@ public class ConfigManifest {
|
|||||||
// data["manifest_name"] = this.manifestName
|
// data["manifest_name"] = this.manifestName
|
||||||
// data["volatiles"] = this.volatiles
|
// data["volatiles"] = this.volatiles
|
||||||
// data["link"] = this.curentLink
|
// 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)
|
// json.dump(data, outfile, indent=4)
|
||||||
// return true
|
// return true
|
||||||
// return false
|
// return false
|
||||||
@ -184,7 +184,7 @@ public class ConfigManifest {
|
|||||||
// conf = repo_config.RepoConfig()
|
// conf = repo_config.RepoConfig()
|
||||||
// base_volatile, repo_volatile = repo_config.split_repo(self.get_manifest())
|
// base_volatile, repo_volatile = repo_config.split_repo(self.get_manifest())
|
||||||
// conf.name = repo_volatile
|
// 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.branch = "master"
|
||||||
// conf.volatile = false
|
// conf.volatile = false
|
||||||
// conf.remotes = [
|
// conf.remotes = [
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package org.atriasoft.island.model;
|
package org.atriasoft.island.model;
|
||||||
|
|
||||||
class Link {
|
public class Link {
|
||||||
public String source;
|
private String source;
|
||||||
public String destination;
|
private String destination;
|
||||||
public Link(String source, String destination) {
|
public Link(final String source, final String destination) {
|
||||||
this.source = source;
|
this.source = source;
|
||||||
this.destination = destination;
|
this.destination = destination;
|
||||||
}
|
}
|
||||||
@ -11,5 +11,17 @@ class Link {
|
|||||||
this.source = "";
|
this.source = "";
|
||||||
this.destination = "";
|
this.destination = "";
|
||||||
}
|
}
|
||||||
|
public String getSource() {
|
||||||
|
return this.source;
|
||||||
|
}
|
||||||
|
public void setSource(final String source) {
|
||||||
|
this.source = source;
|
||||||
|
}
|
||||||
|
public String getDestination() {
|
||||||
|
return this.destination;
|
||||||
|
}
|
||||||
|
public void setDestination(final String destination) {
|
||||||
|
this.destination = destination;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
25
src/org/atriasoft/island/model/MirrorConfig.java
Normal file
25
src/org/atriasoft/island/model/MirrorConfig.java
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
57
src/org/atriasoft/island/model/ProjectConfig.java
Normal file
57
src/org/atriasoft/island/model/ProjectConfig.java
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
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 boolean volatileElement = false;
|
||||||
|
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 boolean isVolatile() {
|
||||||
|
return this.volatileElement;
|
||||||
|
}
|
||||||
|
public void setVolatile(final boolean volatileElement) {
|
||||||
|
this.volatileElement = volatileElement;
|
||||||
|
}
|
||||||
|
}
|
40
src/org/atriasoft/island/model/RemoteConfig.java
Normal file
40
src/org/atriasoft/island/model/RemoteConfig.java
Normal 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));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
40
src/org/atriasoft/island/model/RepositoryConfig.java
Normal file
40
src/org/atriasoft/island/model/RepositoryConfig.java
Normal 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,9 +1,9 @@
|
|||||||
package org.atriasoft.island.model;
|
package org.atriasoft.island.model;
|
||||||
|
|
||||||
class Volatile {
|
public class Volatile {
|
||||||
public String gitAddress;
|
public String gitAddress;
|
||||||
public String path;
|
public String path;
|
||||||
public Volatile(String gitAddress, String path) {
|
public Volatile(final String gitAddress, final String path) {
|
||||||
this.gitAddress = gitAddress;
|
this.gitAddress = gitAddress;
|
||||||
this.path = path;
|
this.path = path;
|
||||||
}
|
}
|
||||||
|
@ -48,11 +48,11 @@ public void execute(_arguments):
|
|||||||
cmd += elem.getArg() + " "
|
cmd += elem.getArg() + " "
|
||||||
|
|
||||||
// check system is OK
|
// check system is OK
|
||||||
manifest.check_lutin_is_init()
|
Manifest.checkIsInit();
|
||||||
|
|
||||||
configuration = config.get_unique_config()
|
ConfigManifest configuration = Config.getUniqueConfig();
|
||||||
|
|
||||||
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:
|
if os.path.exists(file_source_manifest) == false:
|
||||||
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ public void execute(_arguments):
|
|||||||
Log.info("execute command : " + base_display)
|
Log.info("execute command : " + base_display)
|
||||||
tools.wait_for_server_if_needed()
|
tools.wait_for_server_if_needed()
|
||||||
//Log.debug("elem : " + str(elem))
|
//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:
|
if os.path.exists(git_repo_path) == false:
|
||||||
Log.info("" + base_display + "\r\t\t\t\t\t\t\t\t\t" + " (not download)")
|
Log.info("" + base_display + "\r\t\t\t\t\t\t\t\t\t" + " (not download)")
|
||||||
continue
|
continue
|
||||||
|
@ -49,22 +49,22 @@ public void execute(_arguments):
|
|||||||
argument_amend = ""
|
argument_amend = ""
|
||||||
argument_all = ""
|
argument_all = ""
|
||||||
for elem in _arguments:
|
for elem in _arguments:
|
||||||
if elem.getOptionName() == "message":
|
if elem.getOptionName().equals("message":
|
||||||
Log.info("find message: '" + elem.getArg() + "'")
|
Log.info("find message: '" + elem.getArg() + "'")
|
||||||
argument_message = " --message \"" + elem.getArg() + "\" ";
|
argument_message = " --message \"" + elem.getArg() + "\" ";
|
||||||
} else if elem.getOptionName() == "all":
|
} else if elem.getOptionName().equals("all":
|
||||||
argument_all = " --all "
|
argument_all = " --all "
|
||||||
} else if elem.getOptionName() == "amend":
|
} else if elem.getOptionName().equals("amend":
|
||||||
argument_amend = " --amend "
|
argument_amend = " --amend "
|
||||||
else:
|
else:
|
||||||
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
||||||
|
|
||||||
// check system is OK
|
// check system is OK
|
||||||
manifest.check_lutin_is_init()
|
Manifest.checkIsInit();
|
||||||
|
|
||||||
configuration = config.get_unique_config()
|
ConfigManifest configuration = Config.getUniqueConfig();
|
||||||
|
|
||||||
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:
|
if os.path.exists(file_source_manifest) == false:
|
||||||
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
||||||
mani = manifest.Manifest(file_source_manifest)
|
mani = manifest.Manifest(file_source_manifest)
|
||||||
@ -76,7 +76,7 @@ public void execute(_arguments):
|
|||||||
id_element += 1
|
id_element += 1
|
||||||
base_display = tools.get_list_base_display(id_element, len(all_project), elem)
|
base_display = tools.get_list_base_display(id_element, len(all_project), elem)
|
||||||
Log.info("commit: " + base_display)
|
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:
|
if os.path.exists(git_repo_path) == false:
|
||||||
Log.error("can not commit project that not exist")
|
Log.error("can not commit project that not exist")
|
||||||
continue
|
continue
|
||||||
|
@ -45,18 +45,18 @@ public void add_specific_arguments(my_args, section):
|
|||||||
public void execute(_arguments):
|
public void execute(_arguments):
|
||||||
argument_remote_name = ""
|
argument_remote_name = ""
|
||||||
for elem in _arguments:
|
for elem in _arguments:
|
||||||
if elem.getOptionName() == "remote":
|
if elem.getOptionName().equals("remote":
|
||||||
Log.info("find remote name: '" + elem.getArg() + "'")
|
Log.info("find remote name: '" + elem.getArg() + "'")
|
||||||
argument_remote_name = elem.getArg()
|
argument_remote_name = elem.getArg()
|
||||||
else:
|
else:
|
||||||
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
||||||
|
|
||||||
// check system is OK
|
// check system is OK
|
||||||
manifest.check_lutin_is_init()
|
Manifest.checkIsInit();
|
||||||
|
|
||||||
configuration = config.get_unique_config()
|
ConfigManifest configuration = Config.getUniqueConfig();
|
||||||
|
|
||||||
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:
|
if os.path.exists(file_source_manifest) == false:
|
||||||
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
||||||
mani = manifest.Manifest(file_source_manifest)
|
mani = manifest.Manifest(file_source_manifest)
|
||||||
@ -70,7 +70,7 @@ public void execute(_arguments):
|
|||||||
for elem in all_project:
|
for elem in all_project:
|
||||||
id_element += 1
|
id_element += 1
|
||||||
// configure remote name:
|
// configure remote name:
|
||||||
if argument_remote_name == "":
|
if argument_remote_name.equals("":
|
||||||
argument_remote_name = elem.select_remote["name"]
|
argument_remote_name = elem.select_remote["name"]
|
||||||
base_display = tools.get_list_base_display(id_element, len(all_project), elem)
|
base_display = tools.get_list_base_display(id_element, len(all_project), elem)
|
||||||
Log.info("deliver-push: " + base_display)
|
Log.info("deliver-push: " + base_display)
|
||||||
|
@ -48,21 +48,21 @@ public void execute(_arguments):
|
|||||||
argument_from = None
|
argument_from = None
|
||||||
argument_to = None
|
argument_to = None
|
||||||
for elem in _arguments:
|
for elem in _arguments:
|
||||||
if elem.getOptionName() == "from":
|
if elem.getOptionName().equals("from":
|
||||||
Log.info("find source branch name: '" + elem.getArg() + "'")
|
Log.info("find source branch name: '" + elem.getArg() + "'")
|
||||||
argument_from = 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() + "'")
|
Log.info("find destination branch name: '" + elem.getArg() + "'")
|
||||||
argument_to = elem.getArg()
|
argument_to = elem.getArg()
|
||||||
else:
|
else:
|
||||||
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
||||||
|
|
||||||
// check system is OK
|
// check system is OK
|
||||||
manifest.check_lutin_is_init()
|
Manifest.checkIsInit();
|
||||||
|
|
||||||
configuration = config.get_unique_config()
|
ConfigManifest configuration = Config.getUniqueConfig();
|
||||||
|
|
||||||
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:
|
if os.path.exists(file_source_manifest) == false:
|
||||||
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
||||||
|
|
||||||
@ -94,10 +94,10 @@ public void execute(_arguments):
|
|||||||
id_element += 1
|
id_element += 1
|
||||||
base_display = tools.get_list_base_display(id_element, len(all_project), elem)
|
base_display = tools.get_list_base_display(id_element, len(all_project), elem)
|
||||||
Log.info("deliver: ========================================================================")
|
Log.info("deliver: ========================================================================")
|
||||||
Log.info("deliver: == " + base_display)
|
Log.info("deliver:.equals(" + base_display)
|
||||||
Log.info("deliver: ========================================================================")
|
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,
|
// Check the validity of the version,
|
||||||
version_description, add_in_version_management = status.get_current_version_repo(git_repo_path)
|
version_description, add_in_version_management = status.get_current_version_repo(git_repo_path)
|
||||||
if version_description == None:
|
if version_description == None:
|
||||||
@ -116,7 +116,7 @@ public void execute(_arguments):
|
|||||||
if new_version_description == None:
|
if new_version_description == None:
|
||||||
continue
|
continue
|
||||||
// merge branch
|
// merge branch
|
||||||
if mani.deliver_mode == "merge":
|
if mani.deliver_mode.equals("merge":
|
||||||
merge_force = true
|
merge_force = true
|
||||||
else:
|
else:
|
||||||
merge_force = false
|
merge_force = false
|
||||||
|
@ -45,20 +45,20 @@ public void add_specific_arguments(my_args, section):
|
|||||||
public void execute(_arguments):
|
public void execute(_arguments):
|
||||||
argument_remote_name = ""
|
argument_remote_name = ""
|
||||||
for elem in _arguments:
|
for elem in _arguments:
|
||||||
if elem.getOptionName() == "remote":
|
if elem.getOptionName().equals("remote":
|
||||||
Log.info("find remote name: '" + elem.getArg() + "'")
|
Log.info("find remote name: '" + elem.getArg() + "'")
|
||||||
argument_remote_name = elem.getArg()
|
argument_remote_name = elem.getArg()
|
||||||
else:
|
else:
|
||||||
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
||||||
|
|
||||||
// check system is OK
|
// check system is OK
|
||||||
manifest.check_lutin_is_init()
|
Manifest.checkIsInit();
|
||||||
|
|
||||||
Log.info("fetch manifest : '" + str(env.get_island_path_manifest()) + "'")
|
Log.info("fetch manifest : '" + str(Env.get_island_path_manifest()) + "'")
|
||||||
commands.fetch(env.get_island_path_manifest(), "origin")
|
commands.fetch(Env.get_island_path_manifest(), "origin")
|
||||||
|
|
||||||
configuration = config.get_unique_config()
|
ConfigManifest configuration = Config.getUniqueConfig();
|
||||||
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:
|
if os.path.exists(file_source_manifest) == false:
|
||||||
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
||||||
mani = manifest.Manifest(file_source_manifest)
|
mani = manifest.Manifest(file_source_manifest)
|
||||||
@ -69,14 +69,14 @@ public void execute(_arguments):
|
|||||||
for elem in all_project:
|
for elem in all_project:
|
||||||
id_element += 1
|
id_element += 1
|
||||||
// configure remote name:
|
// configure remote name:
|
||||||
if argument_remote_name == "":
|
if argument_remote_name.equals("":
|
||||||
argument_remote_name = elem.select_remote["name"]
|
argument_remote_name = elem.select_remote["name"]
|
||||||
|
|
||||||
base_display = tools.get_list_base_display(id_element, len(all_project), elem)
|
base_display = tools.get_list_base_display(id_element, len(all_project), elem)
|
||||||
Log.info("fetch: " + base_display)
|
Log.info("fetch: " + base_display)
|
||||||
tools.wait_for_server_if_needed()
|
tools.wait_for_server_if_needed()
|
||||||
//Log.debug("elem : " + str(elem))
|
//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:
|
if os.path.exists(git_repo_path) == false:
|
||||||
Log.error("can not fetch project that not exist")
|
Log.error("can not fetch project that not exist")
|
||||||
continue
|
continue
|
||||||
|
@ -51,20 +51,20 @@ public void execute(_arguments):
|
|||||||
manifest_name = "default.xml"
|
manifest_name = "default.xml"
|
||||||
address_manifest = ""
|
address_manifest = ""
|
||||||
for elem in _arguments:
|
for elem in _arguments:
|
||||||
if elem.getOptionName() == "branch":
|
if elem.getOptionName().equals("branch":
|
||||||
Log.info("find branch name: '" + elem.getArg() + "'")
|
Log.info("find branch name: '" + elem.getArg() + "'")
|
||||||
branch = elem.getArg()
|
branch = elem.getArg()
|
||||||
} else if elem.getOptionName() == "manifest":
|
} else if elem.getOptionName().equals("manifest":
|
||||||
Log.info("find mmanifest name: '" + elem.getArg() + "'")
|
Log.info("find mmanifest name: '" + elem.getArg() + "'")
|
||||||
manifest_name = elem.getArg()
|
manifest_name = elem.getArg()
|
||||||
} else if elem.getOptionName() == "":
|
} else if elem.getOptionName().equals("":
|
||||||
if address_manifest != "":
|
if address_manifest != "":
|
||||||
Log.error("Manifest adress already set : '" + address_manifest + "' !!! '" + elem.getArg() + "'")
|
Log.error("Manifest adress already set : '" + address_manifest + "' !!! '" + elem.getArg() + "'")
|
||||||
address_manifest = elem.getArg()
|
address_manifest = elem.getArg()
|
||||||
else:
|
else:
|
||||||
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
||||||
|
|
||||||
if address_manifest == "":
|
if address_manifest.equals("":
|
||||||
Log.error("Init: Missing manifest name")
|
Log.error("Init: Missing manifest name")
|
||||||
|
|
||||||
Log.info("Init with: '" + address_manifest + "' branch='" + branch + "' name of manifest='" + 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)
|
// check if .XXX exist (create it if needed)
|
||||||
if manifest.is_lutin_init() == true:
|
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
|
// check if the git of the manifest if availlable
|
||||||
|
|
||||||
// create the file configuration:
|
// create the file configuration:
|
||||||
@ -85,7 +85,7 @@ public void execute(_arguments):
|
|||||||
conf.store()
|
conf.store()
|
||||||
|
|
||||||
Log.info("Clone the manifest")
|
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:
|
if ret_values == false:
|
||||||
Log.info("'" + str(ret_values) + "'")
|
Log.info("'" + str(ret_values) + "'")
|
||||||
|
@ -48,24 +48,24 @@ public void execute(_arguments):
|
|||||||
argument_remote_name = ""
|
argument_remote_name = ""
|
||||||
branch_to_checkout = ""
|
branch_to_checkout = ""
|
||||||
for elem in _arguments:
|
for elem in _arguments:
|
||||||
if elem.getOptionName() == "remote":
|
if elem.getOptionName().equals("remote":
|
||||||
Log.info("find remote name: '" + elem.getArg() + "'")
|
Log.info("find remote name: '" + elem.getArg() + "'")
|
||||||
argument_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()
|
branch_to_checkout = elem.getArg()
|
||||||
else:
|
else:
|
||||||
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
||||||
|
|
||||||
// check system is OK
|
// check system is OK
|
||||||
manifest.check_lutin_is_init()
|
Manifest.checkIsInit();
|
||||||
|
|
||||||
configuration = config.get_unique_config()
|
ConfigManifest configuration = Config.getUniqueConfig();
|
||||||
|
|
||||||
|
|
||||||
elem = configuration.get_manifest_config()
|
elem = configuration.get_manifest_config()
|
||||||
base_display = tools.get_list_base_display(0, 0, elem)
|
base_display = tools.get_list_base_display(0, 0, elem)
|
||||||
if status.checkout_elem(elem, argument_remote_name, branch_to_checkout, base_display) == false:
|
if status.checkout_elem(elem, argument_remote_name, branch_to_checkout, base_display) == false:
|
||||||
return env.ret_action_fail
|
return Env.ret_action_fail
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,11 +48,11 @@ public void execute(_arguments):
|
|||||||
Log.error("pull Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
Log.error("pull Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
||||||
|
|
||||||
// check system is OK
|
// check system is OK
|
||||||
manifest.check_lutin_is_init()
|
Manifest.checkIsInit();
|
||||||
|
|
||||||
configuration = config.get_unique_config()
|
ConfigManifest configuration = Config.getUniqueConfig();
|
||||||
|
|
||||||
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:
|
if os.path.exists(file_source_manifest) == false:
|
||||||
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
||||||
|
|
||||||
|
@ -52,11 +52,11 @@ public void execute(_arguments):
|
|||||||
Log.error("pull Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
Log.error("pull Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
||||||
|
|
||||||
// check system is OK
|
// check system is OK
|
||||||
manifest.check_lutin_is_init()
|
Manifest.checkIsInit();
|
||||||
|
|
||||||
configuration = config.get_unique_config()
|
ConfigManifest configuration = Config.getUniqueConfig();
|
||||||
|
|
||||||
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:
|
if os.path.exists(file_source_manifest) == false:
|
||||||
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
||||||
|
|
||||||
@ -72,27 +72,27 @@ public void execute(_arguments):
|
|||||||
Log.verbose("deliver-ckeck: " + base_display)
|
Log.verbose("deliver-ckeck: " + base_display)
|
||||||
if status.deliver_check(elem, argument_remote_name, 0, base_display, source_branch, destination_branch) == false:
|
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)
|
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)
|
all_tags = check_all_tags(mani)
|
||||||
if all_tags == None:
|
if all_tags == None:
|
||||||
Log.error("Need the Tags are set in sub-repository", crash=false)
|
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 ...)
|
// deliver the manifest (if Needed ...)
|
||||||
base_display = tools.get_list_base_display(0, 0, elem)
|
base_display = tools.get_list_base_display(0, 0, elem)
|
||||||
|
|
||||||
Log.info("manifest-deliver: ========================================================================")
|
Log.info("manifest-deliver: ========================================================================")
|
||||||
Log.info("manifest-deliver: == " + base_display)
|
Log.info("manifest-deliver:.equals(" + base_display)
|
||||||
Log.info("manifest-deliver: ========================================================================")
|
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,
|
// Check the validity of the version,
|
||||||
version_description, add_in_version_management = status.get_current_version_repo(git_repo_path)
|
version_description, add_in_version_management = status.get_current_version_repo(git_repo_path)
|
||||||
if version_description == None:
|
if version_description == None:
|
||||||
return env.ret_action_fail
|
return Env.ret_action_fail
|
||||||
Log.info("manifest-deliver: ==> version: " + str(version_description))
|
Log.info("manifest-deliver: ==> version: " + str(version_description))
|
||||||
|
|
||||||
// go to the dev branch
|
// go to the dev branch
|
||||||
@ -106,7 +106,7 @@ public void execute(_arguments):
|
|||||||
return
|
return
|
||||||
// merge branch
|
// merge branch
|
||||||
commands.checkout(git_repo_path, destination_branch)
|
commands.checkout(git_repo_path, destination_branch)
|
||||||
if mani.deliver_mode == "merge":
|
if mani.deliver_mode.equals("merge":
|
||||||
merge_force = true
|
merge_force = true
|
||||||
else:
|
else:
|
||||||
merge_force = false
|
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)")
|
Log.info(base_display + "\r\t\t\t\t\t\t\t\t\t" + " (Not Managed)")
|
||||||
continue
|
continue
|
||||||
tags_comment = ""
|
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:
|
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)
|
Log.error(base_display + volatile + "\r\t\t\t\t\t\t\t\t\t" + " (not download)", crash=false)
|
||||||
check_have_error = true
|
check_have_error = true
|
||||||
|
@ -47,17 +47,17 @@ public void execute(_arguments):
|
|||||||
argument_remote_name = ""
|
argument_remote_name = ""
|
||||||
argument_display_tag = false
|
argument_display_tag = false
|
||||||
for elem in _arguments:
|
for elem in _arguments:
|
||||||
if elem.getOptionName() == "tags":
|
if elem.getOptionName().equals("tags":
|
||||||
argument_display_tag = true
|
argument_display_tag = true
|
||||||
else:
|
else:
|
||||||
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
||||||
|
|
||||||
// check system is OK
|
// check system is OK
|
||||||
manifest.check_lutin_is_init()
|
Manifest.checkIsInit();
|
||||||
|
|
||||||
configuration = config.get_unique_config()
|
ConfigManifest configuration = Config.getUniqueConfig();
|
||||||
elem = configuration.get_manifest_config()
|
elem = configuration.get_manifest_config()
|
||||||
base_display = tools.get_list_base_display(0, 0, elem)
|
base_display = tools.get_list_base_display(0, 0, elem)
|
||||||
ret = status.display_status(elem, argument_remote_name, argument_display_tag, 0, base_display)
|
ret = status.display_status(elem, argument_remote_name, argument_display_tag, 0, base_display)
|
||||||
if ret != None:
|
if ret != None:
|
||||||
return env.ret_action_need_updtate
|
return Env.ret_action_need_updtate
|
@ -47,14 +47,14 @@ public void execute(_arguments):
|
|||||||
Log.error("pull Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
Log.error("pull Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
||||||
|
|
||||||
// check system is OK
|
// check system is OK
|
||||||
manifest.check_lutin_is_init()
|
Manifest.checkIsInit();
|
||||||
|
|
||||||
configuration = config.get_unique_config()
|
ConfigManifest configuration = Config.getUniqueConfig();
|
||||||
|
|
||||||
Log.info("update manifest : '" + str(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())
|
is_modify_manifest = commands.check_repository_is_modify(Env.get_island_path_manifest())
|
||||||
if is_modify_manifest == true:
|
if is_modify_manifest == true:
|
||||||
commands.fetch(env.get_island_path_manifest(), "origin")
|
commands.fetch(Env.get_island_path_manifest(), "origin")
|
||||||
else:
|
else:
|
||||||
commands.pull(env.get_island_path_manifest(), "origin")
|
commands.pull(Env.get_island_path_manifest(), "origin")
|
||||||
|
|
@ -45,18 +45,18 @@ public void add_specific_arguments(_my_args, _section):
|
|||||||
public void execute(_arguments):
|
public void execute(_arguments):
|
||||||
argument_remote_name = ""
|
argument_remote_name = ""
|
||||||
for elem in _arguments:
|
for elem in _arguments:
|
||||||
if elem.getOptionName() == "remote":
|
if elem.getOptionName().equals("remote":
|
||||||
Log.info("find remote name: '" + elem.getArg() + "'")
|
Log.info("find remote name: '" + elem.getArg() + "'")
|
||||||
argument_remote_name = elem.getArg()
|
argument_remote_name = elem.getArg()
|
||||||
else:
|
else:
|
||||||
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
||||||
|
|
||||||
// check system is OK
|
// check system is OK
|
||||||
manifest.check_lutin_is_init()
|
Manifest.checkIsInit();
|
||||||
|
|
||||||
configuration = config.get_unique_config()
|
ConfigManifest configuration = Config.getUniqueConfig();
|
||||||
|
|
||||||
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:
|
if os.path.exists(file_source_manifest) == false:
|
||||||
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
||||||
mani = manifest.Manifest(file_source_manifest)
|
mani = manifest.Manifest(file_source_manifest)
|
||||||
@ -70,7 +70,7 @@ public void execute(_arguments):
|
|||||||
Log.info("push: " + base_display)
|
Log.info("push: " + base_display)
|
||||||
tools.wait_for_server_if_needed()
|
tools.wait_for_server_if_needed()
|
||||||
//Log.debug("elem : " + str(elem))
|
//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:
|
if os.path.exists(git_repo_path) == false:
|
||||||
Log.error("can not push project that not exist")
|
Log.error("can not push project that not exist")
|
||||||
continue
|
continue
|
||||||
@ -91,9 +91,9 @@ public void execute(_arguments):
|
|||||||
for elem_branch in list_branch:
|
for elem_branch in list_branch:
|
||||||
if len(elem_branch.split(" -> ")) != 1:
|
if len(elem_branch.split(" -> ")) != 1:
|
||||||
continue
|
continue
|
||||||
if elem_branch[2:10] == "remotes/":
|
if elem_branch[2:10].equals("remotes/":
|
||||||
elem_branch = elem_branch[:2] + elem_branch[10:]
|
elem_branch = elem_branch[:2] + elem_branch[10:]
|
||||||
if elem_branch[:2] == "* ":
|
if elem_branch[:2].equals("* ":
|
||||||
list_branch2.append([elem_branch[2:], true])
|
list_branch2.append([elem_branch[2:], true])
|
||||||
select_branch = elem_branch[2:]
|
select_branch = elem_branch[2:]
|
||||||
else:
|
else:
|
||||||
|
@ -1,92 +0,0 @@
|
|||||||
//!/usr/bin/python
|
|
||||||
// -*- coding: utf-8 -*-
|
|
||||||
//#
|
|
||||||
//# @author Edouard DUPIN
|
|
||||||
//#
|
|
||||||
//# @copyright 2012, Edouard DUPIN, all right reserved
|
|
||||||
//#
|
|
||||||
//# @license MPL v2.0 (see license file)
|
|
||||||
//#
|
|
||||||
|
|
||||||
from realog import Log
|
|
||||||
from island import tools
|
|
||||||
from island import env
|
|
||||||
from island import multiprocess
|
|
||||||
from island import config
|
|
||||||
from island import manifest
|
|
||||||
from island import commands
|
|
||||||
import status
|
|
||||||
import os
|
|
||||||
|
|
||||||
|
|
||||||
//#
|
|
||||||
//# @brief Get the global description of the current action
|
|
||||||
//# @return (string) the description string (fist line if reserved for the overview, all is for the specific display)
|
|
||||||
//#
|
|
||||||
public void help():
|
|
||||||
return "Get the status of all the repositories"
|
|
||||||
|
|
||||||
//#
|
|
||||||
//# @brief Add argument to the specific action
|
|
||||||
//# @param[in,out] my_args (death.Arguments) Argument manager
|
|
||||||
//# @param[in] section Name of the currect action
|
|
||||||
//#
|
|
||||||
public void 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)")
|
|
||||||
|
|
||||||
//#
|
|
||||||
//# @brief Execute the action required.
|
|
||||||
//#
|
|
||||||
//# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
|
||||||
//# None : No error (return program out 0)
|
|
||||||
//# -10 : ACTION is not existing
|
|
||||||
//# -11 : ACTION execution system error
|
|
||||||
//# -12 : ACTION Wrong parameters
|
|
||||||
//#
|
|
||||||
public void execute(_arguments):
|
|
||||||
argument_remote_name = ""
|
|
||||||
argument_display_tag = false
|
|
||||||
for elem in _arguments:
|
|
||||||
if elem.getOptionName() == "remote":
|
|
||||||
Log.info("find remote name: '" + elem.getArg() + "'")
|
|
||||||
argument_remote_name = elem.getArg()
|
|
||||||
} else if elem.getOptionName() == "tags":
|
|
||||||
argument_display_tag = true
|
|
||||||
else:
|
|
||||||
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
|
||||||
|
|
||||||
// check system is OK
|
|
||||||
manifest.check_lutin_is_init()
|
|
||||||
configuration = config.get_unique_config()
|
|
||||||
|
|
||||||
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())
|
|
||||||
if is_modify_manifest == true:
|
|
||||||
Log.info("!!!!!!!!!!!! MANIFEST is modify !!!!!!!!")
|
|
||||||
|
|
||||||
|
|
||||||
all_project = mani.get_all_configs()
|
|
||||||
Log.info("status of: " + str(len(all_project)) + " projects")
|
|
||||||
id_element = 0
|
|
||||||
|
|
||||||
elem = configuration.get_manifest_config()
|
|
||||||
base_display = tools.get_list_base_display(id_element, len(all_project), elem)
|
|
||||||
status.display_status(elem, argument_remote_name, argument_display_tag, id_element, base_display)
|
|
||||||
|
|
||||||
is_behind = false
|
|
||||||
for elem in all_project:
|
|
||||||
id_element += 1
|
|
||||||
base_display = tools.get_list_base_display(id_element, len(all_project), elem)
|
|
||||||
ret = status.display_status(elem, argument_remote_name, argument_display_tag, id_element, base_display)
|
|
||||||
if ret != None:
|
|
||||||
is_behind = true
|
|
||||||
|
|
||||||
if is_behind == true:
|
|
||||||
return env.ret_action_need_updtate
|
|
||||||
|
|
||||||
|
|
@ -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.
|
//# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||||
//# None : No error (return program out 0)
|
//# None : No error (return program out 0)
|
||||||
//# -5 : env.ret_manifest_is_not_existing : Manifest does not exit
|
//# -5 : Env.ret_manifest_is_not_existing : Manifest does not exit
|
||||||
//# -10 : env.ret_action_is_not_existing : ACTION is not existing
|
//# -10 : Env.ret_action_is_not_existing : ACTION is not existing
|
||||||
//# -11 : env.ret_action_executing_system_error : ACTION execution system error
|
//# -11 : Env.ret_action_executing_system_error : ACTION execution system error
|
||||||
//# -12 : env.ret_action_wrong_parameters : ACTION Wrong parameters
|
//# -12 : Env.ret_action_wrong_parameters : ACTION Wrong parameters
|
||||||
//# -13 : env.ret_action_partial_done : ACTION partially done
|
//# -13 : Env.ret_action_partial_done : ACTION partially done
|
||||||
//#
|
//#
|
||||||
public void execute(_arguments):
|
public void execute(_arguments):
|
||||||
reset_instead_of_rebase = false
|
reset_instead_of_rebase = false
|
||||||
for elem in _arguments:
|
for elem in _arguments:
|
||||||
if elem.getOptionName() == "rebase":
|
if elem.getOptionName().equals("rebase":
|
||||||
reset_instead_of_rebase = true
|
reset_instead_of_rebase = true
|
||||||
Log.info("==> Request reset instead of rebase")
|
Log.info("==> Request reset instead of rebase")
|
||||||
else:
|
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
|
// check system is OK
|
||||||
manifest.check_lutin_is_init()
|
Manifest.checkIsInit();
|
||||||
|
|
||||||
configuration = config.get_unique_config()
|
ConfigManifest configuration = Config.getUniqueConfig();
|
||||||
|
|
||||||
Log.info("update manifest : '" + str(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())
|
is_modify_manifest = commands.check_repository_is_modify(Env.get_island_path_manifest())
|
||||||
if is_modify_manifest == true:
|
if is_modify_manifest == true:
|
||||||
Log.warning("Manifest is modify")
|
Log.warning("Manifest is modify")
|
||||||
else:
|
else:
|
||||||
ret_track = commands.get_current_tracking_branch(env.get_island_path_manifest())
|
ret_track = commands.get_current_tracking_branch(Env.get_island_path_manifest())
|
||||||
is_forward = commands.is_forward(env.get_island_path_manifest(), ret_track)
|
is_forward = commands.is_forward(Env.get_island_path_manifest(), ret_track)
|
||||||
if is_forward == true:
|
if is_forward == true:
|
||||||
// fetch the repository
|
// 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:
|
else:
|
||||||
Log.verbose("Check behind:")
|
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:
|
if is_behind == false:
|
||||||
// fetch the repository
|
// fetch the repository
|
||||||
Log.info("sync-local: MANIFEST is up-to-date")
|
Log.info("sync-local: MANIFEST is up-to-date")
|
||||||
else:
|
else:
|
||||||
if reset_instead_of_rebase == true:
|
if reset_instead_of_rebase == true:
|
||||||
Log.info("sync-local: MANIFEST Reset to " + ret_track)
|
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:
|
else:
|
||||||
Log.info("sync-local: MANIFEST Rebase to " + ret_track)
|
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:
|
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)
|
mani = manifest.Manifest(file_source_manifest)
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ public void execute(_arguments):
|
|||||||
Log.info("----------------------------------------------------------------")
|
Log.info("----------------------------------------------------------------")
|
||||||
Log.info("sync-local: " + base_display)
|
Log.info("sync-local: " + base_display)
|
||||||
//Log.debug("elem : " + str(elem))
|
//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:
|
if os.path.exists(git_repo_path) == false:
|
||||||
// The Repository does not exist ==> Nothing to do...
|
// The Repository does not exist ==> Nothing to do...
|
||||||
Log.warning("sync-local: ==> Not download")
|
Log.warning("sync-local: ==> Not download")
|
||||||
@ -148,7 +148,7 @@ public void execute(_arguments):
|
|||||||
Log.info(" ***********************************************************")
|
Log.info(" ***********************************************************")
|
||||||
Log.info(" ** local sync partial warning on " + str(count_error) + " repository")
|
Log.info(" ** local sync partial warning on " + str(count_error) + " repository")
|
||||||
Log.info(" ***********************************************************")
|
Log.info(" ***********************************************************")
|
||||||
return env.ret_action_partial_done
|
return Env.ret_action_partial_done
|
||||||
|
|
||||||
//# Update the links:
|
//# Update the links:
|
||||||
have_error = update_links.update(configuration, mani, "sync-local")
|
have_error = update_links.update(configuration, mani, "sync-local")
|
||||||
|
@ -52,27 +52,27 @@ public void add_specific_arguments(my_args, section):
|
|||||||
public void execute(_arguments):
|
public void execute(_arguments):
|
||||||
just_download = false
|
just_download = false
|
||||||
for elem in _arguments:
|
for elem in _arguments:
|
||||||
if elem.getOptionName() == "download":
|
if elem.getOptionName().equals("download":
|
||||||
just_download = true
|
just_download = true
|
||||||
Log.info("find remote name: '" + elem.getArg() + "'")
|
Log.info("find remote name: '" + elem.getArg() + "'")
|
||||||
else:
|
else:
|
||||||
Log.error("SYNC Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
Log.error("SYNC Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
||||||
|
|
||||||
// check system is OK
|
// check system is OK
|
||||||
manifest.check_lutin_is_init()
|
Manifest.checkIsInit();
|
||||||
|
|
||||||
configuration = config.get_unique_config()
|
ConfigManifest configuration = Config.getUniqueConfig();
|
||||||
|
|
||||||
// TODO: Load Old manifect to check diff ...
|
// TODO: Load Old manifect to check diff ...
|
||||||
|
|
||||||
Log.info("update manifest : '" + str(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())
|
is_modify_manifest = commands.check_repository_is_modify(Env.get_island_path_manifest())
|
||||||
if is_modify_manifest == true:
|
if is_modify_manifest == true:
|
||||||
commands.fetch(env.get_island_path_manifest(), "origin")
|
commands.fetch(Env.get_island_path_manifest(), "origin")
|
||||||
else:
|
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:
|
if os.path.exists(file_source_manifest) == false:
|
||||||
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
Log.error("Missing manifest file : '" + str(file_source_manifest) + "'")
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ public void execute(_arguments):
|
|||||||
Log.info("sync : " + base_display)
|
Log.info("sync : " + base_display)
|
||||||
tools.wait_for_server_if_needed()
|
tools.wait_for_server_if_needed()
|
||||||
//Log.debug("elem : " + str(elem))
|
//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:
|
if elem.tag != None:
|
||||||
Log.warning("Need to select a specific tag version ... " + elem.tag)
|
Log.warning("Need to select a specific tag version ... " + elem.tag)
|
||||||
if os.path.exists(git_repo_path) == false:
|
if os.path.exists(git_repo_path) == false:
|
||||||
@ -96,7 +96,7 @@ public void execute(_arguments):
|
|||||||
address_manifest = ""
|
address_manifest = ""
|
||||||
//## example git@git.plouf.com:basic_folder
|
//## example git@git.plouf.com:basic_folder
|
||||||
address_manifest = elem.select_remote["fetch"]
|
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:
|
and len(elem.select_remote["fetch"][4:].split(":")) <= 1:
|
||||||
address_manifest += ":"
|
address_manifest += ":"
|
||||||
else:
|
else:
|
||||||
@ -114,7 +114,7 @@ public void execute(_arguments):
|
|||||||
for mirror in elem.select_remote["mirror"]:
|
for mirror in elem.select_remote["mirror"]:
|
||||||
Log.verbose("Add global mirror: " + str(mirror))
|
Log.verbose("Add global mirror: " + str(mirror))
|
||||||
cmd = "git remote add " + mirror["name"] + " " + mirror["fetch"]
|
cmd = "git remote add " + mirror["name"] + " " + mirror["fetch"]
|
||||||
if mirror["fetch"][0:4] == "git@":
|
if mirror["fetch"][0:4].equals("git@":
|
||||||
cmd += ":"
|
cmd += ":"
|
||||||
else:
|
else:
|
||||||
cmd += "/"
|
cmd += "/"
|
||||||
@ -142,7 +142,7 @@ public void execute(_arguments):
|
|||||||
continue
|
continue
|
||||||
cmd = "git submodule update"
|
cmd = "git submodule update"
|
||||||
ret = multiprocess.run_command_direct(cmd, cwd=git_repo_path)
|
ret = multiprocess.run_command_direct(cmd, cwd=git_repo_path)
|
||||||
if ret[:16] == "Submodule path '":
|
if ret[:16].equals("Submodule path '":
|
||||||
//all is good ...
|
//all is good ...
|
||||||
Log.info(" " + ret)
|
Log.info(" " + ret)
|
||||||
} else if ret != "" \
|
} else if ret != "" \
|
||||||
|
@ -45,11 +45,11 @@ public void help_example():
|
|||||||
//#
|
//#
|
||||||
//# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
//# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||||
//# None : No error (return program out 0)
|
//# None : No error (return program out 0)
|
||||||
//# -5 : env.ret_manifest_is_not_existing : Manifest does not exit
|
//# -5 : Env.ret_manifest_is_not_existing : Manifest does not exit
|
||||||
//# -10 : env.ret_action_is_not_existing : ACTION is not existing
|
//# -10 : Env.ret_action_is_not_existing : ACTION is not existing
|
||||||
//# -11 : env.ret_action_executing_system_error : ACTION execution system error
|
//# -11 : Env.ret_action_executing_system_error : ACTION execution system error
|
||||||
//# -12 : env.ret_action_wrong_parameters : ACTION Wrong parameters
|
//# -12 : Env.ret_action_wrong_parameters : ACTION Wrong parameters
|
||||||
//# -13 : env.ret_action_partial_done : ACTION partially done
|
//# -13 : Env.ret_action_partial_done : ACTION partially done
|
||||||
//#
|
//#
|
||||||
public void execute(_arguments):
|
public void execute(_arguments):
|
||||||
if len(_arguments) == 0:
|
if len(_arguments) == 0:
|
||||||
@ -59,27 +59,27 @@ public void execute(_arguments):
|
|||||||
path = ""
|
path = ""
|
||||||
address_git = ""
|
address_git = ""
|
||||||
for elem in _arguments:
|
for elem in _arguments:
|
||||||
if elem.getOptionName() == "git repository":
|
if elem.getOptionName().equals("git repository":
|
||||||
address_git = elem.getArg()
|
address_git = elem.getArg()
|
||||||
} else if elem.getOptionName() == "path":
|
} else if elem.getOptionName().equals("path":
|
||||||
path = elem.getArg()
|
path = elem.getArg()
|
||||||
else:
|
else:
|
||||||
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
||||||
|
|
||||||
if address_git == "":
|
if address_git.equals("":
|
||||||
Log.error("volatile-add: Missing git repository address", env.ret_action_wrong_parameters)
|
Log.error("volatile-add: Missing git repository address", Env.ret_action_wrong_parameters)
|
||||||
|
|
||||||
Log.info("Add 'volatile' repository: '" + address_git + "' path='" + path + "'")
|
Log.info("Add 'volatile' repository: '" + address_git + "' path='" + path + "'")
|
||||||
|
|
||||||
// check system is OK
|
// check system is OK
|
||||||
manifest.check_lutin_is_init()
|
Manifest.checkIsInit();
|
||||||
|
|
||||||
// Update the current configuration:
|
// Update the current configuration:
|
||||||
conf = config.get_unique_config()
|
conf = config.get_unique_config()
|
||||||
// TODO: Check if the local path does not exist in the manifest
|
// TODO: Check if the local path does not exist in the manifest
|
||||||
|
|
||||||
if false == conf.add_volatile(address_git, path):
|
if false == conf.add_volatile(address_git, path):
|
||||||
return env.ret_action_executing_system_error
|
return Env.ret_action_executing_system_error
|
||||||
conf.store()
|
conf.store()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -29,18 +29,18 @@ public void help():
|
|||||||
//#
|
//#
|
||||||
//# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
//# @return error value [0 .. 50] the <0 value is reserved system ==> else, what you want.
|
||||||
//# None : No error (return program out 0)
|
//# None : No error (return program out 0)
|
||||||
//# -5 : env.ret_manifest_is_not_existing : Manifest does not exit
|
//# -5 : Env.ret_manifest_is_not_existing : Manifest does not exit
|
||||||
//# -10 : env.ret_action_is_not_existing : ACTION is not existing
|
//# -10 : Env.ret_action_is_not_existing : ACTION is not existing
|
||||||
//# -11 : env.ret_action_executing_system_error : ACTION execution system error
|
//# -11 : Env.ret_action_executing_system_error : ACTION execution system error
|
||||||
//# -12 : env.ret_action_wrong_parameters : ACTION Wrong parameters
|
//# -12 : Env.ret_action_wrong_parameters : ACTION Wrong parameters
|
||||||
//# -13 : env.ret_action_partial_done : ACTION partially done
|
//# -13 : Env.ret_action_partial_done : ACTION partially done
|
||||||
//#
|
//#
|
||||||
public void execute(_arguments):
|
public void execute(_arguments):
|
||||||
for elem in _arguments:
|
for elem in _arguments:
|
||||||
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
Log.error("Wrong argument: '" + elem.getOptionName() + "' '" + elem.getArg() + "'")
|
||||||
|
|
||||||
// check system is OK
|
// check system is OK
|
||||||
manifest.check_lutin_is_init()
|
Manifest.checkIsInit();
|
||||||
|
|
||||||
conf = config.get_unique_config()
|
conf = config.get_unique_config()
|
||||||
volatiles = conf.get_volatile()
|
volatiles = conf.get_volatile()
|
||||||
|
@ -18,87 +18,6 @@ from island import commands
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
default_behind_message = "[DEV] update dev tag version"
|
|
||||||
default_update_message = "[VERSION] update dev tag version"
|
|
||||||
|
|
||||||
|
|
||||||
base_name_of_a_tagged_branch = "branch_on_tag_"
|
|
||||||
|
|
||||||
public void display_status(elem, argument_remote_name, argument_display_tag, id_element, base_display):
|
|
||||||
volatile = ""
|
|
||||||
if elem.volatile == true:
|
|
||||||
volatile = " (volatile)"
|
|
||||||
Log.verbose("status : " + base_display)
|
|
||||||
//Log.debug("elem : " + str(elem))
|
|
||||||
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
|
|
||||||
|
|
||||||
is_modify = commands.check_repository_is_modify(git_repo_path)
|
|
||||||
list_branch = commands.get_list_branch_all(git_repo_path)
|
|
||||||
select_branch = commands.get_current_branch(git_repo_path)
|
|
||||||
Log.verbose("List all branch: " + str(list_branch))
|
|
||||||
if select_branch[:len(base_name_of_a_tagged_branch)] != base_name_of_a_tagged_branch:
|
|
||||||
// get tracking branch
|
|
||||||
tracking_remote_branch = commands.get_tracking_branch(git_repo_path, argument_remote_name, select_branch)
|
|
||||||
if tracking_remote_branch == None:
|
|
||||||
Log.info(base_display + volatile + "\r\t\t\t\t\t\t\t (NO BRANCH)")
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
tracking_remote_branch = select_branch[len(base_name_of_a_tagged_branch):]
|
|
||||||
modify_status = " "
|
|
||||||
if is_modify == true:
|
|
||||||
modify_status = " *** "
|
|
||||||
|
|
||||||
Log.verbose("select branch = '" + select_branch + "' is modify : " + str(is_modify) + " track: '" + str(tracking_remote_branch) + "'")
|
|
||||||
|
|
||||||
ret_current_branch_sha1 = commands.get_revision_list_to_branch(git_repo_path, select_branch)
|
|
||||||
ret_track_branch_sha1 = commands.get_revision_list_to_branch(git_repo_path, tracking_remote_branch)
|
|
||||||
// remove all identical sha1 ==> not needed for this
|
|
||||||
in_forward = 0
|
|
||||||
for elem_sha1 in ret_current_branch_sha1:
|
|
||||||
if elem_sha1 not in ret_track_branch_sha1:
|
|
||||||
in_forward += 1
|
|
||||||
in_behind = 0
|
|
||||||
for elem_sha1 in ret_track_branch_sha1:
|
|
||||||
if elem_sha1 not in ret_current_branch_sha1:
|
|
||||||
in_behind += 1
|
|
||||||
|
|
||||||
behind_forward_comment = ""
|
|
||||||
if in_forward != 0:
|
|
||||||
behind_forward_comment += "forward=" + str(in_forward)
|
|
||||||
if in_behind != 0:
|
|
||||||
if in_forward != 0:
|
|
||||||
behind_forward_comment += " "
|
|
||||||
behind_forward_comment += "behind=" + str(in_behind)
|
|
||||||
if behind_forward_comment != "":
|
|
||||||
behind_forward_comment = "\r\t\t\t\t\t\t\t\t\t\t\t\t[" + behind_forward_comment + "]"
|
|
||||||
|
|
||||||
|
|
||||||
tags_comment = ""
|
|
||||||
// check the current tags of the repository
|
|
||||||
if argument_display_tag == true:
|
|
||||||
ret_current_tags = commands.get_tags_current(git_repo_path)
|
|
||||||
Log.verbose("tags found: " + str(ret_current_tags))
|
|
||||||
for elem_tag in ret_current_tags:
|
|
||||||
if len(tags_comment) != 0:
|
|
||||||
tags_comment += ","
|
|
||||||
tags_comment += elem_tag
|
|
||||||
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 + "]"
|
|
||||||
else:
|
|
||||||
tags_comment = "\r\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t- - - - -"
|
|
||||||
Log.info(base_display + volatile + "\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"
|
|
||||||
Log.verbose("execute : " + cmd)
|
|
||||||
ret_diff = multiprocess.run_command(cmd, cwd=git_repo_path)
|
|
||||||
tmp_color_red = "\033[31m"
|
|
||||||
tmp_color_default= "\033[00m"
|
|
||||||
Log.info(tmp_color_red + ret_diff[1] + tmp_color_default)
|
|
||||||
return in_behind
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void deliver_check(elem, argument_remote_name, id_element, base_display, source_branch, destination_branch):
|
public void deliver_check(elem, argument_remote_name, id_element, base_display, source_branch, destination_branch):
|
||||||
@ -106,7 +25,7 @@ public void deliver_check(elem, argument_remote_name, id_element, base_display,
|
|||||||
Log.debug("deliver-ckeck: " + base_display)
|
Log.debug("deliver-ckeck: " + base_display)
|
||||||
Log.debug(" ==> check repo exist")
|
Log.debug(" ==> check repo exist")
|
||||||
// Check the 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:
|
if os.path.exists(git_repo_path) == false:
|
||||||
Log.warning("deliver-ckeck: " + base_display + " ==> MUST be download")
|
Log.warning("deliver-ckeck: " + base_display + " ==> MUST be download")
|
||||||
return false
|
return false
|
||||||
@ -169,98 +88,6 @@ public void deliver_check(elem, argument_remote_name, id_element, base_display,
|
|||||||
return deliver_availlable
|
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):
|
public void get_current_version_repo(git_repo_path):
|
||||||
@ -280,10 +107,10 @@ public void get_current_version_repo(git_repo_path):
|
|||||||
valid = true
|
valid = true
|
||||||
else:
|
else:
|
||||||
Log.info("!!! Must select in range " + str(["1", "2"]))
|
Log.info("!!! Must select in range " + str(["1", "2"]))
|
||||||
if input1 == "1":
|
if input1.equals("1":
|
||||||
version_description = [0, 0, 0]
|
version_description = [0, 0, 0]
|
||||||
add_in_version_management = true
|
add_in_version_management = true
|
||||||
} else if input1 == "2":
|
} else if input1.equals("2":
|
||||||
Log.info("Continue Not managing for this repository")
|
Log.info("Continue Not managing for this repository")
|
||||||
return (None, None)
|
return (None, None)
|
||||||
else:
|
else:
|
||||||
@ -358,16 +185,16 @@ public void create_new_version_repo(git_repo_path, version_description, add_in_v
|
|||||||
version_description.append(0)
|
version_description.append(0)
|
||||||
Log.info("update version: curent: " + str(version_description))
|
Log.info("update version: curent: " + str(version_description))
|
||||||
// increment the version
|
// increment the version
|
||||||
if input1 == "1":
|
if input1.equals("1":
|
||||||
version_description[0] += 1
|
version_description[0] += 1
|
||||||
version_description[1] = 0
|
version_description[1] = 0
|
||||||
version_description[2] = 0
|
version_description[2] = 0
|
||||||
} else if input1 == "2":
|
} else if input1.equals("2":
|
||||||
version_description[1] += 1
|
version_description[1] += 1
|
||||||
version_description[2] = 0
|
version_description[2] = 0
|
||||||
} else if input1 == "3":
|
} else if input1.equals("3":
|
||||||
version_description[2] += 1
|
version_description[2] += 1
|
||||||
} else if input1 == "4":
|
} else if input1.equals("4":
|
||||||
Log.info("No release for this repository")
|
Log.info("No release for this repository")
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
@ -379,7 +206,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):
|
public void deliver_push(elem, argument_remote_name, destination_branch, source_branch, base_display):
|
||||||
// Check the 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:
|
if os.path.exists(git_repo_path) == false:
|
||||||
Log.warning("deliver-push: " + base_display + " ==> MUST be download")
|
Log.warning("deliver-push: " + base_display + " ==> MUST be download")
|
||||||
return
|
return
|
||||||
|
@ -20,7 +20,7 @@ public void update(configuration, mani, type_call):
|
|||||||
or len(mani.get_links()) != 0:
|
or len(mani.get_links()) != 0:
|
||||||
Log.info(type_call + ": remove old links ...")
|
Log.info(type_call + ": remove old links ...")
|
||||||
for elem in configuration.get_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))
|
Log.info(type_call + ": link: " + str(base_path))
|
||||||
if os.path.islink(base_path) == true:
|
if os.path.islink(base_path) == true:
|
||||||
os.unlink(base_path)
|
os.unlink(base_path)
|
||||||
@ -30,8 +30,8 @@ public void update(configuration, mani, type_call):
|
|||||||
configuration.clear_links()
|
configuration.clear_links()
|
||||||
Log.info(type_call + ": add new links ...")
|
Log.info(type_call + ": add new links ...")
|
||||||
for elem in mani.get_links():
|
for elem in mani.get_links():
|
||||||
base_path = new Path(env.get_island_root_path(), elem["destination"])
|
base_path = new Path(Env.get_island_root_path(), elem["destination"])
|
||||||
source_path = new Path(env.get_island_root_path(), elem["source"])
|
source_path = new Path(Env.get_island_root_path(), elem["source"])
|
||||||
Log.info(type_call + ": link: " + str(base_path))
|
Log.info(type_call + ": link: " + str(base_path))
|
||||||
if os.path.exists(base_path) == true:
|
if os.path.exists(base_path) == true:
|
||||||
Log.error(type_call + ": create link is not possible ==> path already exist", crash=false)
|
Log.error(type_call + ": create link is not possible ==> path already exist", crash=false)
|
||||||
|
@ -53,11 +53,11 @@ public void get_list_branch_meta(path_repository):
|
|||||||
if len(elem_branch.split(" -> ")) != 1:
|
if len(elem_branch.split(" -> ")) != 1:
|
||||||
continue
|
continue
|
||||||
// separate the remote element
|
// 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:]
|
elem_branch = elem_branch[:2] + elem_branch[10:]
|
||||||
is_remote = true
|
is_remote = true
|
||||||
// separate select branch
|
// separate select branch
|
||||||
if elem_branch[:2] == "* ":
|
if elem_branch[:2].equals("* ":
|
||||||
is_selected = true
|
is_selected = true
|
||||||
branch_name = elem_branch[2:]
|
branch_name = elem_branch[2:]
|
||||||
else:
|
else:
|
||||||
@ -79,23 +79,6 @@ public void get_list_branch_all(path_repository):
|
|||||||
Log.verbose("List all branch: " + str(out))
|
Log.verbose("List all branch: " + str(out))
|
||||||
return out
|
return out
|
||||||
|
|
||||||
public void get_list_branch_local(path_repository):
|
|
||||||
tmp = get_list_branch_meta(path_repository)
|
|
||||||
out = []
|
|
||||||
for elem in tmp:
|
|
||||||
if elem["remote"] == false:
|
|
||||||
out.append(elem["name"])
|
|
||||||
Log.verbose("List local branch: " + str(out))
|
|
||||||
return out
|
|
||||||
|
|
||||||
public void get_list_branch_remote(path_repository):
|
|
||||||
tmp = get_list_branch_meta(path_repository)
|
|
||||||
out = []
|
|
||||||
for elem in tmp:
|
|
||||||
if elem["remote"] == true:
|
|
||||||
out.append(elem["name"])
|
|
||||||
Log.verbose("List remote branch: " + str(out))
|
|
||||||
return out
|
|
||||||
|
|
||||||
public void get_current_branch(path_repository):
|
public void get_current_branch(path_repository):
|
||||||
tmp = get_list_branch_meta(path_repository)
|
tmp = get_list_branch_meta(path_repository)
|
||||||
@ -106,26 +89,10 @@ public void get_current_branch(path_repository):
|
|||||||
Log.verbose("List local branch: None" )
|
Log.verbose("List local branch: None" )
|
||||||
return None
|
return None
|
||||||
|
|
||||||
public void get_current_tracking_branch(path_repository):
|
|
||||||
// get tracking branch
|
|
||||||
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}":
|
|
||||||
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)
|
|
||||||
return return_value[1]
|
|
||||||
|
|
||||||
public void get_revision_list_to_branch(path_repository, branch):
|
|
||||||
cmd = "git rev-list " + branch
|
|
||||||
Log.verbose("execute : " + cmd)
|
|
||||||
return_value = multiprocess.run_command(cmd, cwd=path_repository)
|
|
||||||
multiprocess.generic_display_error(return_value, "get_revision_list_to_branch", error_only=true)
|
|
||||||
return return_value[1].split('\n')
|
|
||||||
|
|
||||||
public void get_specific_commit_message(path_repository, sha_1):
|
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 ""
|
return ""
|
||||||
cmd = "git log --format=%B -n 1 " + sha_1
|
cmd = "git log --format=%B -n 1 " + sha_1
|
||||||
Log.verbose("execute : " + cmd)
|
Log.verbose("execute : " + cmd)
|
||||||
@ -134,7 +101,7 @@ public void get_specific_commit_message(path_repository, sha_1):
|
|||||||
return return_value[1].split('\n')[0]
|
return return_value[1].split('\n')[0]
|
||||||
|
|
||||||
public void get_sha1_for_branch(path_repository, branch_name):
|
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
|
return None
|
||||||
cmd = "git rev-parse " + branch_name
|
cmd = "git rev-parse " + branch_name
|
||||||
Log.verbose("execute : " + cmd)
|
Log.verbose("execute : " + cmd)
|
||||||
@ -143,26 +110,10 @@ public void get_sha1_for_branch(path_repository, branch_name):
|
|||||||
return return_value[1].split('\n')[0]
|
return return_value[1].split('\n')[0]
|
||||||
|
|
||||||
|
|
||||||
public void get_tags_current(path_repository):
|
|
||||||
cmd = "git tag --points-at"
|
|
||||||
Log.verbose("execute : " + cmd)
|
|
||||||
return_value = multiprocess.run_command(cmd, cwd=path_repository)
|
|
||||||
multiprocess.generic_display_error(return_value, "get_tags_current", error_only=true)
|
|
||||||
list_tags = []
|
|
||||||
for elem in return_value[1].split('\n'):
|
|
||||||
if elem != "":
|
|
||||||
list_tags.append(elem)
|
|
||||||
return list_tags
|
|
||||||
|
|
||||||
public void get_tags(path_repository):
|
|
||||||
cmd = "git tag"
|
|
||||||
Log.verbose("execute : " + cmd)
|
|
||||||
return_value = multiprocess.run_command(cmd, cwd=path_repository)
|
|
||||||
multiprocess.generic_display_error(return_value, "get_tags", error_only=true)
|
|
||||||
return return_value[1].split('\n')
|
|
||||||
|
|
||||||
public void get_tags_remote(path_repository, remote_name):
|
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)
|
return get_current_tracking_branch(path_repository)
|
||||||
cmd = "git ls-remote --tags " + remote_name
|
cmd = "git ls-remote --tags " + remote_name
|
||||||
Log.verbose("execute : " + cmd)
|
Log.verbose("execute : " + cmd)
|
||||||
@ -180,29 +131,19 @@ public void get_tags_remote(path_repository, remote_name):
|
|||||||
cut = elem.split("\t")
|
cut = elem.split("\t")
|
||||||
if len(cut) != 2:
|
if len(cut) != 2:
|
||||||
continue
|
continue
|
||||||
if cut[1][-3:] == "^{}":
|
if cut[1][-3:].equals("^{}":
|
||||||
// specific usage for the annotated commit
|
// specific usage for the annotated commit
|
||||||
continue
|
continue
|
||||||
if cut[1][:10] == "refs/tags/":
|
if cut[1][:10].equals("refs/tags/":
|
||||||
out.append(cut[1][10:])
|
out.append(cut[1][10:])
|
||||||
else:
|
else:
|
||||||
out.append(cut[1])
|
out.append(cut[1])
|
||||||
return out
|
return out
|
||||||
|
|
||||||
public void get_tracking_branch(path_repository, remote_name, select_branch):
|
|
||||||
// get tracking branch
|
|
||||||
if remote_name == "" 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))
|
|
||||||
if remote_name + "/" + select_branch not in list_branch_remote:
|
|
||||||
Log.debug(" ==> can not get remote branch")
|
|
||||||
return None
|
|
||||||
return remote_name + "/" + select_branch
|
|
||||||
|
|
||||||
|
|
||||||
public void merge_branch_on_master(path_repository, branch_name, merge_force=true, branch_destination = "master"):
|
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"
|
raise "Missing branch name"
|
||||||
cmd = "git merge "
|
cmd = "git merge "
|
||||||
if merge_force == true:
|
if merge_force == true:
|
||||||
@ -216,7 +157,7 @@ public void merge_branch_on_master(path_repository, branch_name, merge_force=tru
|
|||||||
|
|
||||||
|
|
||||||
public void add_file(path_repository, file_path):
|
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"
|
raise "Missing file_path name"
|
||||||
cmd = "git add " + file_path
|
cmd = "git add " + file_path
|
||||||
Log.verbose("execute : " + cmd)
|
Log.verbose("execute : " + cmd)
|
||||||
@ -227,7 +168,7 @@ public void add_file(path_repository, file_path):
|
|||||||
|
|
||||||
|
|
||||||
public void commit_all(path_repository, comment):
|
public void commit_all(path_repository, comment):
|
||||||
if comment == None or comment == "":
|
if comment == None or comment.equals("":
|
||||||
raise "Missing comment description"
|
raise "Missing comment description"
|
||||||
cmd = 'git commit -a --message "' + comment +'"'
|
cmd = 'git commit -a --message "' + comment +'"'
|
||||||
Log.verbose("execute : " + cmd)
|
Log.verbose("execute : " + cmd)
|
||||||
@ -237,7 +178,7 @@ public void commit_all(path_repository, comment):
|
|||||||
return return_value
|
return return_value
|
||||||
|
|
||||||
public void tag(path_repository, tag_name):
|
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"
|
raise "Missing tag name"
|
||||||
tag_name = tag_name.replace(" ", "_")
|
tag_name = tag_name.replace(" ", "_")
|
||||||
cmd = 'git tag ' + tag_name + ' --message "[TAG] create tag ' + tag_name +'"'
|
cmd = 'git tag ' + tag_name + ' --message "[TAG] create tag ' + tag_name +'"'
|
||||||
@ -248,7 +189,7 @@ public void tag(path_repository, tag_name):
|
|||||||
return return_value
|
return return_value
|
||||||
|
|
||||||
public void checkout(path_repository, branch_name):
|
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"
|
raise "Missing branch name"
|
||||||
cmd = 'git checkout ' + branch_name
|
cmd = 'git checkout ' + branch_name
|
||||||
Log.verbose("execute : " + cmd)
|
Log.verbose("execute : " + cmd)
|
||||||
@ -258,7 +199,7 @@ public void checkout(path_repository, branch_name):
|
|||||||
return return_value
|
return return_value
|
||||||
|
|
||||||
public void reset_hard(path_repository, destination):
|
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'"
|
raise "Missing destination 'sha1' or 'branch name'"
|
||||||
cmd = 'git reset --hard ' + destination
|
cmd = 'git reset --hard ' + destination
|
||||||
Log.verbose("execute : " + cmd)
|
Log.verbose("execute : " + cmd)
|
||||||
@ -268,7 +209,7 @@ public void reset_hard(path_repository, destination):
|
|||||||
return return_value
|
return return_value
|
||||||
|
|
||||||
public void rebase(path_repository, destination):
|
public void rebase(path_repository, destination):
|
||||||
if destination == None or destination == "":
|
if destination == None or destination.equals("":
|
||||||
raise "Missing destination 'sha1' or 'branch name'"
|
raise "Missing destination 'sha1' or 'branch name'"
|
||||||
cmd = 'git rebase ' + destination
|
cmd = 'git rebase ' + destination
|
||||||
Log.verbose("execute : " + cmd)
|
Log.verbose("execute : " + cmd)
|
||||||
@ -279,12 +220,12 @@ public void rebase(path_repository, destination):
|
|||||||
|
|
||||||
|
|
||||||
public void clone(path_repository, address, branch_name = None, origin=None):
|
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"
|
raise "Missing address"
|
||||||
cmd = 'git clone ' + address
|
cmd = 'git clone ' + address
|
||||||
if branch_name != None and branch_name == "":
|
if branch_name != None and branch_name.equals("":
|
||||||
cmd += " --branch " + branch_name
|
cmd += " --branch " + branch_name
|
||||||
if origin != None and origin == "":
|
if origin != None and origin.equals("":
|
||||||
cmd += " --origin " + origin
|
cmd += " --origin " + origin
|
||||||
if path_repository != None and path_repository != "":
|
if path_repository != None and path_repository != "":
|
||||||
cmd += " " + path_repository
|
cmd += " " + path_repository
|
||||||
@ -307,7 +248,7 @@ public void fetch(path_repository, remote_name, prune=true):
|
|||||||
return return_value
|
return return_value
|
||||||
|
|
||||||
public void pull(path_repository, remote_name, prune=true):
|
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"
|
raise "Missing remote_name"
|
||||||
cmd = 'git pull ' + remote_name
|
cmd = 'git pull ' + remote_name
|
||||||
if prune == true:
|
if prune == true:
|
||||||
@ -318,7 +259,7 @@ public void pull(path_repository, remote_name, prune=true):
|
|||||||
return return_value
|
return return_value
|
||||||
|
|
||||||
public void push(path_repository, remote_name, elements):
|
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"
|
raise "Missing remote_name"
|
||||||
if len(elements) == 0:
|
if len(elements) == 0:
|
||||||
raise "No elements to push on server"
|
raise "No elements to push on server"
|
||||||
@ -337,7 +278,7 @@ public void submodule_sync(path_repository, remote_name):
|
|||||||
return_value = multiprocess.run_command(cmd, cwd=path_repository)
|
return_value = multiprocess.run_command(cmd, cwd=path_repository)
|
||||||
multiprocess.generic_display_error(return_value, "submodule_sync")
|
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 ...
|
//all is good ...
|
||||||
Log.info(" " + ret)
|
Log.info(" " + ret)
|
||||||
} else if ret != "" \
|
} else if ret != "" \
|
||||||
@ -350,7 +291,7 @@ public void submodule_sync(path_repository, remote_name):
|
|||||||
|
|
||||||
|
|
||||||
public void get_forward(path_repository, branch_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"
|
raise "get_fast_forward: Missing branch_name"
|
||||||
select_branch = get_current_branch(path_repository)
|
select_branch = get_current_branch(path_repository)
|
||||||
// get tracking branch
|
// get tracking branch
|
||||||
@ -369,7 +310,7 @@ public void is_forward(path_repository, branch_name):
|
|||||||
|
|
||||||
|
|
||||||
public void get_behind(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"
|
raise "get_fast_forward: Missing branch_name"
|
||||||
select_branch = get_current_branch(path_repository)
|
select_branch = get_current_branch(path_repository)
|
||||||
// get tracking branch
|
// get tracking branch
|
||||||
|
@ -13,11 +13,11 @@ import sys
|
|||||||
from realog import Log
|
from realog import Log
|
||||||
|
|
||||||
// print os.name # ==> 'posix'
|
// print os.name # ==> 'posix'
|
||||||
if platform.system() == "Linux":
|
if platform.system().equals("Linux":
|
||||||
OS = "Linux"
|
OS = "Linux"
|
||||||
} else if platform.system() == "Windows":
|
} else if platform.system().equals("Windows":
|
||||||
OS = "Windows"
|
OS = "Windows"
|
||||||
} else if platform.system() == "Darwin":
|
} else if platform.system().equals("Darwin":
|
||||||
OS = "MacOs"
|
OS = "MacOs"
|
||||||
else:
|
else:
|
||||||
Log.error("Unknow the Host OS ... '" + platform.system() + "'")
|
Log.error("Unknow the Host OS ... '" + platform.system() + "'")
|
||||||
|
@ -29,7 +29,7 @@ class RepoConfig():
|
|||||||
public void split_repo(git_repo):
|
public void split_repo(git_repo):
|
||||||
Log.verbose("parse git repo in RAW: " + str(git_repo))
|
Log.verbose("parse git repo in RAW: " + str(git_repo))
|
||||||
if len(git_repo) > 4 \
|
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
|
// http://wdfqsdfqs@qsdfqsdf/qsdfqsdf/qsdfqsdf/qsdfqs.git find the 3rd '/' and cut at this point
|
||||||
elements = git_repo.split('/')
|
elements = git_repo.split('/')
|
||||||
if len(elements) < 4:
|
if len(elements) < 4:
|
||||||
@ -37,7 +37,7 @@ public void split_repo(git_repo):
|
|||||||
base = elements[0] + "/" + elements[1] + "/" + elements[2]
|
base = elements[0] + "/" + elements[1] + "/" + elements[2]
|
||||||
repo = git_repo[len(base)+1:]
|
repo = git_repo[len(base)+1:]
|
||||||
} else if len(git_repo) > 3 \
|
} 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
|
// git@qsdfqsdf:qsdfqsdf/qsdfqsdf/qsdfqs.git find the 1st ':' and cut at this point
|
||||||
elements = git_repo.split(':')
|
elements = git_repo.split(':')
|
||||||
if len(elements) < 2:
|
if len(elements) < 2:
|
||||||
|
@ -96,7 +96,7 @@ public void version_to_string(version):
|
|||||||
public void version_string_to_list(version):
|
public void version_string_to_list(version):
|
||||||
Log.verbose("parse version string '" + version +"'")
|
Log.verbose("parse version string '" + version +"'")
|
||||||
out = []
|
out = []
|
||||||
if version == "":
|
if version.equals("":
|
||||||
return [0, 0, 0]
|
return [0, 0, 0]
|
||||||
elems = version.split("-")
|
elems = version.split("-")
|
||||||
if len(elems[0].split(".")) <= 1:
|
if len(elems[0].split(".")) <= 1:
|
||||||
@ -154,7 +154,7 @@ public void add_prefix(prefix,list):
|
|||||||
|
|
||||||
public void store_command(cmd_line, file):
|
public void store_command(cmd_line, file):
|
||||||
// write cmd line only after to prevent errors ...
|
// write cmd line only after to prevent errors ...
|
||||||
if file == "" \
|
if file.equals("" \
|
||||||
or file == None:
|
or file == None:
|
||||||
return;
|
return;
|
||||||
Log.verbose("create cmd file: " + file)
|
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'):
|
for elem in file_data.split('\n'):
|
||||||
if len(elem) == 0:
|
if len(elem) == 0:
|
||||||
continue
|
continue
|
||||||
if elem[0] == "//":
|
if elem[0].equals("//":
|
||||||
// comment ...
|
// comment ...
|
||||||
continue
|
continue
|
||||||
out.append(elem)
|
out.append(elem)
|
||||||
@ -297,12 +297,6 @@ public void remove_element(data, to_remove):
|
|||||||
return out;
|
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
|
is_first_time_sleep = true
|
||||||
|
|
||||||
public void wait_for_server_if_needed():
|
public void wait_for_server_if_needed():
|
||||||
@ -310,9 +304,9 @@ public void wait_for_server_if_needed():
|
|||||||
if is_first_time_sleep == false:
|
if is_first_time_sleep == false:
|
||||||
is_first_time_sleep = true;
|
is_first_time_sleep = true;
|
||||||
return
|
return
|
||||||
if env.get_wait_between_sever_command() != 0:
|
if Env.get_wait_between_sever_command() != 0:
|
||||||
Log.info("Wait for server contrition (" + str(env.get_wait_between_sever_command()) + " s)")
|
Log.info("Wait for server contrition (" + str(Env.get_wait_between_sever_command()) + " s)")
|
||||||
time.sleep(env.get_wait_between_sever_command())
|
time.sleep(Env.get_wait_between_sever_command())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user