Skip to content

Instantly share code, notes, and snippets.

@ursm
Created August 13, 2008 16:30
Show Gist options
  • Save ursm/5259 to your computer and use it in GitHub Desktop.
Save ursm/5259 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'fileutils'
require 'tempfile'
unless ARGV.size == 2
$stderr.puts "usage: #{$0} SOURCE DEST"
exit(1)
end
src, dest = ARGV
FileUtils.mkdir dest
Dir.glob("#{src}/*/") do |path|
dir = File.basename(path)
map = Tempfile.new('filemap').tap do |f|
f.print <<-MAP
include #{dir}
rename #{dir} .
MAP
f.flush
end
system "hg convert --filemap #{map.path} #{src} #{File.join(dest, dir)}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment