GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Rubygem
Description: Piston is a utility that eases vendor branch management. This repository is a complete reimplementation of Piston to provide different backends, depending on the repositories and working copies you pistonize from.
Homepage: http://piston.rubyforge.org/
Clone URL: git://github.com/francois/piston.git
francois (author)
Thu Sep 25 10:33:48 -0700 2008
commit  40209b1d6ae95fe67b918f660e8e93b09f8e1a82
tree    fe6a09f06911c3d6a5bb80e04c43f91c97eae41e
parent  2c71de586dd65552239a87711a0b46720de3804b
piston / samples / import_svn_git.rb
100644 30 lines (25 sloc) 0.652 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env ruby
#
# Import an SVN repository into a Git working copy.
require "#{File.dirname(__FILE__)}/common"
 
@root = @root + "tmp/svn_git"
@root.rmtree rescue nil
@root.mkpath
 
@repos = @root + "repos"
@wc = @root + "wc"
@tmp = @root + "xlsuite.tmp"
 
@wc.mkpath
File.open(@wc + "README", "wb") {|f| f.write "Hello World"}
Dir.chdir(@wc) do
  git :init
  git :add, "."
  git :commit, "-m", "initial"
end
 
repos = Piston::Svn::Repository.new("http://svn.xlsuite.org/trunk/lib")
rev = repos.at(:head)
rev.checkout_to(@tmp)
wc = Piston::Git::WorkingCopy.new(@wc + "vendor")
wc.create
wc.copy_from(rev)
wc.remember(rev.remember_values)
wc.finalize