<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test/deploy/scm/mercurial_test.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,7 @@
 *SVN*
 
+* Add support for password prompts from the Mercurial SCM [ches]
+
 * Add support for :max_hosts option in task definition or run() [Rob Holland &lt;rob@inversepath.com&gt;]
 
 * Distributed git support for better operability with remote_cache strategy [voidlock]</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -70,24 +70,25 @@ module Capistrano
           logger.info &quot;[#{stream}] #{text}&quot;
           case text
           when /^user:/mi
-            if variable(:scm_user)
-              &quot;#{variable(:scm_user)}\n&quot;
+            # support :scm_user for backwards compatibility of this module
+            if user = variable(:scm_username) || variable(:scm_user)
+              &quot;#{user}\n&quot;
             else
-              raise &quot;No variable :scm_user specified and Mercurial asked!\n&quot; +
+              raise &quot;No variable :scm_username specified and Mercurial asked!\n&quot; +
                 &quot;Prompt was: #{text}&quot;
             end
-          when /^password:/mi
-            if variable(:scm_password)
-              &quot;#{variable(:scm_password)}\n&quot;
-            else
+          when /\bpassword:/mi
+            unless pass = scm_password_or_prompt
+              # fall back on old behavior of erroring out with msg
               raise &quot;No variable :scm_password specified and Mercurial asked!\n&quot; +
                 &quot;Prompt was: #{text}&quot;
             end
+            &quot;#{pass}\n&quot;
           when /yes\/no/i
             &quot;yes\n&quot;
           end
         end
-
+        
         private
 
         # Fine grained mercurial commands
@@ -122,6 +123,12 @@ module Capistrano
             else        &quot;--verbose&quot;
           end
         end
+        
+        # honor Cap 2.1+'s :scm_prefer_prompt if present
+        def scm_password_or_prompt
+          @scm_password_or_prompt ||= variable(:scm_password) ||
+            (Capistrano::CLI.password_prompt(&quot;hg password: &quot;) if variable(:scm_prefer_prompt))
+        end
 
       end
     end</diff>
      <filename>lib/capistrano/recipes/deploy/scm/mercurial.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>c6ff8b9fe617ef6fa02939bc56a686c81a2cb4f6</id>
    </parent>
  </parents>
  <author>
    <name>Jamis Buck</name>
    <email>jamis@37signals.com</email>
  </author>
  <url>http://github.com/jamis/capistrano/commit/07d777b74625a5373e326b43304c592b05ff456f</url>
  <id>07d777b74625a5373e326b43304c592b05ff456f</id>
  <committed-date>2008-02-22T20:04:27-08:00</committed-date>
  <authored-date>2008-02-22T20:04:27-08:00</authored-date>
  <message>Add support for password prompts for Mercurial SCM (closes #11187)


git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@8925 5ecf4fe2-1ee6-0310-87b1-e25e094e27de</message>
  <tree>3e736634176f91b7c847d949687fd7cfd8a62622</tree>
  <committer>
    <name>Jamis Buck</name>
    <email>jamis@37signals.com</email>
  </committer>
</commit>
