svnx 1.0.1 → 2.0.6
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.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.glarkrc +1 -0
- data/Features.txt +7 -0
- data/Gemfile +4 -0
- data/History.txt +4 -0
- data/LICENSE +20 -0
- data/Manifest.txt +0 -0
- data/README.md +12 -0
- data/Rakefile +12 -0
- data/lib/svnx/base/action.rb +57 -52
- data/lib/svnx/base/cmdline.rb +58 -0
- data/lib/svnx/base/command.rb +49 -41
- data/lib/svnx/base/entries.rb +46 -45
- data/lib/svnx/base/entry.rb +51 -38
- data/lib/svnx/base/env.rb +26 -0
- data/lib/svnx/base/options.rb +25 -0
- data/lib/svnx/cat/command.rb +3 -64
- data/lib/svnx/cat/options.rb +28 -0
- data/lib/svnx/commit/command.rb +9 -0
- data/lib/svnx/commit/options.rb +29 -0
- data/lib/svnx/diff/command.rb +17 -0
- data/lib/svnx/diff/elements.rb +84 -0
- data/lib/svnx/diff/options.rb +35 -0
- data/lib/svnx/diff/parser.rb +105 -0
- data/lib/svnx/info/command.rb +4 -47
- data/lib/svnx/info/entries.rb +6 -8
- data/lib/svnx/info/entry.rb +21 -23
- data/lib/svnx/info/options.rb +28 -0
- data/lib/svnx/io/directory.rb +9 -5
- data/lib/svnx/io/element.rb +93 -95
- data/lib/svnx/log/command.rb +7 -3
- data/lib/svnx/log/entries.rb +17 -14
- data/lib/svnx/log/entry.rb +61 -49
- data/lib/svnx/log/options.rb +31 -0
- data/lib/svnx/merge/command.rb +9 -0
- data/lib/svnx/merge/options.rb +34 -0
- data/lib/svnx/project.rb +74 -0
- data/lib/svnx/propget/command.rb +9 -0
- data/lib/svnx/propget/entries.rb +15 -0
- data/lib/svnx/propget/entry.rb +23 -0
- data/lib/svnx/propget/options.rb +31 -0
- data/lib/svnx/propset/command.rb +9 -0
- data/lib/svnx/propset/options.rb +33 -0
- data/lib/svnx/revision/argfactory.rb +2 -2
- data/lib/svnx/revision/argument.rb +7 -3
- data/lib/svnx/revision/date.rb +27 -0
- data/lib/svnx/revision/error.rb +2 -2
- data/lib/svnx/revision/range.rb +5 -2
- data/lib/svnx/status/command.rb +4 -42
- data/lib/svnx/status/entries.rb +11 -12
- data/lib/svnx/status/entry.rb +43 -41
- data/lib/svnx/status/options.rb +28 -0
- data/lib/svnx/update/command.rb +9 -0
- data/lib/svnx/update/options.rb +25 -0
- data/lib/svnx/util/dateutil.rb +35 -0
- data/lib/svnx/util/objutil.rb +14 -0
- data/lib/{svnx.rb → svnx/version.rb} +2 -2
- data/lib/system/command/arg.rb +6 -5
- data/lib/system/command/cachefile.rb +29 -21
- data/lib/system/command/caching.rb +12 -25
- data/lib/system/command/line.rb +41 -30
- data/svnx.gemspec +34 -0
- metadata +85 -61
- data/lib/svnx/base/args.rb +0 -24
- data/lib/svnx/log/args.rb +0 -57
- data/lib/svnx/log/exec.rb +0 -27
- data/lib/svnx/log/line.rb +0 -42
- data/test/integration/info/info_test.rb +0 -21
- data/test/integration/log/log_test.rb +0 -74
- data/test/integration/status/status_test.rb +0 -35
- data/test/integration/svnx/io/element_test.rb +0 -235
- data/test/unit/svnx/base/action_test.rb +0 -49
- data/test/unit/svnx/cat/command_test.rb +0 -55
- data/test/unit/svnx/info/entries_test.rb +0 -22
- data/test/unit/svnx/log/args_test.rb +0 -15
- data/test/unit/svnx/log/entries_test.rb +0 -87
- data/test/unit/svnx/log/entry_test.rb +0 -15
- data/test/unit/svnx/log/exec_test.rb +0 -15
- data/test/unit/svnx/log/line_test.rb +0 -14
- data/test/unit/svnx/revision/argfactory_test.rb +0 -50
- data/test/unit/svnx/revision/argument_test.rb +0 -167
- data/test/unit/svnx/revision/range_test.rb +0 -48
- data/test/unit/svnx/status/entries_test.rb +0 -20
- data/test/unit/system/command/cachefile_test.rb +0 -52
- data/test/unit/system/command/caching_test.rb +0 -92
- data/test/unit/system/command/line_test.rb +0 -63
| @@ -1,48 +0,0 @@ | |
| 1 | 
            -
            #!/usr/bin/ruby -w
         | 
