svn_wc 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. data/ChangeLog +3 -0
  2. data/README.rdoc +2 -2
  3. data/lib/svn_wc.rb +22 -18
  4. data/test/svn_wc_test.rb +45 -6
  5. metadata +12 -5
data/ChangeLog CHANGED
@@ -1,3 +1,6 @@
1
+ version 0.0.4
2
+ * added :svn_repo_config_file accessor (rw)
3
+
1
4
  version 0.0.3
2
5
  * add all possible arg options to 'add' (from client.rb)
3
6
  * enable propset (ignore) only
data/README.rdoc CHANGED
@@ -5,7 +5,7 @@ Operate on the working copy of a (remote) Subversion (svn) repository.
5
5
 
6
6
  == VERSION:
7
7
 
8
- Version 0.0.3
8
+ Version 0.0.4
9
9
 
10
10
 
11
11
  == SYNOPSIS:
@@ -265,7 +265,7 @@ See the ChangeLog file for details.
265
265
  Copyright 2009 David Wright (david_v_wright@yahoo.com), all rights reserved.
266
266
 
267
267
 
268
- SvnWc::RepoAccess 0.0.3 is released under the LGPL license.
268
+ SvnWc::RepoAccess 0.0.4 is released under the LGPL license.
269
269
 
270
270
 
271
271
  == AUTHOR:
data/lib/svn_wc.rb CHANGED
@@ -164,7 +164,8 @@ module SvnWc
164
164
  # TODO revist these
165
165
  #++
166
166
  attr_accessor :svn_user, :svn_pass, :svn_repo_master, \
167
- :svn_repo_working_copy, :cur_file
167
+ :svn_repo_working_copy, :cur_file,
168
+ :svn_repo_config_path, :svn_repo_config_file
168
169
  attr_reader :ctx, :repos
169
170
 
170
171
  #
@@ -172,13 +173,13 @@ module SvnWc
172
173
  #
173
174
  def set_conf(conf)
174
175
  begin
175
- conf = load_conf(conf)
176
- @svn_user = conf['svn_user']
177
- @svn_pass = conf['svn_pass']
178
- @svn_repo_master = conf['svn_repo_master']
179
- @svn_repo_working_copy = conf['svn_repo_working_copy']
180
- @config_path = conf['svn_repo_config_path']
181
- Svn::Core::Config.ensure(@config_path)
176
+ conf = load_conf(conf)
177
+ @svn_user = conf['svn_user']
178
+ @svn_pass = conf['svn_pass']
179
+ @svn_repo_master = conf['svn_repo_master']
180
+ @svn_repo_working_copy = conf['svn_repo_working_copy']
181
+ @svn_repo_config_path = conf['svn_repo_config_path']
182
+ Svn::Core::Config.ensure(@svn_repo_config_path)
182
183
  rescue Exception => e
183
184
  raise RepoAccessError, 'errors loading conf file'
184
185
  end
@@ -248,6 +249,7 @@ module SvnWc
248
249
  if cnf.nil? or cnf.empty?
249
250
  raise RepoAccessError, 'No config file provided!'
250
251
  elsif cnf and cnf.class == String and File.exists? cnf
252
+ @svn_repo_config_file = cnf
251
253
  cnf = IO.read(cnf)
252
254
  end
253
255
 
@@ -713,12 +715,12 @@ module SvnWc
713
715
  @status_info[:conflict_new] = s.conflict_new
714
716
  @status_info[:lock_comment] = s.lock_comment
715
717
  @status_info[:copyfrom_rev] = s.copyfrom_rev
716
- @status_info[:working_size] = s.working_size
718
+ #@status_info[:working_size] = s.working_size
717
719
  @status_info[:conflict_wrk] = s.conflict_wrk
718
720
  @status_info[:cmt_author] = s.cmt_author
719
- @status_info[:changelist] = s.changelist
721
+ #@status_info[:changelist] = s.changelist
720
722
  @status_info[:lock_token] = s.lock_token
