1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Separate format_changelog

VCS::GITSVN#format_changelog generates previous format, similar to
svn-log, and VCS::GIT#format_changelog stores just git-log as-is
for now.
This commit is contained in:
Nobuyoshi Nakada 2019-04-27 23:14:59 +09:00
parent 7875c42f64
commit 2a4625115a
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -454,13 +454,35 @@ class VCS
def export_changelog(url, from, to, path)
range = [from, to].map do |rev|
rev or next
if Integer === rev
rev = cmd_read({'LANG' => 'C', 'LC_ALL' => 'C'},
%W"#{COMMAND} log -n1 --format=format:%H" <<
"--grep=^ *git-svn-id: .*@#{rev} ")
end
rev unless rev.empty?
end.join('^..')
cmd_pipe({'TZ' => 'JST-9', 'LANG' => 'C', 'LC_ALL' => 'C'},
%W"#{COMMAND} log --format=medium --no-notes --date=iso-local --topo-order #{range}", "rb") do |r|
format_changelog(r, path)
end
end
def format_changelog(r, path)
IO.copy_stream(r, path)
end
def commit(opts = {})
dryrun = opts.fetch(:dryrun) {$DEBUG} if opts
args = [COMMAND]
args << "-n" if dryrun
args << "push"
system(*args) or return false
true
end
end
class GITSVN < GIT
def format_changelog(r, path)
open(path, 'w') do |w|
sep = "-"*72
w.puts sep
@ -483,19 +505,7 @@ class VCS
end
end
end
end
def commit(opts = {})
dryrun = opts.fetch(:dryrun) {$DEBUG} if opts
args = [COMMAND]
args << "-n" if dryrun
args << "push"
system(*args) or return false
true
end
end
class GITSVN < GIT
def last_changed_revision
rev = cmd_read(%W"#{COMMAND} svn info"+[STDERR=>[:child, :out]])[/^Last Changed Rev: (\d+)/, 1]
com = cmd_read(%W"#{COMMAND} svn find-rev r#{rev}").chomp