Exemplo n.º 1
0
def main():

	svn_args = arg.repos_args("svn")
	if svn_args == "-m":
		os.system("svn st | grep '^M' | awk '{print $2}'")
	elif svn_args == "-d":
		os.system("svn st | grep '^!' | awk '{print $2}'")
	elif svn_args == "-o":
		os.system("svn st | grep '^?' | awk '{print $2}'")
	# Clean all svn repos at current path
	elif svn_args == "-c":
		current_path = os.getcwd()
		for r in os.walk(current_path).next()[1]:
			rev = os.popen("svn info " + r + " | awk '/Revision:/ { print $2 }'").read()
			rev = "-svn" + rev.split("\n")[0]			
			# patch backup
			cmd.tryit("svn st " + r + " | grep '^M' | awk '{print $2}' | xargs svn revert ")
			cmd.tryit("svn st " + r + " | grep '^?' | awk '{print $2}' | xargs rm -rf ")
			cmd.tryit("find "   + r + " -name \"*.o\" | xargs rm -f")
			cmd.tryit("svn up " + r)
	# backup all svn repos at current path
	elif svn_args == "-b":
		current_path = os.getcwd()
		for r in os.walk(current_path).next()[1]:
			rev = os.popen("svn info " + r + " | awk '/Revision:/ { print $2 }'").read()
			rev = "-svn" + rev.split("\n")[0]
			cmd.tryit("tar -jcf " + r + rev + ".tar.bz2 " + r)
	elif svn_args == "-s":
		printf.status("svn info")
		os.system("svn info")

	sys.exit(0)
Exemplo n.º 2
0
def main():

	svn_args = arg.repos_args("git")
	if svn_args == "-m":
		os.system("git status -s | grep '^ M' | awk '{print $2}'")
	elif svn_args == "-d":
		os.system("git status -s | grep '^ D' | awk '{print $2}'")
	elif svn_args == "-o":
		os.system("git status -s | grep '^??' | awk '{print $2}'")	
	elif svn_args == "-s":
		printf.status("Remote URL:")
		os.system("git remote -v")
		printf.status("Remote Branches: ")
		os.system("git branch -r")
		if os.path.isfile(".git/config"):
			printf.status("== Configuration .git/config")
			os.system("cat .git/config")
		printf.status("== Most Recent Commit")
		os.system("git --no-pager log --max-count=1")

	sys.exit(0)
Exemplo n.º 3
0
def main():
	svn_args = arg.repos_args("svn")

	if svn_args['-p'] != "":
		path.push()
		path.change(svn_args['-p'])	
	
	if svn_args['-m'] == "true":
		os.system("svn st --no-ignore | grep '^M' | awk '{print $2}'")
	elif svn_args['-d'] == "true":
		os.system("svn st --no-ignore | grep '^!' | awk '{print $2}'")
	elif svn_args['-o'] == "true":
		os.system("svn st --no-ignore | grep '^?' | awk '{print $2}'")
	# Clean all svn repos at current path
	elif svn_args['-r'] == "true":
		current_path = os.getcwd()
		for r in os.walk(current_path).next()[1]:
			rev = os.popen("svn info " + r + " | awk '/Revision:/ { print $2 }'").read()
			rev = "-svn" + rev.split("\n")[0]			
			# patch backup
			cmd.tryit("svn st --no-ignore " + r + " | grep '^M' | awk '{print $2}' | xargs svn revert ")
			cmd.tryit("svn st --no-ignore " + r + " | grep '^?' | awk '{print $2}' | xargs rm -rf ")
			cmd.tryit("find "   + r + " -name \"*.o\" | xargs rm -f")
			cmd.tryit("svn up " + r)
	# backup all svn repos at current path
	elif svn_args['-b'] == "true":
		current_path = os.getcwd()
		for r in os.walk(current_path).next()[1]:
			rev = os.popen("svn info " + r + " | awk '/Revision:/ { print $2 }'").read()
			rev = "-svn" + rev.split("\n")[0]
			cmd.tryit("tar -jcf " + r + rev + ".tar.bz2 " + r)
	elif svn_args == "-s":
		printf.status("svn info")
		os.system("svn info")

	if svn_args['-p'] != "":
		path.pop()
	sys.exit(0)
Exemplo n.º 4
0
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)