def links_usage(self): printf.printf(3, "Usage:\n" + "links.py " + "[options]") printf.printf(3, ''' Options: -h | --help print help info -s source folder -d link folder ''')
def mk_chk_ini_usage(self): printf.printf(3, "Usage:\n" + "mk_chk_ini.py " + "[options]") printf.printf(3, ''' Options: -h | --help print help info -p path for git repos(folder) -f output file -m clone at mirror(default normal clone) ''')
def check_usage(self): printf.printf(3, "Usage:\n" + "check.py " + "[options]") printf.printf(3, ''' Options: -h | --help print help info -f ini file path -l list all repos -o checkout the repos ''')
def upload_usage(self): printf.printf(3, "Usage:\n" + "upload.py " + "[options]") printf.printf(3, ''' Options: -h | --help help info -f file path - must -l list all repos -n repos name(default is server) ''')
def check_usage(self): printf.printf(3, "Usage:\n" + "check.py " + "[options]") printf.printf(3, ''' Options: -h | --help help info -f file path - must -l list all repos -o only checkout the repos: -o [1,2,3 ...] -u update(default without it) ''')
def git_add_remote_usage(self): printf.printf(3, "Usage:\n" + "git_add_remote.py " + "[options]") printf.printf(3, ''' Options: -h | --help print help info -u new url -p print ini(use for gitosis.conf) -n server name(default is server) example: git_add_remote.py -u [email protected]:github/ -n server ''')
def build_usage(self): printf.printf(3, "Usage:\n" + "build.py " + "[options]") printf.printf(3, ''' Options: -h | --help print help info -c make clean -m make -i make install -x make others,此参数只能唯一存在 default make clean, make, make install ''')
def patch_usage(self): printf.printf(3, "Usage:\n" + "patch.py " + "[options]") printf.printf(3, ''' Options: -h | --help print help info -f ini file path -a action: 0 - do patch 1 - undo patch 2 - create patch -u patch for untrack files, default without it ''')
def repos_usage(self, repos): printf.printf(3, "Usage:\n" + repos + ".py " + "[options]") printf.printf(3, ''' Options: -h | --help print help info -m list modify files -d list delete files -o list others files -c clean all repos at current path -b backup all repost -s repos status ''')
def repos_usage(self, repos): printf.printf(3, "Usage:\n" + repos + ".py " + "[options]") printf.printf(3, ''' Options: -h | --help print help info -m list modify files -d list delete files -o list others files -b backup all repost -s repos status -r revert repos -p Path name (folder) ''')
def patch_usage(self): printf.printf(3, "Usage:\n" + "patch.py " + "[options]") printf.printf(3, ''' Options: -h | --help print help info -f ini file path -a action: 0 - do patch 1 - undo patch 2 - create patch -u patch for untrack files, default without it -l list all projects for patch -o only patch the project: -o [1,2,3 ...] ''')
def build_usage(self): printf.printf(3, "Usage:\n" + "build.py " + "[options]") printf.printf(3, ''' Options: -h | --help print help info -f ini file path(default: build.ini) -c make clean -m make -i make install -x make others target in Makefile -l list all projects for build -o only make the project: -o [1,2,3 ...] default make clean, make, make install ''')
def main(): git_args = arg.repos_args("git") if git_args['-p'] != "": path.push() path.change(git_args['-p']) if git_args['-m'] == "true": os.system("git status -s | grep '^ M' | awk '{print $2}'") elif git_args['-d'] == "true": os.system("git status -s | grep '^ D' | awk '{print $2}'") elif git_args['-o'] == "true": os.system("git status -s -u | grep '^??' | awk '{print $2}'") #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ elif git_args['-b'] == "true": printf.reset() printf.status("repos backup") current_path = os.getcwd() if(os.path.exists(".git")): printf.status("Top at git repos") else: n = 1 for r in os.walk(current_path).next()[1]: printf.silence("\n" + "+"*80) printf.silence(str(n) + " - " + r) path.change(current_path + "/" + r) n = n + 1 if(not os.path.exists(".git")): printf.warn("Not a git repos - " + r) path.change(current_path) continue rev = os.popen("git rev-parse HEAD").read().split("\n")[0] path.change(current_path) # tar the repos tar = r + "." + rev + ".tar.bz2" if(not os.path.isfile(tar)): cmd.do("tar -jcf " + tar + " " + r) #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ elif git_args['-s'] == "true": #printf.reset() printf.status("repos status") current_path = os.getcwd() if(os.path.exists(".git")): printf.silence("\n" + "+"*80) printf.silence(current_path) cmd.do("git status -su") else: n = 1 for root, dirs, files in os.walk(current_path): if '.git' in dirs: del dirs[:] printf.silence("\n" + "+"*80) printf.silence(str(n) + " - " + root) n = n + 1 path.change(root) info = os.popen("git status -s | grep '^ M' | awk '{print $2}'").read() if(info != ""): printf.silence("-m:") printf.printf(1, info) info = os.popen("git status -s | grep '^ D' | awk '{print $2}'").read() if(info != ""): printf.silence("-d:") printf.printf(1, info) info = os.popen("git status -su | grep '^??' | awk '{print $2}'").read() if(info != ""): printf.silence("-o:") printf.printf(1, info) cmd.do("git status -su") path.change(current_path) #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ elif git_args['-r'] == "true": printf.reset() printf.status("repos revert") current_path = os.getcwd() if(os.path.exists(".git")): revert() else: n = 1 for r in os.walk(current_path).next()[1]: printf.silence("\n" + "+"*80) printf.silence(str(n) + " - " + r) path.change(current_path + "/" + r) revert() path.change(current_path) n = n + 1 if git_args['-p'] != "": path.pop() sys.exit(0)