dvc-utils 0.3.0__py3-none-any.whl → 0.3.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
dvc_utils/diff.py CHANGED
@@ -18,6 +18,7 @@ from dvc_utils.path import dvc_paths, dvc_cache_path
18
18
  short_help='Diff a DVC-tracked file at two commits (or one commit vs. current worktree), optionally passing both through another command first',
19
19
  no_args_is_help=True,
20
20
  )
21
+ @option('-b/-B', '--both/--no-both', default=False, help='Merge stderr into stdout in pipeline commands (like shell `2>&1`), so stderr is included in diff output. Default: stderr shown only on command failures.')
21
22
  @option('-c/-C', '--color/--no-color', default=None, help='Force or prevent colorized output')
22
23
  @option('-r', '--refspec', help='<commit 1>..<commit 2> (compare two commits) or <commit> (compare <commit> to the worktree)')
23
24
  @option('-R', '--ref', help='Shorthand for `-r <ref>^..<ref>`, i.e. inspect a specific commit (vs. its parent)')
@@ -29,6 +30,7 @@ from dvc_utils.path import dvc_paths, dvc_cache_path
29
30
  @option('-x', '--exec-cmd', 'exec_cmds', multiple=True, help='Command(s) to execute before diffing; alternate syntax to passing commands as positional arguments')
30
31
  @argument('args', metavar='[exec_cmd...] <path>', nargs=-1)
