checkout: show summary by default and introduce --show-changes flag (#3401)

* checkout: implement --show-changes flag to show detailed checkout details
Show summary by default on checkout

checkout: show directory modified even when files are removed from inside it

checkout: refactor template logic

checkout: change output format

checkout: do not show summary if nothing's changed

checkout: do not show summary if show_changes is specified

checkout: show '/' at the end if it's a directory

rename variable name

test: cover stats for checkout

checkout: show relink as not modified

checkout: remove unwanted message during empty checkout

pull: show summary on checkout

import/get: change external_repo to catch CheckoutError

fix tests and check if path is url

checkout: support external deps/outputs

tests: checkout on external outputs

* fix tests

* checkout: make show changes default and introduce summary flag to show summary

* address suggestions

* exceptions: remove extra spacing on erorr

* Update dvc/command/checkout.py

Co-Authored-By: Jorge Orpinel <[email protected]>

Co-authored-by: Jorge Orpinel <[email protected]>
This commit is contained in:
Saugat Pachhai
2020-03-16 16:29:36 +02:00
committed by GitHub
co-authored by Jorge Orpinel
parent d2734dfe1e
commit 066ccea733
12 changed files with 514 additions and 75 deletions
+8 -4
View File
@@ -3,7 +3,8 @@ import logging
from dvc.command.base import append_doc_link
from dvc.command.base import CmdBase
from dvc.exceptions import DvcException
from dvc.command.checkout import log_summary
from dvc.exceptions import DvcException, CheckoutError
logger = logging.getLogger(__name__)
@@ -19,7 +20,7 @@ class CmdDataBase(CmdBase):
class CmdDataPull(CmdDataBase):
def run(self):
try:
processed_files_count = self.repo.pull(
stats = self.repo.pull(
targets=self.args.targets,
jobs=self.args.jobs,
remote=self.args.remote,
@@ -29,10 +30,13 @@ class CmdDataPull(CmdDataBase):
force=self.args.force,
recursive=self.args.recursive,
)
except DvcException:
log_summary(stats)
except (CheckoutError, DvcException) as exc:
log_summary(getattr(exc, "stats", {}))
logger.exception("failed to pull data from the cloud")
return 1
self.check_up_to_date(processed_files_count)
self.check_up_to_date(stats["downloaded"])
return 0