[Frugalware-darcs] vmexam: dg: new wrapper unrec -> git reset --soft HEAD^

VMiklos vmiklos at frugalware.org
Thu Jun 14 02:55:07 CEST 2007


Darcsweb-Url: http://darcs.frugalware.org/darcsweb/darcsweb.cgi?r=vmexam;a=darcs_commitdiff;h=20070614003734-e2957-9ccc0b9d194b7c5929a45f318d708a9170142977.gz;

[dg: new wrapper unrec -> git reset --soft HEAD^
VMiklos <vmiklos at frugalware.org>**20070614003734
 ask before doing anything as this will delete the commit log
] {
hunk ./python/dg.py 437
-	else:
-		return os.system("git revert %s" % " ".join(argv))
+	return os.system("git revert %s" % " ".join(argv))
+
+def unrecord(argv):
+	def usage(ret):
+		print """Usage: darcs-git unrecord [OPTION]...
+Remove last committed patch without changing the working directory.
+This is an alias for "git reset --soft HEAD^".
+
+Options:
+  -h         --help                shows brief description of command and its arguments"""
+		sys.exit(ret)
+	if len(argv) and argv[0] in ("-h", "--help"):
+		usage(0)
+	while True:
+		ret = ask("Do you want to unrecord the last committed patch? [ynq]")
+		if ret == "y":
+			break
+		if ret in ("n", "q"):
+			sys.exit(0)
+		print "Invalid response, try again!"
+	return os.system("git reset --soft HEAD^ %s" % " ".join(argv))
hunk ./python/dg.py 475
+		elif sys.argv[1][:5] == "unrec":
+			unrecord(argv[1:])
}


More information about the Frugalware-darcs mailing list