Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

really actually working now - just need to figure out how to get that…

… last url back when its done
  • Loading branch information...
commit 0653bae06a51db633259dbbbff82ef6c34a7e931 1 parent 9c9abae
@schacon authored
Showing with 13 additions and 22 deletions.
  1. +4 −16 rewrite_commits.rb
  2. +9 −6 src/subversion_import.erl
View
20 rewrite_commits.rb
@@ -38,6 +38,7 @@ def write_commits
ref = commit[5]
name = commit[6]
+ next if !(ref == 'trunk' || ref == 'tags' || ref == 'branches')
ref = File.join(ref, name) if ref != 'trunk'
parent = ''
@@ -46,9 +47,10 @@ def write_commits
tree_sha = `git rev-parse #{commit_sha}:#{ref}`.strip
- last_commits[ref] = `git commit-tree #{tree_sha} #{parent} < #{comment.path}`.strip
+ tc = `git commit-tree #{tree_sha} #{parent} < #{comment.path}`.strip
+ last_commits[ref] = tc if tc != ''
end
-
+
# write the last commits heads
last_commits.each do |ref, sha|
if ref == 'trunk'
@@ -128,18 +130,4 @@ def finish_repo
sk = SubSucka.new(repo_dir, svn_url)
sk.build
-# go through all the remotes and list tree subshas -> rX
-
-# get author mapping
-
-# get list for trunk
-
-# get list for branches
-# svn list branches
-# get log for each branch
-
-# get list for tags
-# svn list branches
-# get log for each tag
-
View
15 src/subversion_import.erl
@@ -78,7 +78,8 @@ import_part(RevTuple, Url) ->
{StartRev, EndRev} = RevTuple,
checkout_part(Url, Ref, StartRev, EndRev),
cmd("git gc --aggressive", Ref),
- Ref.
+ cmd("git update-server-info", Ref),
+ {net_adm:localhost(), Ref}.
checkout_part(Url, Ref, N, Revisions) ->
Out = cmd("svn co ~s -r ~b .", [Url, N], Ref),
@@ -104,7 +105,10 @@ combine_results(Remotes, Url) ->
Ref = new_dir(),
error_logger:info_msg("combine ~p~n", [Ref]),
[First|Rest] = Remotes,
- cmd("git clone " ++ First ++ " repo", Ref),
+ {HostName, Path} = First,
+ CloneUrl = "http://" ++ HostName ++ Path ++ "/.git",
+ io:format("git clone " ++ CloneUrl ++ " repo"),
+ cmd("git clone " ++ CloneUrl ++ " repo", Ref),
Repo = Ref ++ "/repo",
combine_rest_results(Rest, Repo, 1),
rewrite_commits(Repo, Url),
@@ -117,9 +121,9 @@ rewrite_commits(Repo, Url) ->
combine_rest_results([], Repo, Num) -> [];
combine_rest_results(Remotes, Repo, Num) ->
[Next|Rem] = Remotes,
- io:format("in repo: ~p~n", [Repo]),
- io:format("git remote add r~b ~p~n", [Num, Next]),
- cmd("git remote add r~b ~p", [Num, Next], Repo),
+ {HostName, Path} = Next,
+ CloneUrl = "http://" ++ HostName ++ Path ++ "/.git",
+ cmd("git remote add r~b ~p", [Num, CloneUrl], Repo),
cmd("git fetch r~b", [Num], Repo),
BranchName = {"r" ++ erlang:integer_to_list(Num) ++ "/master"},
lists:flatten([BranchName, combine_rest_results(Rem, Repo, Num + 1)]).
@@ -151,7 +155,6 @@ new_dir() ->
cmd("mkdir '" ++ Ref ++ "'", "."),
Ref.
-
pmap(Fun, List, Nodes, ExtraArgs) ->
SpawnFun =
case length(Nodes) of
Please sign in to comment.
Something went wrong with that request. Please try again.