From ce3ac54e2c3df7b1e2e7b824f52e0c60c4298f7a Mon Sep 17 00:00:00 2001 From: feu Date: Sun, 29 Jul 2018 11:36:43 -0300 Subject: [PATCH] changing to use system_command .. chdir --- Library/Homebrew/download_strategy.rb | 9 +++++---- .../Homebrew/unpack_strategy/subversion.rb | 19 +++---------------- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index a9f221dd82..0746387922 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -554,18 +554,19 @@ class SubversionDownloadStrategy < VCSDownloadStrategy end def source_modified_time - xml = REXML::Document.new(Utils.popen_read("svn", "info", "--xml", svn_escape(cached_location))) + info = system_command("svn", args:["info", "--xml"], chdir: cached_location.to_s).stdout + xml = REXML::Document.new(info) Time.parse REXML::XPath.first(xml, "//date/text()").to_s end def last_commit - Utils.popen_read("svn", "info", "--show-item", "revision", svn_escape(cached_location)).strip + system_command("svn", args:["info", "--show-item", "revision"], chdir: cached_location.to_s).stdout.strip end private def repo_url - Utils.popen_read("svn", "info", svn_escape(cached_location)).strip[/^URL: (.+)$/, 1] + system_command("svn", args:["info"], chdir: cached_location.to_s).stdout.strip[/^URL: (.+)$/, 1] end def externals @@ -580,7 +581,7 @@ class SubversionDownloadStrategy < VCSDownloadStrategy # This saves on bandwidth and will have a similar effect to verifying the # cache as it will make any changes to get the right revision. args = if target.directory? - ["svn", "update", svn_escape(target)] + ["cd", target.to_s, ";", "svn", "update"] else ["svn", "checkout", url, target] end diff --git a/Library/Homebrew/unpack_strategy/subversion.rb b/Library/Homebrew/unpack_strategy/subversion.rb index b185d2ae57..f3e69b0c24 100644 --- a/Library/Homebrew/unpack_strategy/subversion.rb +++ b/Library/Homebrew/unpack_strategy/subversion.rb @@ -1,20 +1,5 @@ require_relative "directory" -def svn_escape(svn_path) - # subversion uses '@' to point to a specific revision - # so when the path contains a @, it requires an additional @ at the end - # but this is not consistent through all commands - # the commands are affected as follows: - # svn checkout url1 foo@a # properly checks out url1 to foo@a - # svn switch url2 foo@a # properly switchs foo@a to url2 - # svn update foo@a@ # properly updates foo@a - # svn info foo@a@ # properly obtains info on foo@a - # svn export foo@a@ newdir # properly export foo@a contents to newdir - result = svn_path.to_s.dup - result << "@" if result.include? "@" - result -end - module UnpackStrategy class Subversion < Directory def self.can_extract?(path:, magic_number:) @@ -24,7 +9,9 @@ module UnpackStrategy private def extract_to_dir(unpack_dir, basename:, verbose:) - system_command! "svn", args: ["export", "--force", svn_escape(path), unpack_dir] + system_command! "svn", + args: ["export", "--force", ".", unpack_dir], + chdir: path.to_s end end end