721
- @status_info[:keep_local] = s.keep_local
723
+ #@status_info[:keep_local] = s.keep_local
722
724
  @status_info[:lock_owner] = s.lock_owner
723
725
  @status_info[:prop_time] = s.prop_time
724
726
  @status_info[:has_props] = s.has_props
@@ -736,7 +738,7 @@ module SvnWc
736
738
  @status_info[:is_add] = s.add?
737
739
  @status_info[:is_dir] = s.dir?
738
740
  @status_info[:repos] = s.repos
739
- @status_info[:depth] = s.depth
741
+ #@status_info[:depth] = s.depth
740
742
  @status_info[:uuid] = s.uuid
741
743
  @status_info[:url] = s.url
742
744
  end
@@ -866,15 +868,17 @@ module SvnWc
866
868
  #--
867
869
  # TODO support other propset's ; also propget
868
870
  #++
869
- def propset(type, file, dir_path)
871
+ def propset(type, files, dir_path=self.svn_repo_working_copy)
870
872
  raise RepoAccessError, '"ignore" is only supported propset' \
871
873
  unless type == 'ignore'
872
874
 
873
875
  svn_session() do |svn|
874
- begin
875
- svn.propset(Svn::Core::PROP_IGNORE, file, dir_path)
876
- rescue Exception => e #Svn::Error::EntryNotFound => e
877
- raise RepoAccessError, "Propset (Ignore) Failed: #{e.message}"
876
+ files.each do |ef|
877
+ begin
878
+ svn.propset(Svn::Core::PROP_IGNORE, ef, dir_path)
879
+ rescue Exception => e #Svn::Error::EntryNotFound => e
880
+ raise RepoAccessError, "Propset (Ignore) Failed: #{e.message}"
881
+ end
878
882
  end
879
883
  end
880
884
  end
@@ -916,7 +920,7 @@ module SvnWc
916
920
  end
917
921
 
918
922
  def setup_auth_baton(auth_baton) # :nodoc:
919
- auth_baton[Svn::Core::AUTH_PARAM_CONFIG_DIR] = @config_path
923
+ auth_baton[Svn::Core::AUTH_PARAM_CONFIG_DIR] = @svn_repo_config_path
920
924
  auth_baton[Svn::Core::AUTH_PARAM_DEFAULT_USERNAME] = @svn_user
921
925
  end
922
926
 
data/test/svn_wc_test.rb CHANGED
@@ -619,9 +619,9 @@ class TestSvnWc < Test::Unit::TestCase
619
619
 
620
620
  entries = svn.list_entries
621
621
 
622
- assert_equal File.basename(entries[0][:entry_name]),
623
- File.basename(file)
624
622
  assert_equal File.basename(entries[1][:entry_name]),
623
+ File.basename(file)
624
+ assert_equal File.basename(entries[0][:entry_name]),
625
625
  File.basename(file2)
626
626
  assert_equal entries.size, 2
627
627
  assert_nil entries[2]
@@ -636,7 +636,7 @@ class TestSvnWc < Test::Unit::TestCase
636
636
  assert ! info[:is_dir]
637
637
  assert ! info[:has_props]
638
638
  assert ! info[:deleted]
639
- assert ! info[:keep_local]
639
+ #assert ! info[:keep_local]
640
640
  assert ! info[:has_prop_mods]
641
641
  assert info[:normal?]
642
642
  assert info[:is_file]
@@ -649,7 +649,7 @@ class TestSvnWc < Test::Unit::TestCase
649
649
  assert_nil info[:lock_owner]
650
650
  assert_nil info[:present_props]
651
651
  assert_nil info[:lock_token]
652
- assert_nil info[:changelist]
652
+ #assert_nil info[:changelist]
653
653
  assert_nil info[:prejfile]
654
654
 
655
655
  #assert_equal info[:cmt_author], `id`
@@ -658,13 +658,13 @@ class TestSvnWc < Test::Unit::TestCase
658
658
  assert_equal info[:cmt_rev] , rev
