Add support for 'update' parameter to hg module

pull/18777/head
Chris AtLee 10 years ago committed by Matt Clay
parent 807feb3ac4
commit e7af5d2384

@ -65,6 +65,13 @@ options:
required: false required: false
default: "no" default: "no"
choices: [ "yes", "no" ] choices: [ "yes", "no" ]
update:
required: false
default: "yes"
choices: [ "yes", "no" ]
version_added: "2.0"
description:
- If C(no), do not retrieve new revisions from the origin repository
executable: executable:
required: false required: false
default: null default: null
@ -210,6 +217,7 @@ def main():
revision = dict(default=None, aliases=['version']), revision = dict(default=None, aliases=['version']),
force = dict(default='no', type='bool'), force = dict(default='no', type='bool'),
purge = dict(default='no', type='bool'), purge = dict(default='no', type='bool'),
update = dict(default='yes', type='bool'),
executable = dict(default=None), executable = dict(default=None),
), ),
) )
@ -218,6 +226,7 @@ def main():
revision = module.params['revision'] revision = module.params['revision']
force = module.params['force'] force = module.params['force']
purge = module.params['purge'] purge = module.params['purge']
update = module.params['update']
hg_path = module.params['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') hgrc = os.path.join(dest, '.hg/hgrc')
@ -234,6 +243,9 @@ def main():
(rc, out, err) = hg.clone() (rc, out, err) = hg.clone()
if rc != 0: if rc != 0:
module.fail_json(msg=err) module.fail_json(msg=err)
elif not update:
# Just return having found a repo already in the dest path
before = hg.get_revision()
elif hg.at_revision: elif hg.at_revision:
# no update needed, don't pull # no update needed, don't pull
before = hg.get_revision() before = hg.get_revision()

Loading…
Cancel
Save