summaryrefslogtreecommitdiffstats
path: root/tasks/rake/mail_patches.rake
diff options
context:
space:
mode:
authorJames Turnbull <james@lovedthanlost.net>2009-08-18 21:34:34 +1000
committerJames Turnbull <james@lovedthanlost.net>2009-08-18 21:34:34 +1000
commit7d4a5f921695d9502641e6da36213d912d54df5c (patch)
tree52e41aec77c038bb2cc4a2799a5561de5fd0fb08 /tasks/rake/mail_patches.rake
parent5982deb61a954852534c54e1d968f3d4b156e787 (diff)
downloadfacter-7d4a5f921695d9502641e6da36213d912d54df5c.tar.gz
facter-7d4a5f921695d9502641e6da36213d912d54df5c.tar.xz
facter-7d4a5f921695d9502641e6da36213d912d54df5c.zip
Updated Rakefile and moved Rake tasks to tasks/rake directory
Diffstat (limited to 'tasks/rake/mail_patches.rake')
-rw-r--r--tasks/rake/mail_patches.rake35
1 files changed, 35 insertions, 0 deletions
diff --git a/tasks/rake/mail_patches.rake b/tasks/rake/mail_patches.rake
new file mode 100644
index 0000000..6375a22
--- /dev/null
+++ b/tasks/rake/mail_patches.rake
@@ -0,0 +1,35 @@
+desc "Send patch information to the puppet-dev list"
+task :mail_patches do
+ if Dir.glob("00*.patch").length > 0
+ raise "Patches already exist matching '00*.patch'; clean up first"
+ end
+
+ unless %x{git status} =~ /On branch (.+)/
+ raise "Could not get branch from 'git status'"
+ end
+ branch = $1
+
+ unless branch =~ %r{^([^\/]+)/([^\/]+)/([^\/]+)$}
+ raise "Branch name does not follow <type>/<parent>/<name> model; cannot autodetect parent branch"
+ end
+
+ type, parent, name = $1, $2, $3
+
+ # Create all of the patches
+ sh "git format-patch -C -M -s -n --subject-prefix='PATCH/facter' #{parent}..HEAD"
+
+ # And then mail them out.
+
+ # If we've got more than one patch, add --compose
+ if Dir.glob("00*.patch").length > 1
+ compose = "--compose"
+ else
+ compose = ""
+ end
+
+ # Now send the mail.
+ sh "git send-email #{compose} --no-signed-off-by-cc --suppress-from --to puppet-dev@googlegroups.com 00*.patch"
+
+ # Finally, clean up the patches
+ sh "rm 00*.patch"
+end