Class | Capistrano::Deploy::SCM::Mercurial |
In: |
lib/capistrano/recipes/deploy/scm/mercurial.rb
lib/capistrano/recipes/deploy/scm/mercurial.rb |
Parent: | Base |
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 25: def checkout(changeset, destination) 26: clone(destination) + " && " + update(changeset, destination) 27: end
Clone the repository and update to the specified changeset.
# File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 25 25: def checkout(changeset, destination) 26: clone(destination) + " && " + update(changeset, destination) 27: end
One day we will have hg archive, although i think its not needed
# File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 35 35: def export(revision, destination) 36: raise NotImplementedError, "`diff' is not implemented by #{self.class.name}" + 37: "use checkout strategy" 38: end
One day we will have hg archive, although i think its not needed
# File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 35 35: def export(revision, destination) 36: raise NotImplementedError, "`diff' is not implemented by #{self.class.name}" + 37: "use checkout strategy" 38: 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 69: def handle_data(state, stream, text) 70: host = state[:channel][:host] 71: logger.info "[#{host} :: #{stream}] #{text}" 72: case text 73: when /^user:/mi 74: # support :scm_user for backwards compatibility of this module 75: if user = variable(:scm_username) || variable(:scm_user) 76: "#{user}\n" 77: else 78: raise "No variable :scm_username specified and Mercurial asked!\n" + 79: "Prompt was: #{text}" 80: end 81: when /\bpassword:/mi 82: unless pass = scm_password_or_prompt 83: # fall back on old behavior of erroring out with msg 84: raise "No variable :scm_password specified and Mercurial asked!\n" + 85: "Prompt was: #{text}" 86: end 87: "#{pass}\n" 88: when /yes\/no/i 89: "yes\n" 90: end 91: 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 69: def handle_data(state, stream, text) 70: host = state[:channel][:host] 71: logger.info "[#{host} :: #{stream}] #{text}" 72: case text 73: when /^user:/mi 74: # support :scm_user for backwards compatibility of this module 75: if user = variable(:scm_username) || variable(:scm_user) 76: "#{user}\n" 77: else 78: raise "No variable :scm_username specified and Mercurial asked!\n" + 79: "Prompt was: #{text}" 80: end 81: when /\bpassword:/mi 82: unless pass = scm_password_or_prompt 83: # fall back on old behavior of erroring out with msg 84: raise "No variable :scm_password specified and Mercurial asked!\n" + 85: "Prompt was: #{text}" 86: end 87: "#{pass}\n" 88: when /yes\/no/i 89: "yes\n" 90: end 91: 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 20: def head 21: configuration[:branch] || "tip" 22: 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 20: def head 21: configuration[:branch] || "tip" 22: end
Translates a tag to a changeset if needed or just returns changeset.
# File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 58 58: def query_revision(changeset) 59: cmd = scm :log, 60: verbose, 61: "-r #{changeset}", 62: "--template '{node|short}'" 63: yield cmd 64: end
Translates a tag to a changeset if needed or just returns changeset.
# File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 58 58: def query_revision(changeset) 59: cmd = scm :log, 60: verbose, 61: "-r #{changeset}", 62: "--template '{node|short}'" 63: yield cmd 64: end
Pull from the repository and update to the specified changeset.
# File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 30 30: def sync(changeset, destination) 31: pull(destination) + " && " + update(changeset, destination) 32: end