Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BF: install relpath semantics #3777

Merged
merged 3 commits into from
Oct 14, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions datalad/distribution/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

from .dataset import Dataset
from .dataset import datasetmethod
from .dataset import resolve_path
from .dataset import rev_resolve_path
from .dataset import require_dataset
from .dataset import EnsureDataset
from .get import Get
Expand Down Expand Up @@ -323,7 +323,7 @@ def __call__(
# yoh: path should be a local path, and mapping note within
# SSHRI about mapping localhost:path to path is kinda
# a peculiar use-case IMHO
path = resolve_path(path_ri.localpath, dataset)
path = rev_resolve_path(path_ri.localpath, dataset)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is what confuses me - why then this new function should not just replace the old one? When should I use old over overwatch if the new one?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It always has to go. I just don't have the juice to do it all at once: #3778

# any `path` argument that point to something local now
# resolved and is no longer a URL
except ValueError:
Expand Down
15 changes: 11 additions & 4 deletions datalad/distribution/tests/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,9 @@
from datalad.support import path as op
from datalad.support.external_versions import external_versions
from datalad.interface.results import YieldDatasets
from datalad.interface.results import YieldRelativePaths
from datalad.support.exceptions import InsufficientArgumentsError
from datalad.support.exceptions import InstallFailedError
from datalad.support.exceptions import IncompleteResultsError
from datalad.support.gitrepo import GitRepo
from datalad.support.gitrepo import GitCommandError
from datalad.support.annexrepo import AnnexRepo
from datalad.cmd import Runner
from datalad.tests.utils import create_tree
Expand All @@ -55,7 +52,6 @@
from datalad.tests.utils import assert_result_count
from datalad.tests.utils import assert_status
from datalad.tests.utils import assert_in_results
from datalad.tests.utils import assert_not_in_results
from datalad.tests.utils import ok_startswith
from datalad.tests.utils import ok_clean_git
from datalad.tests.utils import serve_path_via_http
Expand Down Expand Up @@ -942,3 +938,14 @@ def check_datasets_datalad_org(suffix, tdir):
def test_datasets_datalad_org():
yield check_datasets_datalad_org, ''
yield check_datasets_datalad_org, '/.git'


# https://github.com/datalad/datalad/issues/3469
@with_tempfile(mkdir=True)
def test_relpath_semantics(path):
with chpwd(path):
super = create('super')
create('subsrc')
sub = install(
dataset='super', source='subsrc', path=op.join('super', 'sub'))
eq_(sub.path, op.join(super.path, 'sub'))