mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-03 07:18:26 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
70f4c44ec6 | ||
|
|
af37527560 | ||
|
|
71f8ffe13d | ||
|
|
06aad3e2b3 | ||
|
|
1e7df0c27e | ||
|
|
ce2d7c65db | ||
|
|
2075a99233 | ||
|
|
98a1a92fa3 | ||
|
|
16304b544f | ||
|
|
803a100f32 |
@@ -110,11 +110,11 @@ jobs:
|
||||
- name: Build the package
|
||||
uses: snapcore/action-build@v1
|
||||
id: snapcraft
|
||||
- name: Test the package
|
||||
run: |
|
||||
sudo snap install --dangerous --classic ${{ steps.snapcraft.outputs.snap }}
|
||||
dvc version
|
||||
sudo snap remove dvc
|
||||
# - name: Test the package
|
||||
# run: |
|
||||
# sudo snap install --dangerous --classic ${{ steps.snapcraft.outputs.snap }}
|
||||
# dvc version
|
||||
# sudo snap remove dvc
|
||||
- name: Publish to the edge channel
|
||||
uses: snapcore/action-publish@v1
|
||||
if: github.event_name == 'push'
|
||||
|
||||
@@ -78,6 +78,8 @@ class RepoDependency(LocalDependency):
|
||||
|
||||
def download(self, to, jobs=None):
|
||||
from dvc.checkout import checkout
|
||||
from dvc.config import NoRemoteError
|
||||
from dvc.exceptions import NoOutputOrStageError
|
||||
from dvc.objects import save
|
||||
from dvc.objects.stage import stage
|
||||
|
||||
@@ -87,6 +89,10 @@ class RepoDependency(LocalDependency):
|
||||
if self.def_repo.get(self.PARAM_REV_LOCK) is None:
|
||||
self.def_repo[self.PARAM_REV_LOCK] = repo.get_rev()
|
||||
path_info = PathInfo(repo.root_dir) / self.def_path
|
||||
try:
|
||||
repo.fetch([path_info.fspath], jobs=jobs, recursive=True)
|
||||
except (NoOutputOrStageError, NoRemoteError):
|
||||
pass
|
||||
obj = stage(
|
||||
odb, path_info, repo.repo_fs, jobs=jobs, follow_subrepos=False,
|
||||
)
|
||||
|
||||
@@ -261,8 +261,13 @@ class S3FileSystem(BaseFileSystem):
|
||||
return path_info.path in self._list_paths(path_info)
|
||||
|
||||
def info(self, path_info):
|
||||
# temporary workaround, will be removed when migrating to s3fs
|
||||
if self.isdir(path_info):
|
||||
return {"type": "directory"}
|
||||
|
||||
with self._get_obj(path_info) as obj:
|
||||
return {
|
||||
"type": "file",
|
||||
"etag": obj.e_tag.strip('"'),
|
||||
"size": obj.content_length,
|
||||
}
|
||||
|
||||
+11
-2
@@ -81,9 +81,18 @@ def _collect_dir(path_info, fs, name, state, **kwargs):
|
||||
return dir_info
|
||||
|
||||
|
||||
def get_dir_hash(path_info, fs, name, state, **kwargs):
|
||||
def get_dir_hash(path_info, fs, name, odb, state, **kwargs):
|
||||
from . import Tree
|
||||
|
||||
value = fs.info(path_info).get(name)
|
||||
if value:
|
||||
hash_info = HashInfo(name, value)
|
||||
try:
|
||||
Tree.load(odb, hash_info)
|
||||
return hash_info
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
dir_info = _collect_dir(path_info, fs, name, state, **kwargs)
|
||||
hash_info = Tree.save_dir_info(fs.repo.odb.local, dir_info)
|
||||
hash_info.size = dir_info.size
|
||||
@@ -125,7 +134,7 @@ def get_hash(path_info, fs, name, odb, **kwargs):
|
||||
return hash_info
|
||||
|
||||
if fs.isdir(path_info):
|
||||
hash_info = get_dir_hash(path_info, fs, name, state, **kwargs)
|
||||
hash_info = get_dir_hash(path_info, fs, name, odb, state, **kwargs)
|
||||
else:
|
||||
hash_info = get_file_hash(path_info, fs, name)
|
||||
|
||||
|
||||
@@ -13,12 +13,14 @@ def diff(repo, *args, a_rev=None, b_rev=None, **kwargs):
|
||||
return {}
|
||||
|
||||
if a_rev:
|
||||
old = _collect_experiment_commit(repo, a_rev)
|
||||
rev = repo.scm.resolve_rev(a_rev)
|
||||
old = _collect_experiment_commit(repo, rev)
|
||||
else:
|
||||
old = _collect_experiment_commit(repo, "HEAD")
|
||||
|
||||
if b_rev:
|
||||
new = _collect_experiment_commit(repo, b_rev)
|
||||
rev = repo.scm.resolve_rev(b_rev)
|
||||
new = _collect_experiment_commit(repo, rev)
|
||||
else:
|
||||
new = _collect_experiment_commit(repo, "workspace")
|
||||
|
||||
|
||||
@@ -61,7 +61,11 @@ def _track_stage(stage):
|
||||
|
||||
stage.repo.scm.track_file(stage.dvcfile.relpath)
|
||||
for dep in stage.deps:
|
||||
if not dep.use_scm_ignore and dep.is_in_repo:
|
||||
if (
|
||||
not dep.use_scm_ignore
|
||||
and dep.is_in_repo
|
||||
and not stage.repo.repo_fs.isdvc(dep.path_info)
|
||||
):
|
||||
stage.repo.scm.track_file(relpath(dep.path_info))
|
||||
for out in stage.outs:
|
||||
if not out.use_scm_ignore and out.is_in_repo:
|
||||
|
||||
+11
-2
@@ -272,10 +272,19 @@ class Git(Base):
|
||||
self.files_to_track = set()
|
||||
|
||||
def remind_to_track(self):
|
||||
if self.quiet or not self.files_to_track:
|
||||
def _filter(files):
|
||||
if not files:
|
||||
return set()
|
||||
staged, unstaged, untracked = self.status()
|
||||
return files.intersection(
|
||||
staged.get("modify", []) + unstaged + untracked
|
||||
)
|
||||
|
||||
files_to_track = _filter(self.files_to_track)
|
||||
if self.quiet or not files_to_track:
|
||||
return
|
||||
|
||||
files = " ".join(shlex.quote(path) for path in self.files_to_track)
|
||||
files = " ".join(shlex.quote(path) for path in sorted(files_to_track))
|
||||
|
||||
logger.info(
|
||||
"\n"
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
_BASE_VERSION = "2.0.0"
|
||||
_BASE_VERSION = "2.0.3"
|
||||
|
||||
|
||||
def _generate_version(base_version):
|
||||
|
||||
@@ -50,7 +50,7 @@ install_requires = [
|
||||
"colorama>=0.3.9",
|
||||
"configobj>=5.0.6",
|
||||
"gitpython>3",
|
||||
"dulwich>=0.20.19",
|
||||
"dulwich>=0.20.20",
|
||||
"pygit2>=1.4.0",
|
||||
"setuptools>=34.0.0",
|
||||
"nanotime>=0.5.2",
|
||||
@@ -89,7 +89,6 @@ install_requires = [
|
||||
"typing_extensions>=3.7.4",
|
||||
"fsspec>=0.8.5",
|
||||
"diskcache>=5.2.1",
|
||||
"google-cloud-storage==1.19.0",
|
||||
]
|
||||
|
||||
|
||||
@@ -98,7 +97,7 @@ install_requires = [
|
||||
gs = ["gcsfs>=0.7.2"]
|
||||
gdrive = ["pydrive2>=1.7.3", "six >= 1.13.0"]
|
||||
s3 = ["boto3>=1.9.201"]
|
||||
azure = ["adlfs>=0.6.3", "azure.identity>=1.4.0", "knack"]
|
||||
azure = ["adlfs>=0.6.3", "azure-identity>=1.4.0", "knack"]
|
||||
# https://github.com/Legrandin/pycryptodome/issues/465
|
||||
oss = ["oss2==2.6.1", "pycryptodome<3.9.9"]
|
||||
ssh = ["paramiko[invoke]>=2.7.0"]
|
||||
@@ -155,6 +154,7 @@ tests_requirements = [
|
||||
"mypy",
|
||||
"wsgidav",
|
||||
"crc32c",
|
||||
"google-cloud-storage==1.19.0",
|
||||
# pypi doesn't allow for direct dependencies
|
||||
# "gdrivefs @ git+https://github.com/intake/gdrivefs.git",
|
||||
]
|
||||
|
||||
@@ -509,10 +509,20 @@ def test_reset(tmp_dir, scm, git):
|
||||
assert len(unstaged) == 2
|
||||
|
||||
|
||||
def test_remind_to_track(scm, caplog):
|
||||
scm.files_to_track = ["fname with spaces.txt", "тест", "foo"]
|
||||
def test_remind_to_track(tmp_dir, scm, caplog):
|
||||
files = ["fname with spaces.txt", "тест", "foo"]
|
||||
tmp_dir.gen({name: "foo" for name in files})
|
||||
scm.files_to_track.update(files)
|
||||
|
||||
scm.remind_to_track()
|
||||
assert "git add 'fname with spaces.txt' 'тест' foo" in caplog.text
|
||||
assert "git add 'fname with spaces.txt' foo 'тест'" in caplog.text
|
||||
|
||||
scm.add(["foo"])
|
||||
caplog.clear()
|
||||
|
||||
scm.remind_to_track()
|
||||
assert "git add 'fname with spaces.txt' 'тест'" in caplog.text
|
||||
assert "foo" not in caplog.text
|
||||
|
||||
|
||||
def test_add(tmp_dir, scm, git):
|
||||
|
||||
@@ -4,9 +4,6 @@ from unittest.mock import call
|
||||
import pytest
|
||||
|
||||
from dvc.external_repo import external_repo
|
||||
from dvc.objects import save
|
||||
from dvc.objects.stage import stage
|
||||
from dvc.path_info import PathInfo
|
||||
from tests.unit.fs.test_repo import make_subrepo
|
||||
|
||||
|
||||
@@ -91,36 +88,3 @@ def test_subrepo_is_constructed_properly(
|
||||
assert repo.config["remote"]["auto-generated-upstream"][
|
||||
"url"
|
||||
] == str(main_cache)
|
||||
|
||||
|
||||
def test_fetch_external_repo_jobs(tmp_dir, scm, mocker, dvc, local_remote):
|
||||
tmp_dir.dvc_gen(
|
||||
{
|
||||
"dir1": {
|
||||
"file1": "file1",
|
||||
"file2": "file2",
|
||||
"file3": "file3",
|
||||
"file4": "file4",
|
||||
},
|
||||
},
|
||||
commit="init",
|
||||
)
|
||||
|
||||
dvc.push()
|
||||
|
||||
with external_repo(str(tmp_dir)) as repo:
|
||||
spy = mocker.spy(repo.cloud, "pull")
|
||||
|
||||
obj = stage(
|
||||
dvc.odb.local,
|
||||
PathInfo(repo.root_dir) / "dir1",
|
||||
repo.repo_fs,
|
||||
follow_subrepos=False,
|
||||
jobs=3,
|
||||
)
|
||||
save(
|
||||
dvc.odb.local, obj, jobs=3,
|
||||
)
|
||||
|
||||
run_jobs = tuple(spy.call_args_list[0])[1].get("jobs")
|
||||
assert run_jobs == 3
|
||||
|
||||
Reference in New Issue
Block a user