sync: convert -R option to boolean

This commit is contained in:
pared
2019-01-21 18:58:45 +01:00
parent 7400046240
commit 761a6c8f13
2 changed files with 30 additions and 19 deletions
+9 -3
View File
@@ -30,7 +30,7 @@ class CmdDataPull(CmdDataBase):
all_tags=self.args.all_tags,
with_deps=self.args.with_deps,
force=self.args.force,
from_directory=self.args.recursive)
recursive=self.args.recursive)
except Exception:
logger.error('failed to pull data from the cloud')
return 1
@@ -47,7 +47,7 @@ class CmdDataPush(CmdDataBase):
all_branches=self.args.all_branches,
all_tags=self.args.all_tags,
with_deps=self.args.with_deps,
from_directory=self.args.recursive)
recursive=self.args.recursive)
except Exception:
logger.error('failed to push data to the cloud')
return 1
@@ -64,7 +64,7 @@ class CmdDataFetch(CmdDataBase):
all_branches=self.args.all_branches,
all_tags=self.args.all_tags,
with_deps=self.args.with_deps,
from_directory=self.args.recursive)
recursive=self.args.recursive)
except Exception:
logger.error('failed to fetch data from the cloud')
return 1
@@ -133,6 +133,8 @@ def add_parser(subparsers, parent_parser):
pull_parser.add_argument(
'-R',
'--recursive',
action='store_true',
default=False,
help='Pull cache for subdirectories of the specified directory.')
pull_parser.set_defaults(func=CmdDataPull)
@@ -168,6 +170,8 @@ def add_parser(subparsers, parent_parser):
push_parser.add_argument(
'-R',
'--recursive',
action='store_true',
default=False,
help='Push cache from subdirectories of specified directory.')
push_parser.set_defaults(func=CmdDataPush)
@@ -204,6 +208,8 @@ def add_parser(subparsers, parent_parser):
fetch_parser.add_argument(
'-R',
'--recursive',
action='store_true',
default=False,
help='Fetch cache for subdirectories of specified directory.')
fetch_parser.set_defaults(func=CmdDataFetch)
+21 -16
View File
@@ -568,12 +568,14 @@ class Project(object):
target=None,
with_deps=False,
force=False,
from_directory=None):
all_stages = self.active_stages(from_directory)
stages = all_stages
recursive=False):
if target:
if target and not recursive:
all_stages = self.active_stages()
stages = self._collect(target, with_deps=with_deps)
else:
all_stages = self.active_stages(target)
stages = all_stages
with self.state:
self._cleanup_unused_links(all_stages)
@@ -695,7 +697,7 @@ class Project(object):
remote=None,
force=False,
jobs=None,
from_directory=None):
recursive=False):
cache = {}
cache['local'] = []
cache['s3'] = []
@@ -707,12 +709,15 @@ class Project(object):
for branch in self.scm.brancher(all_branches=all_branches,
all_tags=all_tags):
if target:
stages = self._collect(target,
with_deps=with_deps)
if recursive:
stages = self.stages(target)
else:
stages = self._collect(target,
with_deps=with_deps)
elif active:
stages = self.active_stages(from_directory)
stages = self.active_stages()
else:
stages = self.stages(from_directory)
stages = self.stages()
for stage in stages:
if active and not target and stage.locked:
@@ -836,7 +841,7 @@ class Project(object):
show_checksums=False,
with_deps=False,
all_tags=False,
from_directory=None):
recursive=False):
with self.state:
used = self._used_cache(target,
all_branches=all_branches,
@@ -845,7 +850,7 @@ class Project(object):
force=True,
remote=remote,
jobs=jobs,
from_directory=from_directory)['local']
recursive=recursive)['local']
self.cloud.push(used,
jobs,
remote=remote,
@@ -859,7 +864,7 @@ class Project(object):
show_checksums=False,
with_deps=False,
all_tags=False,
from_directory=None):
recursive=False):
with self.state:
used = self._used_cache(target,
all_branches=all_branches,
@@ -868,7 +873,7 @@ class Project(object):
force=True,
remote=remote,
jobs=jobs,
from_directory=from_directory)['local']
recursive=recursive)['local']
self.cloud.pull(used,
jobs,
remote=remote,
@@ -883,7 +888,7 @@ class Project(object):
with_deps=False,
all_tags=False,
force=False,
from_directory=None):
recursive=False):
self.fetch(target,
jobs,
remote=remote,
@@ -891,11 +896,11 @@ class Project(object):
all_tags=all_tags,
show_checksums=show_checksums,
with_deps=with_deps,
from_directory=from_directory)
recursive=recursive)
self.checkout(target=target,
with_deps=with_deps,
force=force,
from_directory=from_directory)
recursive=recursive)
def _local_status(self, target=None, with_deps=False):
status = {}