def on_cmd_branch(args, branch_functions): if len(args) < 1: cmd = "help" else: cmd = args[0] try: if cmd == "start": if len(args) < 2: raise Exception("Release name must be specified.") branch_functions["start"](args[1]) elif cmd == "finish": if len(args) < 2: raise Exception("Release name must be specified.") branch_functions["finish"](args[1]) elif cmd == "list": branch_functions["list"]() elif cmd == "help": branch_functions["help"]() else: raise Exception("Unknown command: " + cmd) except Exception, e: console_utils.print_error(str(e)) branch_functions["help"]()
def main(): retval = 0 opt_parser = OptionParser() (options, args) = opt_parser.parse_args() if len(args) > 0: try: svn_flow = SvnFlow() process_commands(args, svn_flow) except Exception, e: console_utils.print_error(str(e)) print_usage()
def __test_dir(self, dir_path): retval = 0 try: self.__raise_if_dir_invalid(dir_path) self.__raise_if_not_exists(dir_path) log(dir_path + " [" + console_utils.text_green("OK") \ + "]") except Exception, e: log(dir_path + " [" + console_utils.text_red("FAIL") \ + "]") console_utils.print_error(str(e)) retval = 1
def main(): opt_parser = OptionParser() opt_parser.add_option("-l", "--last-tag", \ help = "Show only last tag name.", action = "store_true") (options, args) = opt_parser.parse_args(); try: svn_base_dir = svn_utils.find_svn_root_path() tags_dir = find_tags_dir(svn_base_dir) tags = find_tags(tags_dir) tags = sort_tags_desc(tags) if options.last_tag: print tags[0]["name"] else: print_tags(tags) except Exception, e: console_utils.print_error(str(e))
def main(): opt_parser = OptionParser() opt_parser.add_option("-l", "--last-tag", \ help = "Show only last tag name.", action = "store_true") (options, args) = opt_parser.parse_args() try: svn_base_dir = svn_utils.find_svn_root_path() tags_dir = find_tags_dir(svn_base_dir) tags = find_tags(tags_dir) tags = sort_tags_desc(tags) if options.last_tag: print tags[0]["name"] else: print_tags(tags) except Exception, e: console_utils.print_error(str(e))
def process_commands(args, svn_flow): cmd = args[0] if cmd == "init": svn_flow.init() elif cmd == "test": retval = svn_flow.test() elif cmd == "feature": funcs = {"start" : svn_flow.feature_start, \ "finish" : svn_flow.feature_finish, \ "list" : svn_flow.feature_list,\ "help" : on_cmd_feature_help} on_cmd_branch(args[1:], funcs) elif cmd == "release": funcs = {"start" : svn_flow.release_start, \ "finish" : svn_flow.release_finish, \ "list" : svn_flow.release_list,\ "help" : on_cmd_release_help} on_cmd_branch(args[1:], funcs) elif cmd == "hotfix": funcs = {"start" : svn_flow.hotfix_start, \ "finish" : svn_flow.hotfix_finish, \ "list" : svn_flow.hotfix_list,\ "help" : on_cmd_hotfix_help} on_cmd_branch(args[1:], funcs) elif cmd == "branches": svn_flow.feature_list() svn_flow.release_list() svn_flow.hotfix_list() else: retval = 1 console_utils.print_error("Unknown command: " + cmd)