Signed-off-by: James Turnbull <[email protected]>
---
 CHANGELOG |    2 ++
 Rakefile  |   36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 79ccb15..58a69a7 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,6 @@
 1.5.3:
+    Added mail_patches Rake task
+
     Added uptime fact
  
     Fixed #1791 - support for virtual fact on Solaris 10
diff --git a/Rakefile b/Rakefile
index 0f6d2b8..bb8a679 100644
--- a/Rakefile
+++ b/Rakefile
@@ -63,3 +63,39 @@ 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 [email protected] 00*.patch"
+
+    # Finally, clean up the patches
+    sh "rm 00*.patch"
+end
+
-- 
1.6.0.6


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to