31
32
  def dvc_diff(
33
+ both: bool,
32
34
  color: bool | None,
33
35
  refspec: str | None,
34
36
  ref: str | None,
@@ -111,14 +113,16 @@ def dvc_diff(
111
113
  cmds1 = [ shlex.split(cmd) for cmd in cmds1 ]
112
114
  cmds2 = [ shlex.split(cmd) for cmd in cmds2 ]
113
115
 
114
- join_pipelines(
116
+ returncode = join_pipelines(
115
117
  base_cmd=['diff', *diff_args],
116
118
  cmds1=cmds1,
117
119
  cmds2=cmds2,
118
120
  verbose=verbose,
119
121
  shell=shell,
120
122
  executable=shell_executable,
123
+ both=both,
121
124
  )
125
+ exit(returncode)
122
126
  else:
123
127
  res = process.run('diff', *diff_args, path1 or '/dev/null', path2 or '/dev/null', log=log, check=False)
124
128
  exit(res.returncode)
dvc_utils/path.py CHANGED
@@ -60,7 +60,8 @@ def dvc_md5(
60
60
  relpath = basename(dvc_path)
61
61
  if relpath.endswith(".dvc"):
62
62
  relpath = relpath[:-len(".dvc")]
63
- while cur_dir and cur_dir != '.':
63
+ prev_dir = None
64
+ while cur_dir and cur_dir != '.' and cur_dir != prev_dir:
64
65
  dir_cache_path = dvc_cache_path(ref=git_ref, dvc_path=f"{cur_dir}.dvc", log=log)
65
66
  if dir_cache_path:
66
67
  with open(dir_cache_path, 'r') as f:
@@ -71,6 +72,7 @@ def dvc_md5(
71
72
  else:
72
73
  raise RuntimeError(f"{relpath=} not found in DVC-tracked dir {cur_dir}")
73
74
  relpath = join(basename(cur_dir), relpath)
75
+ prev_dir = cur_dir
74
76
  cur_dir = dirname(cur_dir)
75
77
  return None
76
78
  dvc_obj = yaml.safe_load(dvc_spec)
@@ -1,22 +1,23 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dvc-utils
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: CLI for diffing DVC-tracked files at two commits (or one commit vs. current worktree), optionally passing both through another command first
5
- Author-email: Ryan Williams <ryan@runsascoded.com>
6
- License: MIT
7
5
  Project-URL: Homepage, https://github.com/runsascoded/dvc-utils
8
6
  Project-URL: Author URL, https://github.com/ryan-williams
9
- Requires-Python: >=3.9
10
- Description-Content-Type: text/markdown
7
+ Author-email: Ryan Williams <ryan@runsascoded.com>
8
+ License: MIT
11
9
  License-File: LICENSE
10
+ Requires-Python: >=3.10
12
11
  Requires-Dist: click
13
- Requires-Dist: dffs>=0.0.5
12
+ Requires-Dist: dffs>=0.0.7
14
13
  Requires-Dist: pyyaml
15
14
  Requires-Dist: utz>=0.20.0
16
15
  Provides-Extra: ci
17
- Requires-Dist: bmdf==0.5.2; extra == "ci"
18
- Requires-Dist: dvc-s3; extra == "ci"
19
- Dynamic: license-file
16
+ Requires-Dist: bmdf==0.5.2; extra == 'ci'
17
+ Requires-Dist: dvc-s3; extra == 'ci'
18
+ Provides-Extra: test
19
+ Requires-Dist: pytest>=7.0.0; extra == 'test'
20
+ Description-Content-Type: text/markdown
20
21
 
21
22
  # dvc-utils
22
23
  Diff [DVC] files, optionally piping through other commands first.
@@ -61,6 +62,10 @@ dvc-diff
61
62
  # optional) at HEAD (last committed value) vs. the current worktree content.
62
63
  #
63
64
  # Options:
65
+ # -b, --both / -B, --no-both Merge stderr into stdout in pipeline commands
66
+ # (like shell `2>&1`), so stderr is included in
67
+ # diff output. Default: stderr shown only on
68
+ # command failures.
64
69
  # -c, --color / -C, --no-color Force or prevent colorized output
65
70
  # -r, --refspec TEXT <commit 1>..<commit 2> (compare two commits)
66
71
  # or <commit> (compare <commit> to the worktree)
@@ -0,0 +1,11 @@
1
+ dvc_utils/__init__.py,sha256=Q9_9py_bah16WN6RIryNMelBvG9IJW1B1Sm2PEU87Yk,92
2
+ dvc_utils/cli.py,sha256=et2OeEWJeY0XUuStMVd8qmjtOgDbXl9esn3KYZCQFSI,318
3
+ dvc_utils/diff.py,sha256=wUCbVU4HvEP_YzcsHeL9RMi3yHvNIf2TqAEWSsZTzTo,5368
4
+ dvc_utils/main.py,sha256=cfbwebEc9Auh9DXyah31kvd9Br_uCsUxzOXkucfiSnM,119
5
+ dvc_utils/path.py,sha256=gC9LMCaAVcfCmcOAt7XI_gtk25U6CKoQSDKLRBR4-Qg,3034
6
+ dvc_utils/sync.py,sha256=gDwo0Z4lMK--xRwsACIpJRWS5rF6g7Wou0LJRxNd6b4,481
7
+ dvc_utils-0.3.2.dist-info/METADATA,sha256=9008bq-4FbTfazTVUueQEBQHrIEg2HgaqN6GDXNGxrM,15276
8
+ dvc_utils-0.3.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
+ dvc_utils-0.3.2.dist-info/entry_points.txt,sha256=VHnkBNH2bPbP1wX8-rKK_T13f3e9tnmAGBcrP0hjTr0,85
10
+ dvc_utils-0.3.2.dist-info/licenses/LICENSE,sha256=ZS8AReay7xmQzBAHwxIuTouGXz3SKgUa2_Sz8Ip0EzQ,1070
11
+ dvc_utils-0.3.2.dist-info/RECORD,,
@@ -1,5 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.8.0)
2
+ Generator: hatchling 1.27.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
-
@@ -1,12 +0,0 @@
1
- dvc_utils/__init__.py,sha256=Q9_9py_bah16WN6RIryNMelBvG9IJW1B1Sm2PEU87Yk,92
2
- dvc_utils/cli.py,sha256=et2OeEWJeY0XUuStMVd8qmjtOgDbXl9esn3KYZCQFSI,318
3
- dvc_utils/diff.py,sha256=7YDlsIsVeaU6QEWjhzd2zM9_6eB6mr50kjCKcGNBa0U,5070
4
- dvc_utils/main.py,sha256=cfbwebEc9Auh9DXyah31kvd9Br_uCsUxzOXkucfiSnM,119
5
- dvc_utils/path.py,sha256=tdigsKTCZPhCIb9wRX4e_tj1lUxa2gm6lXERlfb8qY4,2955
6
- dvc_utils/sync.py,sha256=gDwo0Z4lMK--xRwsACIpJRWS5rF6g7Wou0LJRxNd6b4,481
7
- dvc_utils-0.3.0.dist-info/licenses/LICENSE,sha256=ZS8AReay7xmQzBAHwxIuTouGXz3SKgUa2_Sz8Ip0EzQ,1070
8
- dvc_utils-0.3.0.dist-info/METADATA,sha256=iZCUEBwGGx3kilieHZwkJGqNtVRe11kJjNnprVTiJP4,14941
9
- dvc_utils-0.3.0.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
10
- dvc_utils-0.3.0.dist-info/entry_points.txt,sha256=VHnkBNH2bPbP1wX8-rKK_T13f3e9tnmAGBcrP0hjTr0,85
11
- dvc_utils-0.3.0.dist-info/top_level.txt,sha256=jT0-PJa2t_eFRE9rn-52AjdnZ8nQeEHllf2kJmaGh80,10
12
- dvc_utils-0.3.0.dist-info/RECORD,,
@@ -1 +0,0 @@
1
- dvc_utils