Created
September 28, 2009 13:18
-
-
Save bluemango/195440 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Getting the actual commit id, in case we were passed a tag | |
# or partial sha or something - it will return the sha if you pass a sha, too | |
def query_revision(revision) | |
raise ArgumentError, "Deploying remote branches has been deprecated. Specify the remote branch as a local branch for the git repository you're deploying from (ie: '#{revision.gsub('origin/', '')}' rather than '#{revision}')." if revision =~ /^origin\// | |
return revision if revision =~ /^[0-9a-f]{40}$/ | |
command = scm('ls-remote', repository, revision) | |
result = yield(command) | |
result = result.split("\n")[1] | |
revdata = result.split("\t") | |
newrev = revdata[0] | |
raise "Unable to resolve revision for '#{revision}' on repository '#{repository}'." unless newrev =~ /^[0-9a-f]{40}$/ | |
return newrev | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment