summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-01-27 17:53:38 -0600
committerLuke Kanies <luke@madstop.com>2009-01-27 18:06:01 -0600
commita194c91df1c95a6e2cae33ad80aa6027aa9e68b7 (patch)
treedeeaa2afd7e865eef50bd659acaa5bc12a5dc9b9
parenta82f476382e0a4bad90044883922a069a87f6beb (diff)
downloadfacter-a194c91df1c95a6e2cae33ad80aa6027aa9e68b7.tar.gz
facter-a194c91df1c95a6e2cae33ad80aa6027aa9e68b7.tar.xz
facter-a194c91df1c95a6e2cae33ad80aa6027aa9e68b7.zip
Adding mail_patches rake task
Signed-off-by: Luke Kanies <luke@madstop.com>
-rw-r--r--Rakefile35
1 files changed, 35 insertions, 0 deletions
diff --git a/Rakefile b/Rakefile
index 0f6d2b8..c53f8f6 100644
--- a/Rakefile
+++ b/Rakefile
@@ -63,3 +63,38 @@ namespace :ci do
end
+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 #{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-chain-reply-to --no-signed-off-by-cc --suppress-from --no-thread --to puppet-dev@googlegroups.com 00*.patch"
+
+ # Finally, clean up the patches
+ sh "rm 00*.patch"
+end