1
desc "Send patch information to the puppet-dev list"
3
if Dir.glob("00*.patch").length > 0
4
raise "Patches already exist matching '00*.patch'; clean up first"
7
unless %x{git status} =~ /On branch (.+)/
8
raise "Could not get branch from 'git status'"
12
unless branch =~ %r{^([^\/]+)/([^\/]+)/([^\/]+)$}
13
raise "Branch name does not follow <type>/<parent>/<name> model; cannot autodetect parent branch"
16
type, parent, name = $1, $2, $3
18
# Create all of the patches
19
sh "git format-patch -C -M -s -n --subject-prefix='PATCH/facter' #{parent}..HEAD"
21
# Add info to the patches
22
additional_info = "Local-branch: #{branch}\n"
23
files = Dir.glob("00*.patch")
25
contents = File.read(file)
26
contents.sub!(/^---\n/, "---\n#{additional_info}")
27
File.open(file, 'w') do |file_handle|
28
file_handle.print contents
32
# And then mail them out.
34
# If we've got more than one patch, add --compose
42
sh "git send-email #{compose} --no-signed-off-by-cc --suppress-from --to puppet-dev@googlegroups.com 00*.patch"
44
# Finally, clean up the patches