VCSDownloadStrategy: add last_commit method
Implement:
* VCSDownloadStrategy#last_commit
Use last modified file timestamp
* SubversionDownloadStrategy#last_commit
Use `svn info --show-item revision`
* GitDownloadStrategy#last_commit
Use `git rev-parse HEAD`
* MercurialDownloadStrategy#last_commit
Use `hg parent --template {node}`
* BazaarDownloadStrategy#last_commit
Use `bazaar revno`
* FossilDownloadStrategy#last_commit
Use `fossil info tip`
This commit is contained in:
parent
cc01d3f59a
commit
2f5f352baa
@ -153,6 +153,12 @@ class VCSDownloadStrategy < AbstractDownloadStrategy
|
|||||||
version.head?
|
version.head?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Return last commit's unique identifier for the repository.
|
||||||
|
# Return most recent modified timestamp unless overridden.
|
||||||
|
def last_commit
|
||||||
|
source_modified_time.to_i.to_s
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def cache_tag
|
def cache_tag
|
||||||
@ -501,6 +507,10 @@ class SubversionDownloadStrategy < VCSDownloadStrategy
|
|||||||
Time.parse REXML::XPath.first(xml, "//date/text()").to_s
|
Time.parse REXML::XPath.first(xml, "//date/text()").to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def last_commit
|
||||||
|
Utils.popen_read("svn", "info", "--show-item", "revision", cached_location.to_s).strip
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def repo_url
|
def repo_url
|
||||||
@ -581,6 +591,10 @@ class GitDownloadStrategy < VCSDownloadStrategy
|
|||||||
Time.parse Utils.popen_read("git", "--git-dir", git_dir, "show", "-s", "--format=%cD")
|
Time.parse Utils.popen_read("git", "--git-dir", git_dir, "show", "-s", "--format=%cD")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def last_commit
|
||||||
|
Utils.popen_read("git", "--git-dir", git_dir ,"rev-parse", "HEAD").chomp
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def cache_tag
|
def cache_tag
|
||||||
@ -818,6 +832,10 @@ class MercurialDownloadStrategy < VCSDownloadStrategy
|
|||||||
Time.parse Utils.popen_read("hg", "tip", "--template", "{date|isodate}", "-R", cached_location.to_s)
|
Time.parse Utils.popen_read("hg", "tip", "--template", "{date|isodate}", "-R", cached_location.to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def last_commit
|
||||||
|
Utils.popen_read("hg", "parent", "--template", "{node}", "-R", cached_location.to_s)
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def cache_tag
|
def cache_tag
|
||||||
@ -854,6 +872,10 @@ class BazaarDownloadStrategy < VCSDownloadStrategy
|
|||||||
Time.parse Utils.popen_read("bzr", "log", "-l", "1", "--timezone=utc", cached_location.to_s)[/^timestamp: (.+)$/, 1]
|
Time.parse Utils.popen_read("bzr", "log", "-l", "1", "--timezone=utc", cached_location.to_s)[/^timestamp: (.+)$/, 1]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def last_commit
|
||||||
|
Utils.popen_read("bzr", "revno", cached_location.to_s).chomp
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def cache_tag
|
def cache_tag
|
||||||
@ -891,6 +913,10 @@ class FossilDownloadStrategy < VCSDownloadStrategy
|
|||||||
Time.parse Utils.popen_read("fossil", "info", "tip", "-R", cached_location.to_s)[/^uuid: +\h+ (.+)$/, 1]
|
Time.parse Utils.popen_read("fossil", "info", "tip", "-R", cached_location.to_s)[/^uuid: +\h+ (.+)$/, 1]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def last_commit
|
||||||
|
Utils.popen_read("fossil", "info", "tip", "-R", cached_location.to_s)[/^uuid: +(\h+) .+$/, 1]
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def cache_tag
|
def cache_tag
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user