Class: URI::Svn

Inherits:
GenericEx show all
Defined in:
lib/uri/svn.rb

Constant Summary collapse

COMPONENT =
[
  :scheme,
  :host,
  :path
].freeze
@@svn =
'svn'.to_cmd.freeze
@@svnadmin =
'svnadmin'.to_cmd.freeze

Instance Method Summary collapse

Methods inherited from Generic

#add_query, #commit, #mk_custom_opts, #pathname, #pathname=, #to_uri, #to_yaml_string, yaml_load

Instance Method Details

#checkoutObject



36
37
38
39
40
41
# File 'lib/uri/svn.rb', line 36

def checkout
  tmp = TempPath.new('svn-checkout')
  tmp.mkpath
  tmp += pathname.basename
  [tmp, svn['checkout', svn_uri_string, tmp].run(runner)]
end

#fingerprintObject



32
33
34
# File 'lib/uri/svn.rb', line 32

def fingerprint
  svn['info', svn_uri_string].system(:r).output.read[/Revision: (\d+)/, 1]
end

#saveObject

Raises:



43
44
45
46
47
48
49
50
# File 'lib/uri/svn.rb', line 43

def save
  raise SaveError unless scheme.downcase == 'svn.file'
  repos = pathname
  raise SaveError unless (repos + 'format').exist?
  out = TempPath.new('save', "#{repos.basename}.svndump")
  cmd = svnadmin['dump', repos, '--incremental', '--quiet', '--deltas'] > out
  [out, cmd.run(runner)]
end

#svn_uri_stringObject



24
25
26
# File 'lib/uri/svn.rb', line 24

def svn_uri_string
  to_s.sub(/^svn\./, '')
end

#to_sObject



28
29
30
# File 'lib/uri/svn.rb', line 28

def to_s
  super.sub(/^(svn\.file:\/)([^\/])/, '\1//\2')
end