mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-19 15:28:28 +01:00
Merge pull request #2428 from pared/2356
repo.active_stages should return active stages
This commit is contained in:
+1
-20
@@ -164,7 +164,7 @@ class Repo(object):
|
||||
from dvc.stage import Stage
|
||||
|
||||
if not target or (recursive and os.path.isdir(target)):
|
||||
return self.active_stages(target)
|
||||
return self.stages(target)
|
||||
|
||||
stage = Stage.load(self, target)
|
||||
if not with_deps:
|
||||
@@ -183,7 +183,6 @@ class Repo(object):
|
||||
self,
|
||||
targets=None,
|
||||
all_branches=False,
|
||||
active=True,
|
||||
with_deps=False,
|
||||
all_tags=False,
|
||||
remote=None,
|
||||
@@ -225,20 +224,10 @@ class Repo(object):
|
||||
stages.extend(
|
||||
self.collect(target, with_deps=with_deps)
|
||||
)
|
||||
elif active:
|
||||
stages = self.active_stages()
|
||||
else:
|
||||
stages = self.stages()
|
||||
|
||||
for stage in stages:
|
||||
if active and not targets and stage.locked:
|
||||
logger.warning(
|
||||
"DVC-file '{path}' is locked. Its dependencies are"
|
||||
" not going to be pushed/pulled/fetched.".format(
|
||||
path=stage.relpath
|
||||
)
|
||||
)
|
||||
|
||||
for out in stage.outs:
|
||||
scheme = out.path_info.scheme
|
||||
used_cache = out.get_used_cache(
|
||||
@@ -413,14 +402,6 @@ class Repo(object):
|
||||
|
||||
return stages
|
||||
|
||||
def active_stages(self, from_directory=None):
|
||||
import networkx as nx
|
||||
|
||||
stages = []
|
||||
for G in self.pipelines(from_directory):
|
||||
stages.extend(list(nx.get_node_attributes(G, "stage").values()))
|
||||
return stages
|
||||
|
||||
def find_outs_by_path(self, path, outs=None, recursive=False):
|
||||
if not outs:
|
||||
# there is no `from_directory=path` argument because some data
|
||||
|
||||
@@ -21,9 +21,7 @@ def _merge_cache_lists(clists):
|
||||
|
||||
def _load_all_used_cache(
|
||||
repos,
|
||||
target=None,
|
||||
all_branches=False,
|
||||
active=True,
|
||||
with_deps=False,
|
||||
all_tags=False,
|
||||
remote=None,
|
||||
@@ -37,7 +35,6 @@ def _load_all_used_cache(
|
||||
repo_clist = repo.used_cache(
|
||||
targets=None,
|
||||
all_branches=all_branches,
|
||||
active=False,
|
||||
with_deps=with_deps,
|
||||
all_tags=all_tags,
|
||||
remote=remote,
|
||||
@@ -76,9 +73,7 @@ def gc(
|
||||
|
||||
all_clists = _load_all_used_cache(
|
||||
all_repos,
|
||||
target=None,
|
||||
all_branches=all_branches,
|
||||
active=False,
|
||||
with_deps=with_deps,
|
||||
all_tags=all_tags,
|
||||
remote=remote,
|
||||
|
||||
Reference in New Issue
Block a user