<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -12,7 +12,12 @@ task :commit =&gt; &quot;svn:st&quot; do
   if files_to_check_in?
     commit_message = CommitMessage.new.prompt
     Rake::Task[:pc].invoke
-    sh &quot;#{commit_command(commit_message)}&quot; if ok_to_check_in?
+    
+    if ok_to_check_in?
+      output = sh_with_output &quot;#{commit_command(commit_message)}&quot;
+      revision = output.match(/Committed revision (\d+)\./)[1]
+      merge_to_trunk(revision) if `svn info`.include?(&quot;branches&quot;) &amp;&amp; self.class.const_defined?(:PATH_TO_TRUNK_WORKING_COPY)
+    end
   else
     puts &quot;Nothing to commit&quot;
   end
@@ -39,4 +44,12 @@ def are_you_sure?(message)
     input = Readline.readline(&quot;Are you sure you want to check in? (y/n): &quot;)
   end
   return input.strip.downcase[0,1] == &quot;y&quot;
-end
\ No newline at end of file
+end
+
+def sh_with_output(command)
+  puts command
+  output = `#{command}`
+  puts output
+  raise unless $?.success?
+  output
+end</diff>
      <filename>tasks/commit.rake</filename>
    </modified>
    <modified>
      <diff>@@ -54,5 +54,11 @@ namespace :svn do
       rm_r filename
     end
   end
+  
+  def merge_to_trunk(revision)
+    puts &quot;Merging changes into trunk.  Don't forget to check these in.&quot; 
+    sh &quot;svn up #{PATH_TO_TRUNK_WORKING_COPY.inspect}&quot;
+    sh &quot;svn merge -c #{revision} . #{PATH_TO_TRUNK_WORKING_COPY.inspect}&quot;
+  end
 
 end</diff>
      <filename>tasks/svn.rake</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>aa597bca6ccf5068785edbe0402f59fad4e085b3</id>
    </parent>
  </parents>
  <author>
    <name>Paul Gross</name>
    <login>pgr0ss</login>
    <email>pgross@gmail.com</email>
  </author>
  <url>http://github.com/pgr0ss/rake_commit_tasks/commit/66a3a4867e8141345c4490d7725d7b82067d9c43</url>
  <id>66a3a4867e8141345c4490d7725d7b82067d9c43</id>
  <committed-date>2009-02-19T21:36:04-08:00</committed-date>
  <authored-date>2009-02-19T21:36:04-08:00</authored-date>
  <message>Automatically merge changes from branch to trunk if PATH_TO_TRUNK_WORKING_COPY is set</message>
  <tree>46dfaf1b1246b462292c71bab99812f613658d9e</tree>
  <committer>
    <name>Paul Gross</name>
    <login>pgr0ss</login>
    <email>pgross@gmail.com</email>
  </committer>
</commit>
