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

Methods

checkout   checkout   diff   diff   export   export   handle_data   handle_data   head   head   log   log   query_revision   query_revision   sync   sync  

Public Instance methods

Clone the repository and update to the specified changeset.

[Source]

    # 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.

[Source]

    # File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 25
25:         def checkout(changeset, destination)
26:           clone(destination) + " && " + update(changeset, destination)
27:         end

Compute the difference between the two changesets from and to as a unified diff.

[Source]

    # File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 42
42:         def diff(from, to=nil)
43:           scm :diff,
44:               "--rev #{from}",
45:               (to ? "--rev #{to}" : nil)
46:         end

Compute the difference between the two changesets from and to as a unified diff.

[Source]

    # File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 42
42:         def diff(from, to=nil)
43:           scm :diff,
44:               "--rev #{from}",
45:               (to ? "--rev #{to}" : nil)
46:         end

One day we will have hg archive, although i think its not needed

[Source]

    # 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

[Source]

    # 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

[Source]

    # 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

[Source]

    # 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)

[Source]

    # File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 20
20:         def head
21:           "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)

[Source]

    # File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 20
20:         def head
21:           "tip"
22:         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.

[Source]

    # File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 50
50:         def log(from, to=nil)
51:           scm :log,
52:               verbose,
53:               "--rev #{from}" +
54:               (to ? ":#{to}" : "")
55:         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.

[Source]

    # File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 50
50:         def log(from, to=nil)
51:           scm :log,
52:               verbose,
53:               "--rev #{from}" +
54:               (to ? ":#{to}" : "")
55:         end

Translates a tag to a changeset if needed or just returns changeset.

[Source]

    # 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.

[Source]

    # 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.

[Source]

    # File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 30
30:         def sync(changeset, destination)
31:           pull(destination) + " && " + update(changeset, destination)
32:         end

Pull from the repository and update to the specified changeset.

[Source]

    # File lib/capistrano/recipes/deploy/scm/mercurial.rb, line 30
30:         def sync(changeset, destination)
31:           pull(destination) + " && " + update(changeset, destination)
32:         end

[Validate]