mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* tool/file2lastrev.rb (VCS#get_revisions): particular commands do
not depend on instance. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6c7edcb00a
commit
0c6fb8ccaa
2 changed files with 20 additions and 19 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Tue Mar 30 13:01:10 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* tool/file2lastrev.rb (VCS#get_revisions): particular commands do
|
||||||
|
not depend on instance.
|
||||||
|
|
||||||
Tue Mar 30 08:55:50 2010 Aaron Patterson <aaron@tenderlovemaking.com>
|
Tue Mar 30 08:55:50 2010 Aaron Patterson <aaron@tenderlovemaking.com>
|
||||||
|
|
||||||
* ext/psych/extconf.rb: Making library detection more agnostic.
|
* ext/psych/extconf.rb: Making library detection more agnostic.
|
||||||
|
|
|
@ -24,16 +24,17 @@ class VCS
|
||||||
|
|
||||||
def initialize(path)
|
def initialize(path)
|
||||||
@srcdir = path
|
@srcdir = path
|
||||||
|
super()
|
||||||
end
|
end
|
||||||
|
|
||||||
# return a pair of strings, the last revision and the last revision in which
|
# return a pair of strings, the last revision and the last revision in which
|
||||||
# +path+ was modified.
|
# +path+ was modified.
|
||||||
def get_revisions(path)
|
def get_revisions(path)
|
||||||
path = relative_to(path)
|
path = relative_to(path)
|
||||||
last, changed = Dir.chdir(@srcdir) {yield path}
|
last, changed, *rest = Dir.chdir(@srcdir) {self.class.get_revisions(path)}
|
||||||
last or raise "last revision not found"
|
last or raise "last revision not found"
|
||||||
changed or raise "changed revision not found"
|
changed or raise "changed revision not found"
|
||||||
return last, changed
|
return last, changed, *rest
|
||||||
end
|
end
|
||||||
|
|
||||||
def relative_to(path)
|
def relative_to(path)
|
||||||
|
@ -43,37 +44,32 @@ class VCS
|
||||||
class SVN < self
|
class SVN < self
|
||||||
register(".svn")
|
register(".svn")
|
||||||
|
|
||||||
def get_revisions(*)
|
def self.get_revisions(path)
|
||||||
super do |path|
|
info_xml = `svn info --xml "#{path}"`
|
||||||
info_xml = `svn info --xml "#{path}"`
|
_, last, _, changed, _ = info_xml.split(/revision="(\d+)"/)
|
||||||
_, last, _, changed, _ = info_xml.split(/revision="(\d+)"/)
|
[last, changed]
|
||||||
[last, changed]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class GIT_SVN < self
|
class GIT_SVN < self
|
||||||
register(".git/svn")
|
register(".git/svn")
|
||||||
|
|
||||||
def get_revisions(*)
|
def self.get_revisions(path)
|
||||||
super do |path|
|
lastlog = `git log -n1`
|
||||||
info = `git svn info "#{path}"`
|
info = `git svn info "#{path}"`
|
||||||
[info[/^Revision: (\d+)/, 1], info[/^Last Changed Rev: (\d+)/, 1]]
|
[info[/^Revision: (\d+)/, 1], info[/^Last Changed Rev: (\d+)/, 1]]
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class GIT < self
|
class GIT < self
|
||||||
register(".git")
|
register(".git")
|
||||||
|
|
||||||
def get_revisions(*)
|
def self.get_revisions(path)
|
||||||
logcmd = %Q[git log -n1 --grep="^ *git-svn-id: .*@[0-9][0-9]* "]
|
logcmd = %Q[git log -n1 --grep="^ *git-svn-id: .*@[0-9][0-9]* "]
|
||||||
idpat = /git-svn-id: .*?@(\d+) \S+\Z/
|
idpat = /git-svn-id: .*?@(\d+) \S+\Z/
|
||||||
super do |path|
|
last = `#{logcmd}`[idpat, 1]
|
||||||
last = `#{logcmd}`[idpat, 1]
|
changed = path ? `#{logcmd} "#{path}"`[idpat, 1] : last
|
||||||
changed = path ? `#{logcmd} "#{path}"`[idpat, 1] : last
|
[last, changed]
|
||||||
[last, changed]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue