#!/usr/bin/ruby
# Takes a path to a Ruby SVN branch and to a REXML branch,
# and merges the differences to the Ruby branch.

old_revision = 0
new_revision = 0
rexml        =ARGV[0]
ruby         =ARGV[1]

Dir.chdir( ruby ) {
  old_revision=`svn propget rexml:main-repo-version lib/rexml`.to_i
}
info = `svn info #{rexml}`.split
index = info.index("Revision:")
new_revision=info[index+1].to_i

# Iterate over each revision
Dir.chdir( rexml ) {
  old_revision.upto( new_revision-1 ) { |rev|
    newrev=rev+1
    # Get a diff and a log message
    diff = `svn diff -r #{rev}:#{newrev}`
    Dir.chdir( File.join("..",ruby) ) {
      # Apply the diff
      # Update the revision property
      `svn propset rexml:main-repo-version #{newrev}`
      # Commit the change with log message
      `svn commit -m `
    }
  }
}

=begin
svn diff --summarize -r 1252:1253
A x
D x


Property changes on: bin/info.rb
___________________________________________________________________
Name: svn:executable
   + *
=end


