island/tmpsrc/actions/islandAction_status.java

93 lines
3.0 KiB
Java

//!/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 debug
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.get_option_name() == "remote":
debug.info("find remote name: '" + elem.get_arg() + "'")
argument_remote_name = elem.get_arg()
elif elem.get_option_name() == "tags":
argument_display_tag = true
else:
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
// 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:
debug.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:
debug.info("!!!!!!!!!!!! MANIFEST is modify !!!!!!!!")
all_project = mani.get_all_configs()
debug.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