class Vlad::Perforce
Constants
- VERSION
Public Instance Methods
checkout(revision, destination)
click to toggle source
Returns the p4 command that will checkout revision
into the
directory destination
.
# File lib/vlad/perforce.rb, line 11 def checkout(revision, destination) "#{p4_cmd} sync ...#{rev_no(revision)}" end
export(revision_or_source, destination)
click to toggle source
Returns the p4 command that will export revision
into the
directory directory
.
# File lib/vlad/perforce.rb, line 19 def export(revision_or_source, destination) if revision_or_source =~ /^(\d+|head)$/i then "(cd #{destination} && #{p4_cmd} sync ...#{rev_no(revision_or_source)})" else "cp -r #{revision_or_source} #{destination}" end end
rev_no(revision)
click to toggle source
Maps revision revision
into a Perforce revision.
# File lib/vlad/perforce.rb, line 38 def rev_no(revision) case revision.to_s when /head/i then "#head" when /^\d+$/ then "@#{revision}" else revision end end
revision(revision)
click to toggle source
Returns a command that maps human-friendly revision identifier
revision
into a Perforce revision
specification.
# File lib/vlad/perforce.rb, line 31 def revision(revision) "`#{p4_cmd} changes -s submitted -m 1 ...#{rev_no(revision)} | cut -f 2 -d\\ `" end