Skip to content

Commit da5ff3a

Browse files
committed
Forget about SVN
1 parent 1f006bf commit da5ff3a

File tree

3 files changed

+4
-106
lines changed

3 files changed

+4
-106
lines changed

README.md

-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ On each commit of Ruby's Git repository, following git hooks are triggered:
2323

2424
## The directory structure of `git.ruby-lang.org`
2525

26-
* `/data/svn/repos/ruby`: SVN repository of Ruby
27-
* `hooks/post-commit`: Run `/home/git/git.ruby-lang.org/hooks/post-commit.sh`
2826
* `/data/git/ruby.git`: Bare Git repository of ruby
2927
* `hooks/post-receive`: Run `/home/git/git.ruby-lang.org/hooks/post-receive.sh`
3028
* `/home/git/git.ruby-lang.org`: Cloned Git repository of git.ruby-lang.org

bin/update-version.h.rb

+4-62
Original file line numberDiff line numberDiff line change
@@ -5,56 +5,6 @@
55

66
vcs, repo_path, *rest = ARGV
77
case vcs
8-
when "svn"
9-
class SvnInfo
10-
def initialize(repo_path, rev)
11-
@repo_path = repo_path
12-
@revision = Integer(rev)
13-
get_changed
14-
end
15-
16-
def branches
17-
[*@added_files, *@updated_files].map { |x| x[/((?:branches\/)?.+?)\//, 1] }.uniq
18-
end
19-
20-
private
21-
22-
def get_changed
23-
@added_files = []
24-
@updated_files = []
25-
svnlook("changed").each_line do |line|
26-
if /^(.). (.*)$/ =~ line
27-
modified_type = $1
28-
path = $2
29-
case modified_type
30-
when "A"
31-
add_path(path, @added_files)
32-
when "D"
33-
# noop
34-
else
35-
add_path(path, @updated_files)
36-
end
37-
else
38-
raise "unknown format: #{line}"
39-
end
40-
end
41-
end
42-
43-
def add_path(path, files)
44-
unless directory_path?(path)
45-
files << path
46-
end
47-
end
48-
49-
def svnlook(command, *others)
50-
`svnlook #{command} #{@repo_path} -r #{@revision} #{others.join(' ')}`.force_encoding("ASCII-8BIT")
51-
end
52-
53-
def directory_path?(path)
54-
path[-1] == ?/
55-
end
56-
end
57-
branches = SvnInfo.new(repo_path, rest.first).branches
588
when "git"
599
branches = rest.each_slice(3).map do |_oldrev, _newrev, refname|
6010
IO.popen(["git", "rev-parse", "--symbolic", "--abbrev-ref", refname], &:read).strip
@@ -69,11 +19,7 @@ def directory_path?(path)
6919
version_h = "#{v}/version.h"
7020
version_h_orig = version_h + "~"
7121

72-
if vcs == "svn"
73-
system "pwd;echo 1;svn co --depth empty file:///#{repo_path}/#{branch} #{v}; svn up #{version_h}"
74-
else # git
75-
system "git clone --depth=1 --branch=#{branch} file:///#{repo_path} #{v}"
76-
end
22+
system "git clone --depth=1 --branch=#{branch} file:///#{repo_path} #{v}"
7723
formats = {
7824
'DATE' => [/"\d{4}-\d\d-\d\d"/, '"%Y-%m-%d"'],
7925
'TIME' => [/".+"/, '"%H:%M:%S"'],
@@ -104,13 +50,9 @@ def directory_path?(path)
10450
end
10551
end
10652
end
107-
if vcs == "svn"
108-
system "svn commit -m '#{now.strftime %(* %Y-%m-%d)}' #{version_h}"
109-
else
110-
Dir.chdir(v) do
111-
unless system("git diff --quiet --exit-code #{version_h}")
112-
system "git add #{version_h} && git commit -m '#{now.strftime %(* %Y-%m-%d)} [ci skip]' && git push origin #{branch}"
113-
end
53+
Dir.chdir(v) do
54+
unless system("git diff --quiet --exit-code #{version_h}")
55+
system "git add #{version_h} && git commit -m '#{now.strftime %(* %Y-%m-%d)} [ci skip]' && git push origin #{branch}"
11456
end
11557
end
11658
end

hooks/post-commit.sh

-42
This file was deleted.

0 commit comments

Comments
 (0)