[Frugalware-darcs] vmexam: implemented changes subcommand

VMiklos vmiklos at frugalware.org
Thu Jun 14 01:54:15 CEST 2007


Darcsweb-Url: http://darcs.frugalware.org/darcsweb/darcsweb.cgi?r=vmexam;a=darcs_commitdiff;h=20070613235034-e2957-5cb2d8b32651f6e1ffc1f4ea270dd2fa5732a450.gz;

[implemented changes subcommand
VMiklos <vmiklos at frugalware.org>**20070613235034
 mainly uses git log
] {
hunk ./python/dg.py 193
+			optind += 1
hunk ./python/dg.py 371
+def changes(argv):
+	def usage(ret):
+		print """Usage: darcs changes [OPTION]... [FILE or DIRECTORY]...
+Gives a changelog-style summary of the branch history.
+
+Options:
+  -l         --last=NUMBER         select the last NUMBER patches
+  -s         --summary             summarize changes
+  -v         --verbose             give verbose output
+  -h         --help                shows brief description of command and its arguments"""
+		sys.exit(ret)
+
+	class Options:
+		def __init__(self):
+			self.last = ""
+			self.logopts = ""
+			self.help = False
+			self.files = ""
+	options = Options()
+
+	try:
+		opts, args = getopt.getopt(argv, "l:svh", ["last=", "summary", "verbose", "help"])
+	except getopt.GetoptError:
+		usage(1)
+	optind = 0
+	for opt, arg in opts:
+		if opt in ("-l", "--last"):
+			options.last = "-%s" % arg
+			optind += 1
+		elif opt in ("-s", "--summary"):
+			options.logopts = "--name-status"
+		elif opt in ("-v", "--verbose"):
+			options.logopts = "-p"
+		elif opt in ("-h", "--help"):
+			options.help = True
+		optind += 1
+	if optind < len(argv):
+		options.files = " ".join(argv[optind:])
+	if options.help:
+		usage(0)
+	return os.system("git log -M %s %s %s" % (options.last, options.logopts, options.files))
+
hunk ./python/dg.py 423
+		elif sys.argv[1][:4] == "chan":
+			changes(argv[1:])
}


More information about the Frugalware-darcs mailing list