Module: Braid::Operations::Svn

Included in:
Braid::Operations
Defined in:
lib/braid/operations.rb

Instance Method Summary collapse

Instance Method Details

#git_svn_fetch(remote) ⇒ Object



100
101
102
103
104
# File 'lib/braid/operations.rb', line 100

def git_svn_fetch(remote)
  # open4 messes with the pipes of index-pack
  system("git svn fetch #{remote} 2>&1 > /dev/null")
  true
end

#git_svn_init(remote, path) ⇒ Object



106
107
108
109
# File 'lib/braid/operations.rb', line 106

def git_svn_init(remote, path)
  exec!("git svn init -R #{remote} --id=#{remote} #{path}")
  true
end

#svn_git_commit_hash(remote, revision) ⇒ Object

FIXME move



93
94
95
96
97
98
# File 'lib/braid/operations.rb', line 93

def svn_git_commit_hash(remote, revision)
  status, out, err = exec!("git svn log --show-commit --oneline -r #{revision} #{remote}")
  part = out.split(" | ")[1]
  raise Braid::Svn::UnknownRevision, "unknown revision: #{revision}" unless part
  invoke(:git_rev_parse, part)
end

#svn_remote_head_revision(path) ⇒ Object

FIXME move



85
86
87
88
89
90
# File 'lib/braid/operations.rb', line 85

def svn_remote_head_revision(path)
  # not using svn info because it's retarded and doesn't show the actual last changed rev for the url
  # git svn has no clue on how to get the actual HEAD revision number on it's own
  status, out, err = exec!("svn log -q --limit 1 #{path}")
  out.split(/\n/).find { |x| x.match /^r\d+/ }.split(" | ")[0][1..-1].to_i
end