From 740a33bcabfd2ce686811e1e786781fb3ed5ba3e Mon Sep 17 00:00:00 2001
From: Mads Weitling <mads.weitling@gmail.com>
Date: Thu, 10 Oct 2013 17:15:04 +0200
Subject: [PATCH 1/2] Fix 'hg module fails with: AttributeError:
 'AnsibleModule' object has no attribute 'parames''

---
 library/source_control/hg | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/library/source_control/hg b/library/source_control/hg
index 216116a1df9..98dbe9e66cf 100644
--- a/library/source_control/hg
+++ b/library/source_control/hg
@@ -47,7 +47,7 @@ options:
     revision:
         description:
             - Equivalent C(-r) option in hg command which could be the changeset, revision number,
-              branch name or even tag. 
+              branch name or even tag.
         required: false
         default: "default"
         aliases: [ version ]
@@ -97,7 +97,7 @@ def _set_hgrc(hgrc, vals):
         if not parser.has_section(section):
             parser.add_section(section)
         parser.set(section, option, value)
-    
+
     f = open(hgrc, 'w')
     parser.write(f)
     f.close()
@@ -106,7 +106,7 @@ def _set_hgrc(hgrc, vals):
 def _undo_hgrc(hgrc, vals):
     parser = ConfigParser.SafeConfigParser()
     parser.read(hgrc)
-     
+
     for each in vals:
         (section, option, value) = each
         if parser.has_section(section):
@@ -168,17 +168,17 @@ class Hg(object):
         after = self.has_local_mods()
         if before != after and not after:   # no more local modification
             return True
-            
+
     def purge(self):
         hgrc = os.path.join(self.dest, '.hg/hgrc')
         purge_option = [('extensions', 'purge', '')]
         _set_hgrc(hgrc, purge_option)   # enable purge extension
-        
+
         # before purge, find out if there are any untracked files
         (rc1, out1, err1) = self._list_untracked()
         if rc1 != 0:
             self.module.fail_json(msg=err1)
-        
+
         # there are some untrackd files
         if out1 != '':
             (rc2, out2, err2) = self._command(['purge', '-R', self.dest])
@@ -234,9 +234,9 @@ def main():
     revision = module.params['revision']
     force = module.params['force']
     purge = module.params['purge']
-    hg_path = module.parames['executable'] or module.get_bin_path('hg', True)
+    hg_path = module.params['executable'] or module.get_bin_path('hg', True)
     hgrc = os.path.join(dest, '.hg/hgrc')
-   
+
     # initial states
     before = ''
     changed = False

From ce799b9e0e71fc3371ad58bd15ba83bfe86ce45b Mon Sep 17 00:00:00 2001
From: Mads Weitling <mads.weitling@gmail.com>
Date: Thu, 10 Oct 2013 15:46:10 +0000
Subject: [PATCH 2/2] Fix Hg.__init__(...) reading value from self.hg_path

---
 library/source_control/hg | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/library/source_control/hg b/library/source_control/hg
index 98dbe9e66cf..bb2f55effee 100644
--- a/library/source_control/hg
+++ b/library/source_control/hg
@@ -124,7 +124,7 @@ class Hg(object):
         self.dest = dest
         self.repo = repo
         self.revision = revision
-        self.hg_path = self.hg_path
+        self.hg_path = hg_path
 
     def _command(self, args_list):
         (rc, out, err) = self.module.run_command([self.hg_path] + args_list)