| 2 | 
            -
            # -*- ruby -*-
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            require 'tc'
         | 
| 5 | 
            -
            require 'svnx/log/entries'
         | 
| 6 | 
            -
            require 'svnx/revision/range'
         | 
| 7 | 
            -
            require 'svnx/revision/argument'
         | 
| 8 | 
            -
            require 'svnx/revision/argfactory'
         | 
| 9 | 
            -
            require 'resources'
         | 
| 10 | 
            -
             | 
| 11 | 
            -
            module SVNx::Revision
         | 
| 12 | 
            -
              class RangeTestCase < SVNx::TestCase
         | 
| 13 | 
            -
                def setup
         | 
| 14 | 
            -
                  xmllines = Resources::PT_LOG_R22_13_SECONDFILE_TXT.readlines
         | 
| 15 | 
            -
                  @entries = SVNx::Log::Entries.new :xmllines => xmllines
         | 
| 16 | 
            -
                end
         | 
| 17 | 
            -
             | 
| 18 | 
            -
                def assert_range expstr, expfrom, expto, argfrom, argto = nil
         | 
| 19 | 
            -
                  rg = Range.new argfrom, argto
         | 
| 20 | 
            -
                  msg = "from: #{argfrom}; to: #{argto}"
         | 
| 21 | 
            -
                  
         | 
| 22 | 
            -
                  assert_equal expfrom, rg.from.to_s, msg
         | 
| 23 | 
            -
                  assert_equal expto, rg.to.to_s, msg
         | 
| 24 | 
            -
                  assert_equal expstr, rg.to_s, msg
         | 
| 25 | 
            -
                  rg
         | 
| 26 | 
            -
                end
         | 
| 27 | 
            -
             | 
| 28 | 
            -
                def test_init
         | 
| 29 | 
            -
                  assert_range '143:199', '143', '199', '143:199'
         | 
| 30 | 
            -
                end
         | 
| 31 | 
            -
             | 
| 32 | 
            -
                def test_to_working_copy
         | 
| 33 | 
            -
                  rr = assert_range '143', '143', '', '143'
         | 
| 34 | 
            -
                  assert rr.working_copy?
         | 
| 35 | 
            -
                end
         | 
| 36 | 
            -
             | 
| 37 | 
            -
                def test_init_takes_arguments
         | 
| 38 | 
            -
                  fa = Argument.new 143
         | 
| 39 | 
            -
                  ta = Argument.new 199
         | 
| 40 | 
            -
                  assert_range '143:199', '143', '199', fa, ta
         | 
| 41 | 
            -
                end
         | 
| 42 | 
            -
             | 
| 43 | 
            -
                def test_to_head
         | 
| 44 | 
            -
                  rr = assert_range '143:HEAD', '143', 'HEAD', '143', 'HEAD'
         | 
| 45 | 
            -
                  assert rr.head?
         | 
| 46 | 
            -
                end
         | 
| 47 | 
            -
              end
         | 
| 48 | 
            -
            end
         | 
| @@ -1,20 +0,0 @@ | |
| 1 | 
            -
            #!/usr/bin/ruby -w
         | 
| 2 | 
            -
            # -*- ruby -*-
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            require 'svnx/status/tc'
         | 
| 5 | 
            -
            require 'svnx/status/entries'
         | 
| 6 | 
            -
             | 
| 7 | 
            -
            module SVNx::Status
         | 
| 8 | 
            -
              class EntriesTestCase < SVNx::Status::TestCase
         | 
| 9 | 
            -
                def test_create_from_xml
         | 
| 10 | 
            -
                  entries = Entries.new :xmllines => Resources::PTP_STATUS.readlines
         | 
| 11 | 
            -
             | 
| 12 | 
            -
                  assert_equal 5, entries.size
         | 
| 13 | 
            -
                  assert_status_entry_equals 'modified', 'FirstFile.txt', entries[0]
         | 
| 14 | 
            -
                  assert_status_entry_equals 'unversioned', 'src/java/Charlie.java', entries[1]
         | 
