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
Search Repo:
francois (author)
Sat Mar 15 12:02:04 -0700 2008
commit  f8b4a270a1300b0e5c7add1c6296936b7e7af041
tree    44a46f99b07beab1e9b7cff4ed030299682fdb6e
parent  d755889565974f8f7ec60463dc26db519549bc89
piston / samples / import_git_git.rb
100644 39 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
#!/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