add depth option to ansible-pull

Allows shallow checkouts in ansible-pull by adding `--depth 1` (or higher number)
This commit is contained in:
Robin Roth 2015-12-10 11:16:21 +01:00
parent 30e729557f
commit c20c1a6d49

View file

@ -80,6 +80,8 @@ class PullCLI(CLI):
help='directory to checkout repository to')
self.parser.add_option('-U', '--url', dest='url', default=None,
help='URL of the playbook repository')
self.parser.add_option('--depth', dest='depth', default=None,
help='Depth of checkout, shallow checkout if greater or equal 1 . Defaults to full checkout.')
self.parser.add_option('-C', '--checkout', dest='checkout',
help='branch/tag/commit to checkout. ' 'Defaults to behavior of repository module.')
self.parser.add_option('--accept-host-key', default=False, dest='accept_host_key', action='store_true',
@ -154,6 +156,10 @@ class PullCLI(CLI):
if self.options.verify:
repo_opts += ' verify_commit=yes'
if self.options.depth:
repo_opts += ' depth=%s' % self.options.depth
path = module_loader.find_plugin(self.options.module_name)
if path is None: