Guest User

Untitled

a guest
Jun 18th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. 2.5.5
  2. # Getting the actual commit id, in case we were passed a tag
  3. # or partial sha or something - it will return the sha if you pass a sha, too
  4. def query_revision(revision)
  5. raise ArgumentError, "Deploying remote branches is no longer supported. 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\//
  6. return revision if revision =~ /^[0-9a-f]{40}$/
  7. command = scm('ls-remote', repository, revision)
  8. result = yield(command)
  9. revdata = result.split(/[\t\n]/)
  10. newrev = nil
  11. revdata.each_slice(2) do |refs|
  12. rev, ref = *refs
  13. if ref.sub(/refs\/.*?\//, '').strip == revision
  14. newrev = rev
  15. break
  16. end
  17. end
  18. raise "Unable to resolve revision for '#{revision}' on repository '#{repository}'." unless newrev =~ /^[0-9a-f]{40}$/
  19. return newrev
  20. end
  21.  
  22. 2.5.0
  23.  
  24. # Getting the actual commit id, in case we were passed a tag
  25. # or partial sha or something - it will return the sha if you pass a sha, too
  26. def query_revision(revision)
  27. 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\//
  28. return revision if revision =~ /^[0-9a-f]{40}$/
  29. command = scm('ls-remote', repository, revision)
  30. result = yield(command)
  31. revdata = result.split("\t")
  32. newrev = revdata[0]
  33. raise "Unable to resolve revision for '#{revision}' on repository '#{repository}'." unless newrev =~ /^[0-9a-f]{40}$/
  34. return newrev
  35. end
Add Comment
Please, Sign In to add comment