dvc: add support for dvc diff command

Some summary statistics regarding the folder/file.
How many files were added/deleted/modified. How size changed.
TO DO things:
1)To  support for detecting diff after `dvc move`
command.
2)To add unit tests.
This commit is contained in:
Zhanibek
2019-04-05 15:02:28 +06:00
parent 2699a47f3e
commit c2639cfb3a
6 changed files with 350 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
from __future__ import unicode_literals
from dvc.command.base import CmdBase
class CmdMove(CmdBase):
def run(self):
self.repo.diff(
self.args.target, a_ref=self.args.a_ref, b_ref=self.args.b_ref
)
return 0
def add_parser(subparsers, parent_parser):
description = (
"show diff of a data file or a directory that "
"is under DVC control. Some basic statistics "
"summary, how many files were deleted/changed."
)
help = "Show a diff of a DVC controlled data file or a directory."
diff_parser = subparsers.add_parser(
"diff", parents=[parent_parser], description=description, help=help
)
diff_parser.add_argument(
"target", help="Source path to a data file or directory."
)
diff_parser.add_argument(
"a_ref", help="Git tag/reference from which diff calculates"
)
diff_parser.add_argument(
"b_ref",
help="Git tag/reference till which diff calculates",
nargs="?",
default=None,
)
diff_parser.set_defaults(func=CmdMove)