659
659
  #assert_equal info[:cmt_date] , rev
660
660
  #:checksum=>"bb9c00f6fc03c2213ac1f0278853dc32", :working_size=>9,
661
- assert_equal info[:working_size] , 9
661
+ #assert_equal info[:working_size] , 9
662
662
  assert_equal info[:schedule], 0
663
663
  assert_equal info[:lock_creation_date], 0
664
664
  assert_equal info[:copyfrom_rev], -1
665
665
  assert_equal info[:prop_time], 0
666
666
  assert_equal info[:kind], 1 # i.e. is file
667
- assert_equal info[:depth], 3
667
+ #assert_equal info[:depth], 3
668
668
  assert_equal info[:status] , ' '
669
669
  assert_equal info[:entry_name], f_entry
670
670
  assert_equal info[:url], "#{File.join(@conf['svn_repo_master'],f_entry)}"
@@ -702,6 +702,45 @@ class TestSvnWc < Test::Unit::TestCase
702
702
 
703
703
  end
704
704
 
705
+ # XXX wtf!? why is svn_list ignoring the file, its not set to ignore
706
+ # TODO investiate
707
+ def test_propset_ignore_file_unrevisioned
708
+ svn = SvnWc::RepoAccess.new(YAML::dump(@conf), true, true)
709
+
710
+ repo_wc = @conf['svn_repo_working_copy']
711
+
712
+ file = File.join repo_wc, 'another_file_to_ignore.txt'
713
+
714
+ #svn.propset('ignore', file)
715
+ #svn.prop_set(Svn::Core::PROP_IGNORE, file, repo_wc)
716
+
717
+ #file = File.join repo_wc, file
718
+ # create file we have already ignored, above
719
+ File.open(file, "w") {|f| f.print('testing propset ignore file.')}
720
+
721
+
722
+ #dir_ent = Dir.mktmpdir('P', repo_wc)
723
+ #file2 = new_unique_file_at_path dir_ent
724
+ file2 = new_unique_file_at_path
725
+ #p svn.list_entries
726
+ #p `ls -l "#{repo_wc}"`
727
+
728
+ #svn.add dir_ent, recurse=true, force=true
729
+ #svn.add dir_ent, recurse=true, force=true
730
+ svn.add file2
731
+ #p svn.list_entries
732
+ #svn.commit repo_wc
733
+ svn.commit
734
+
735
+ assert_raise(SvnWc::RepoAccessError) { svn.info file }
736
+ assert_equal File.basename(svn.list_entries[0][:entry_name]),
737
+ File.basename(file2)
738
+ assert_equal svn.list_entries.size, 1
739
+ assert_nil svn.list_entries[1]
740
+ #p svn.list_entries
741
+
742
+ end
743
+
705
744
  # TODO
706
745
  # from client.rb
707
746
  #def log(paths, start_rev, end_rev, limit,
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svn_wc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 4
9
+ version: 0.0.4
5
10
  platform: ruby
6
11
  authors:
7
12
  - David Wright
@@ -9,7 +14,7 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-02-20 00:00:00 -08:00
17
+ date: 2010-02-26 00:00:00 -08:00
13
18
  default_executable:
14
19
  dependencies: []
15
20
 
@@ -42,18 +47,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
42
47
  requirements:
43
48
  - - ">="
44
49
  - !ruby/object:Gem::Version
50
+ segments:
51
+ - 0
45
52
  version: "0"
46
- version:
47
53
  required_rubygems_version: !ruby/object:Gem::Requirement
48
54
  requirements:
49
55
  - - ">="
50
56
  - !ruby/object:Gem::Version
57
+ segments:
58
+ - 0
51
59
  version: "0"
52
- version:
53
60
  requirements: []
54
61
 
55
62
  rubyforge_project:
56
- rubygems_version: 1.3.5
63
+ rubygems_version: 1.3.6
57
64
  signing_key:
58
65
  specification_version: 3
59
66
  summary: svn_wc operates on a working copy (on the local filesystem) of a remote Subversion repository.