|
|
@ -23,8 +23,6 @@
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
|
|
import ConfigParser
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DOCUMENTATION = '''
|
|
|
|
DOCUMENTATION = '''
|
|
|
|
---
|
|
|
|
---
|
|
|
|
module: hg
|
|
|
|
module: hg
|
|
|
@ -92,6 +90,12 @@ EXAMPLES = '''
|
|
|
|
- hg: repo=https://bitbucket.org/user/repo1 dest=/home/user/repo1 revision=stable purge=yes
|
|
|
|
- hg: repo=https://bitbucket.org/user/repo1 dest=/home/user/repo1 revision=stable purge=yes
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# import module snippets
|
|
|
|
|
|
|
|
from ansible.module_utils.basic import AnsibleModule
|
|
|
|
|
|
|
|
from ansible.module_utils._text import to_native
|
|
|
|
|
|
|
|
|
|
|
|
class Hg(object):
|
|
|
|
class Hg(object):
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, module, dest, repo, revision, hg_path):
|
|
|
|
def __init__(self, module, dest, repo, revision, hg_path):
|
|
|
@ -123,7 +127,7 @@ class Hg(object):
|
|
|
|
if rc != 0:
|
|
|
|
if rc != 0:
|
|
|
|
self.module.fail_json(msg=err)
|
|
|
|
self.module.fail_json(msg=err)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return out.strip('\n')
|
|
|
|
return to_native(out).strip('\n')
|
|
|
|
|
|
|
|
|
|
|
|
def has_local_mods(self):
|
|
|
|
def has_local_mods(self):
|
|
|
|
now = self.get_revision()
|
|
|
|
now = self.get_revision()
|
|
|
@ -270,6 +274,5 @@ def main():
|
|
|
|
changed = True
|
|
|
|
changed = True
|
|
|
|
module.exit_json(before=before, after=after, changed=changed, cleaned=cleaned)
|
|
|
|
module.exit_json(before=before, after=after, changed=changed, cleaned=cleaned)
|
|
|
|
|
|
|
|
|
|
|
|
# import module snippets
|
|
|
|
if __name__ == '__main__':
|
|
|
|
from ansible.module_utils.basic import *
|
|
|
|
|
|
|
|
main()
|
|
|
|
main()
|
|
|
|