Skip to content

Commit

Permalink
update after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Sep 28, 2019
1 parent b5272d0 commit 5163b0d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion dvc/command/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def run(self):
total=len(self.args.targets), desc="Adding", unit="file"
) as pbar:
for target in self.args.targets:
stages = self.repo.add(
self.repo.add(
target,
recursive=self.args.recursive,
no_commit=self.args.no_commit,
Expand Down
16 changes: 6 additions & 10 deletions dvc/repo/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,7 @@ def add(repo, target, recursive=False, no_commit=False, fname=None, pbar=None):
)

with repo.state:
stages = _create_stages(
repo,
targets,
fname,
callback=pbar.update_desc if pbar is not None else None
)
stages = _create_stages(repo, targets, fname, pbar=pbar)

repo.check_modified_graph(stages)

Expand Down Expand Up @@ -72,18 +67,19 @@ def _find_all_targets(repo, target, recursive):
return [target]


def _create_stages(repo, targets, fname, callback=None):
def _create_stages(repo, targets, fname, pbar=None):
stages = []

for out in targets:
stage = Stage.create(repo, outs=[out], add=True, fname=fname)

if not stage:
if pbar is not None:
pbar.total -= 1
continue

stages.append(stage)

if callback is not None:
callback(out)
if pbar is not None:
pbar.update_desc(out)

return stages

0 comments on commit 5163b0d

Please sign in to comment.