| 15 | 
            -
                  assert_status_entry_equals 'added', 'src/ruby/dog.rb', entries[2]
         | 
| 16 | 
            -
                  assert_status_entry_equals 'added', 'SeventhFile.txt', entries[3]
         | 
| 17 | 
            -
                  assert_status_entry_equals 'deleted', 'dirzero/SixthFile.txt', entries[4]
         | 
| 18 | 
            -
                end
         | 
| 19 | 
            -
              end
         | 
| 20 | 
            -
            end
         | 
| @@ -1,52 +0,0 @@ | |
| 1 | 
            -
            #!/usr/bin/ruby -w
         | 
| 2 | 
            -
            # -*- ruby -*-
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            require 'tc'
         | 
| 5 | 
            -
            require 'system/command/tc'
         | 
| 6 | 
            -
            require 'system/command/caching'
         | 
| 7 | 
            -
            require 'zlib'
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            module System
         | 
| 10 | 
            -
              class CacheFileTestCase < CommandTestCase
         | 
| 11 | 
            -
                def test_creates_gzfile
         | 
| 12 | 
            -
                  cf = CacheFile.new CACHE_DIR, [ "ls", "/var/tmp" ]
         | 
| 13 | 
            -
                  cfpn = cf.instance_eval '@pn'
         | 
| 14 | 
            -
                  cfpn.unlink if cfpn.exist?
         | 
| 15 | 
            -
                  
         | 
| 16 | 
            -
                  lines = cf.readlines
         | 
| 17 | 
            -
             | 
| 18 | 
            -
                  cfpn = cf.instance_eval '@pn'
         | 
| 19 | 
            -
                  assert cfpn.exist?
         | 
| 20 | 
            -
             | 
| 21 | 
            -
                  Zlib::GzipReader.open(cfpn.to_s) do |gz|
         | 
| 22 | 
            -
                    fromgz = gz.readlines
         | 
| 23 | 
            -
                    assert_equal lines, fromgz
         | 
| 24 | 
            -
                  end
         | 
| 25 | 
            -
                end
         | 
| 26 | 
            -
             | 
| 27 | 
            -
                def test_reads_gzfile
         | 
| 28 | 
            -
                  cf = CacheFile.new CACHE_DIR, [ "ls", "-l", "/var/tmp" ]
         | 
| 29 | 
            -
                  cfpn = cf.instance_eval '@pn'
         | 
| 30 | 
            -
                  cfpn.unlink if cfpn.exist?
         | 
| 31 | 
            -
                  
         | 
| 32 | 
            -
                  lines = cf.readlines
         | 
| 33 | 
            -
             | 
| 34 | 
            -
                  cfpn = cf.instance_eval '@pn'
         | 
| 35 | 
            -
                  assert cfpn.exist?
         | 
| 36 | 
            -
             | 
| 37 | 
            -
                  # same as above
         | 
| 38 | 
            -
                  cf2 = CacheFile.new CACHE_DIR, [ "ls", "-l", "/var/tmp" ]
         | 
| 39 | 
            -
                  
         | 
| 40 | 
            -
                  def cf2.save_file
         | 
| 41 | 
            -
                    fail "should not have called save file for read"
         | 
| 42 | 
            -
                  end
         | 
| 43 | 
            -
             | 
| 44 | 
            -
                  lines2 = cf2.readlines
         | 
| 45 | 
            -
             | 
| 46 | 
            -
                  assert_equal lines2, lines
         | 
| 47 | 
            -
             | 
| 48 | 
            -
                  fromgz = read_gzfile cfpn
         | 
| 49 | 
            -
                  assert_equal lines, fromgz
         | 
| 50 | 
            -
                end
         | 
| 51 | 
            -
              end
         | 
| 52 | 
            -
            end
         | 
| @@ -1,92 +0,0 @@ | |
| 1 | 
            -
            #!/usr/bin/ruby -w
         | 
| 2 | 
            -
            # -*- ruby -*-
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            require 'system/command/caching'
         | 
| 5 | 
            -
            require 'system/command/tc'
         | 
| 6 | 
            -
             | 
| 7 | 
            -
            # Ruby 2 changes this to "file: Class#method", so we've got to cache it (ironic, no?)
         | 
| 8 | 
            -
            $curfile = $0
         | 
| 9 | 
            -
            puts "caching_test: $curfile: #{$curfile}"
         | 
| 10 | 
            -
             | 
| 11 | 
            -
            module System
         | 
