public
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)
Fri May 09 06:56:17 -0700 2008
commit  b78d52bb13bc707c6af3eecd7a02a67d8f8ffd19
tree    75ee16aa7b6817958ab0264c021ced9987fcb53d
parent  29185f5c30acfc9ab36f661bd44d1429e0e8d336
piston / samples / import_git_git.rb
100644 40 lines (33 sloc) 0.912 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
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env ruby
#
# Import an SVN repository into an SVN working copy.
require File.dirname(__FILE__) + "/common"
 
@root = @root + "tmp/git_git"
@root.rmtree rescue nil
@root.mkpath
 
@tmp = @root + "plugin.tmp"
 
@plugin = @root + "plugin"
@plugin.mkpath
File.open(@plugin + "README", "wb") {|f| f.puts "Hello World"}
File.open(@plugin + "init.rb", "wb") {|f| f.puts "# Some init code"}
Dir.chdir(@plugin) do
  git :init
  git :add, "."
  git :commit, "-m", "initial commit"
end
 
@wc = @root + "wc"
@wc.mkpath
File.open(@wc + "README", "wb") {|f| f.puts "My local project"}
Dir.chdir(@wc) do
  git :init
  git :add, "."
  git :commit, "-m", "initial commit"
end
 
repos = Piston::Git::Repository.new("file://" + @plugin.realpath)
commit = repos.at(:head)
commit.checkout_to(@tmp)
 
wc = Piston::Git::WorkingCopy.new(@wc + "vendor")
wc.create
wc.copy_from(commit)
wc.remember(commit.remember_values)
wc.finalize