mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
gc: introduce -c|--cloud
Fixes #876 Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
@@ -314,6 +314,14 @@ def parse_args(argv=None):
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='Collect garbage for all branches.')
|
||||
gc_parser.add_argument('-c',
|
||||
'--cloud',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='Collect garbage in remote repository')
|
||||
gc_parser.add_argument('-r',
|
||||
'--remote',
|
||||
help='Remote repository to collect garbage in')
|
||||
gc_parser.set_defaults(func=CmdGC)
|
||||
|
||||
# Config
|
||||
|
||||
+3
-1
@@ -3,5 +3,7 @@ from dvc.command.common.base import CmdBase
|
||||
|
||||
class CmdGC(CmdBase):
|
||||
def run(self):
|
||||
self.project.gc()
|
||||
self.project.gc(all_branches=self.args.all_branches,
|
||||
cloud=self.args.cloud,
|
||||
remote=self.args.remote)
|
||||
return 0
|
||||
|
||||
+4
-1
@@ -291,7 +291,7 @@ class Project(object):
|
||||
|
||||
return cache
|
||||
|
||||
def gc(self, all_branches=False):
|
||||
def gc(self, all_branches=False, cloud=False, remote=None):
|
||||
clist = self._used_cache(target=None, all_branches=all_branches)
|
||||
self.cache.local.gc(clist)
|
||||
|
||||
@@ -310,6 +310,9 @@ class Project(object):
|
||||
if self.cache.azure:
|
||||
self.cache.azure.gc(clist)
|
||||
|
||||
if cloud:
|
||||
self.cloud._get_cloud(remote).gc(clist)
|
||||
|
||||
def push(self, target=None, jobs=1, remote=None, all_branches=False):
|
||||
self.cloud.push(self._used_cache(target, all_branches)['local'], jobs, remote=remote)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user