| 12 | 
            -
              class CachingCommandLineTestCase < CommandTestCase
         | 
| 13 | 
            -
                def create_ls_tmp
         | 
| 14 | 
            -
                  CachingCommandLine.new [ "ls", "/bin" ]
         | 
| 15 | 
            -
                end
         | 
| 16 | 
            -
             | 
| 17 | 
            -
                def test_ctor_no_args
         | 
| 18 | 
            -
                  cl = CachingCommandLine.new [ "ls" ]
         | 
| 19 | 
            -
                  assert_equal "ls", cl.to_command
         | 
| 20 | 
            -
                end
         | 
| 21 | 
            -
             | 
| 22 | 
            -
                def test_ctor_with_args
         | 
| 23 | 
            -
                  cl = CachingCommandLine.new [ "ls", "/bin" ]
         | 
| 24 | 
            -
                  assert_equal "ls /bin", cl.to_command
         | 
| 25 | 
            -
                end
         | 
| 26 | 
            -
             | 
| 27 | 
            -
                def test_lshift
         | 
| 28 | 
            -
                  cl = CachingCommandLine.new [ "ls" ]
         | 
| 29 | 
            -
                  cl << "/bin"
         | 
| 30 | 
            -
                  assert_equal "ls /bin", cl.to_command
         | 
| 31 | 
            -
                end
         | 
| 32 | 
            -
             | 
| 33 | 
            -
                def test_cache_dir_defaults_to_executable
         | 
| 34 | 
            -
                  cl = create_ls_tmp
         | 
| 35 | 
            -
                  assert_equal '/tmp' + (Pathname.new($curfile).expand_path).to_s, cl.cache_dir
         | 
| 36 | 
            -
                end
         | 
| 37 | 
            -
             | 
| 38 | 
            -
                def test_cache_file_defaults_to_executable
         | 
| 39 | 
            -
                  cl = create_ls_tmp
         | 
| 40 | 
            -
                  assert_equal '/tmp' + (Pathname.new($curfile).expand_path).to_s + '/ls-_slash_bin.gz', cl.cache_file.to_s
         | 
| 41 | 
            -
                end
         | 
| 42 | 
            -
             | 
| 43 | 
            -
                def test_cache_dir_set_cachefile
         | 
| 44 | 
            -
                  cl = create_ls_tmp
         | 
| 45 | 
            -
                  def cl.cache_dir; CACHE_DIR.to_s; end
         | 
| 46 | 
            -
                  assert_not_nil cl.cache_dir
         | 
| 47 | 
            -
                  assert !CACHE_DIR.exist?
         | 
| 48 | 
            -
             | 
| 49 | 
            -
                  cachefile = cl.cache_file
         | 
| 50 | 
            -
                  assert_equal CACHE_DIR.to_s + '/ls-_slash_bin.gz', cachefile.to_s
         | 
| 51 | 
            -
                end
         | 
| 52 | 
            -
             | 
| 53 | 
            -
                def test_cache_dir_created_on_execute
         | 
| 54 | 
            -
                  cl = create_ls_tmp
         | 
| 55 | 
            -
                  def cl.cache_dir; CACHE_DIR.to_s; end
         | 
| 56 | 
            -
             | 
| 57 | 
            -
                  cachefile = cl.cache_file
         | 
| 58 | 
            -
             | 
| 59 | 
            -
                  cl.execute
         | 
| 60 | 
            -
                  assert CACHE_DIR.exist?
         | 
| 61 | 
            -
                  cachelines = read_gzfile cachefile
         | 
| 62 | 
            -
             | 
| 63 | 
            -
                  syslines = nil
         | 
| 64 | 
            -
                  # we can't use /tmp, since this test will add to it:
         | 
| 65 | 
            -
                  IO.popen("ls /bin") do |io|
         | 
| 66 | 
            -
                    syslines = io.readlines
         | 
| 67 | 
            -
                  end
         | 
| 68 | 
            -
             | 
| 69 | 
            -
                  assert_equal syslines, cachelines
         | 
| 70 | 
            -
                end
         | 
| 71 | 
            -
             | 
| 72 | 
            -
                def test_cache_file_matches_results
         | 
| 73 | 
            -
                  dir = "/usr/local/bin"
         | 
| 74 | 
            -
                  cl = CachingCommandLine.new [ "ls", dir ]
         | 
| 75 | 
            -
                  def cl.cache_dir; CACHE_DIR.to_s; end
         | 
| 76 | 
            -
             | 
