summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2010-07-09 16:43:26 -0400
committerColin Walters <walters@verbum.org>2010-07-09 16:43:26 -0400
commit442f77df901d46e24abac33a76b99c1fb828638d (patch)
treed1125e5e68e40dab590ba7d228dc92605e2e2121
parent862c92d8957d935821a1d06c10263cf41cf58239 (diff)
downloadhomegit-MOVED-TO-GNOME-442f77df901d46e24abac33a76b99c1fb828638d.zip
homegit-MOVED-TO-GNOME-442f77df901d46e24abac33a76b99c1fb828638d.tar.gz
homegit-MOVED-TO-GNOME-442f77df901d46e24abac33a76b99c1fb828638d.tar.xz
add git-fpaste
-rwxr-xr-xbin/git-fpaste45
1 files changed, 45 insertions, 0 deletions
diff --git a/bin/git-fpaste b/bin/git-fpaste
new file mode 100755
index 0000000..d66fc4c
--- /dev/null
+++ b/bin/git-fpaste
@@ -0,0 +1,45 @@
+#!/usr/bin/python
+
+# Paste a diff using fpaste
+# Copyright 2010 Colin Walters <walters@verbum.org>
+# Licensed under the new-BSD license (http://www.opensource.org/licenses/bsd-license.php)
+
+import os
+import sys
+import subprocess
+import getopt
+
+def main():
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], 'd', ['diff'])
+ except getopt.GetoptError, e:
+ print unicode(e)
+ print "Usage: git fpaste [--diff] [REVISION]"
+ print " If REVISION is not specified it defaults to HEAD."
+ sys.exit(1)
+
+ if not os.path.exists('/usr/bin/fpaste'):
+ subprocess.check_call(['pkcon', 'install', 'fpaste'])
+
+ diff = False
+ for o, a in opts:
+ if o in ('--diff', ):
+ diff = True
+
+ if len(args) > 0:
+ revision = args[0]
+ else:
+ revision = 'HEAD^'
+
+ if diff:
+ proc = subprocess.Popen(['git', 'diff'], stdout=subprocess.PIPE, stderr=sys.stderr)
+ description = "diff from " + os.path.basename(os.getcwd())
+ else:
+ proc = subprocess.Popen(['git', 'format-patch', '--stdout', revision], stdout=subprocess.PIPE, stderr=sys.stderr)
+ description = revision + " in " + os.path.basename(os.getcwd())
+ pasteproc = subprocess.Popen(['fpaste', '-d', description], stdin=proc.stdout, stdout=sys.stdout, stderr=sys.stderr)
+ pasteproc.wait()
+
+if __name__ == '__main__':
+ main()
+