Implements the Capistrano SCM interface for the Mercurial revision control system (www.selenic.com/mercurial/). Latest updates at tackletechnology.org/oss/cap2-mercurial
Clone the repository and update to the specified changeset.
# File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 25 def checkout(changeset, destination) clone(destination) + " && " + update(changeset, destination) end
Compute the difference between the two changesets from and to as a unified diff.
# File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 42 def diff(from, to=nil) scm :diff, "--rev #{from}", (to ? "--rev #{to}" : nil) end
One day we will have hg archive, although i think its not needed
# File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 35 def export(revision, destination) raise NotImplementedError, "`diff' is not implemented by #{self.class.name}" + "use checkout strategy" end
Determine response for SCM prompts user/pass can come from ssh and http distribution methods yes/no is for when ssh asks you about fingerprints
# File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 69 def handle_data(state, stream, text) host = state[:channel][:host] logger.info "[#{host} :: #{stream}] #{text}" case text when /^user:/i # support :scm_user for backwards compatibility of this module if user = variable(:scm_username) || variable(:scm_user) "#{user}\n" else raise "No variable :scm_username specified and Mercurial asked!\n" + "Prompt was: #{text}" end when /\bpassword:/i unless pass = scm_password_or_prompt # fall back on old behavior of erroring out with msg raise "No variable :scm_password specified and Mercurial asked!\n" + "Prompt was: #{text}" end "#{pass}\n" when /yes\/no/ "yes\n" end end
For mercurial HEAD == tip except that it bases this assumption on what tip is in the current repository (so push before you deploy)
# File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 20 def head variable(:branch) || "tip" end
Return a log of all changes between the two specified changesets, from and to, inclusive or the log for from if to is omitted.
# File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 50 def log(from, to=nil) scm :log, verbose, "--rev #{from}" + (to ? ":#{to}" : "") end
Generated with the Darkfish Rdoc Generator 2.