Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjusting SVN commands to consider the @ symbol #4551

Merged
merged 10 commits into from
Jul 30, 2018
20 changes: 11 additions & 9 deletions Library/Homebrew/download_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -554,18 +554,19 @@ def fetch
end

def source_modified_time
xml = REXML::Document.new(Utils.popen_read("svn", "info", "--xml", cached_location.to_s))
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", cached_location.to_s).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", cached_location.to_s).strip[/^URL: (.+)$/, 1]
system_command("svn", args: ["info"], chdir: cached_location.to_s).stdout.strip[/^URL: (.+)$/, 1]
end

def externals
Expand All @@ -576,19 +577,20 @@ def externals
end

def fetch_repo(target, url, revision = nil, ignore_externals = false)
# Use "svn up" when the repository already exists locally.
# Use "svn update" when the repository already exists locally.
# 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.
svncommand = target.directory? ? "up" : "checkout"
args = ["svn", svncommand]
args << url unless target.directory?
args << target
args = []
if revision
ohai "Checking out #{@ref}"
args << "-r" << revision
end
args << "--ignore-externals" if ignore_externals
safe_system(*args)
if target.directory?
system_command("svn", args: ["update", *args], chdir: target.to_s)
else
system_command("svn", args: ["checkout", url, target, *args])
end
end

def cache_tag
Expand Down
4 changes: 3 additions & 1 deletion Library/Homebrew/unpack_strategy/subversion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ def self.can_extract?(path:, magic_number:)
private

def extract_to_dir(unpack_dir, basename:, verbose:)
system_command! "svn", args: ["export", "--force", path, unpack_dir]
system_command! "svn",
args: ["export", "--force", ".", unpack_dir],
chdir: path.to_s
end
end
end