Class: URI::Svn

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

Constant Summary collapse

COMPONENT =
[
  :scheme,
  :host,
  :path
].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



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

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

#fingerprintObject



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

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

#saveObject

Raises:



39
40
41
42
43
44
45
46
47
48
# File 'lib/uri/svn.rb', line 39

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

#svn_uri_stringObject



18
19
20
# File 'lib/uri/svn.rb', line 18

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

#to_sObject



22
23
24
# File 'lib/uri/svn.rb', line 22

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