| 77 | 
            -
                  cachefile = cl.cache_file
         | 
| 78 | 
            -
             | 
| 79 | 
            -
                  cl.execute
         | 
| 80 | 
            -
                  assert CACHE_DIR.exist?
         | 
| 81 | 
            -
             | 
| 82 | 
            -
                  cachelines = read_gzfile cachefile
         | 
| 83 | 
            -
             | 
| 84 | 
            -
                  syslines = nil
         | 
| 85 | 
            -
                  IO.popen("ls #{dir}") do |io|
         | 
| 86 | 
            -
                    syslines = io.readlines
         | 
| 87 | 
            -
                  end
         | 
| 88 | 
            -
             | 
| 89 | 
            -
                  assert_equal syslines, cachelines
         | 
| 90 | 
            -
                end
         | 
| 91 | 
            -
              end
         | 
| 92 | 
            -
            end
         | 
| @@ -1,63 +0,0 @@ | |
| 1 | 
            -
            #!/usr/bin/ruby -w
         | 
| 2 | 
            -
            # -*- ruby -*-
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            require 'tc'
         | 
| 5 | 
            -
            require 'system/command/line'
         | 
| 6 | 
            -
             | 
| 7 | 
            -
            Logue::Log.level = Logue::Log::DEBUG
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            module System
         | 
| 10 | 
            -
              class CommandLineTestCase < SVNx::TestCase
         | 
| 11 | 
            -
                # init
         | 
| 12 | 
            -
             | 
| 13 | 
            -
                def assert_init expecetd, initargs
         | 
| 14 | 
            -
                  cl = System::CommandLine.new initargs
         | 
| 15 | 
            -
                  assert_equal expected, cl.args
         | 
| 16 | 
            -
                
         | 
| 17 | 
            -
                  def test_init
         | 
| 18 | 
            -
                    assert_init [ "ls" ], [ "ls" ]
         | 
| 19 | 
            -
                  end
         | 
| 20 | 
            -
                end
         | 
| 21 | 
            -
             | 
| 22 | 
            -
                # <<
         | 
| 23 | 
            -
             | 
| 24 | 
            -
                def assert_lshift expected, initargs, add
         | 
| 25 | 
            -
                  info "self: #{self}"
         | 
| 26 | 
            -
                  cl = System::CommandLine.new initargs
         | 
| 27 | 
            -
                  cl << add
         | 
| 28 | 
            -
                  assert_equal expected, cl.args
         | 
| 29 | 
            -
                end
         | 
| 30 | 
            -
             | 
| 31 | 
            -
                def test_lshift
         | 
| 32 | 
            -
                  assert_lshift [ "ls", "/tmp" ], [ "ls" ], "/tmp"
         | 
| 33 | 
            -
                end
         | 
| 34 | 
            -
             | 
| 35 | 
            -
                # to_command
         | 
| 36 | 
            -
             | 
| 37 | 
            -
                def assert_to_command expect, args
         | 
| 38 | 
            -
                  cl = System::CommandLine.new args
         | 
| 39 | 
            -
                  assert_equal expect, cl.to_command
         | 
| 40 | 
            -
                end
         | 
| 41 | 
            -
             | 
| 42 | 
            -
                def test_to_command_init
         | 
| 43 | 
            -
                  assert_to_command "ls", [ "ls" ]
         | 
| 44 | 
            -
                end
         | 
| 45 | 
            -
             | 
| 46 | 
            -
                # execute/status
         | 
| 47 | 
            -
             | 
| 48 | 
            -
                def assert_execute_status expect_success, args
         | 
| 49 | 
            -
                  info "self: #{self}"
         | 
| 50 | 
            -
                  cl = System::CommandLine.new args
         | 
| 51 | 
            -
                  cl.execute
         | 
| 52 | 
            -
                  assert_equal expect_success, cl.status.success?, "args: #{args}"
         | 
| 53 | 
            -
                end
         | 
| 54 | 
            -
             | 
| 55 | 
            -
                def test_execute_status_success
         | 
| 56 | 
            -
                  assert_execute_status true, [ "ls", "/tmp" ]
         | 
| 57 | 
            -
                end
         | 
| 58 | 
            -
             | 
| 59 | 
            -
                def test_execute_status_failure
         | 
| 60 | 
            -
                  assert_execute_status false, [ "ls", "/tmpx" ]
         | 
| 61 | 
            -
                end
         | 
| 62 | 
            -
              end
         | 
| 63 | 
            -
            end
         |