Skip to content

Documentation for datalad.get.subdataset-source-candidate option gives an incorrect property for URL of a configured remote #7458

Description

@mslw

Current docs

The documentation for datalad get (section: getting subdatasets) says:

Additional candidate URLs can be generated based on templates specified as configuration variables with the pattern

datalad.get.subdataset-source-candidate-<name>

(...)

Additionally, the URL of any configured remote that contains the respective submodule commit is available as remote-<name> properties, where NAME is the configured remote name.

Current code

However, the code of _get_flexible_source_candidates_for_submodule() caters for remoteurl-<name> property, not remote-<name>:

# Directly on parent's ds url
if remote_url:
# make remotes and their URLs available to template rendering
sm_candidate_props['remoteurl-{}'.format(remote)] = remote_url

Practical example

Tested in practice, where ../foo/bar is the url of the origin remote:

  • With source candidate {remote-origin}/{path} given 000 priority it doesn't work:
[WARNING] Failed to format template '{remote-origin}/{path}' for a submodule clone. Error: KeyError('remote-origin') 
[DEBUG  ] Assembled 2 clone candidates for bar: ['https://github.com/mslw/foo-bar.git', '../foo/bar']

With source candidate {remoteurl-origin}/{path} given 000 priority it works, and moves origin ahead of the URL from .gitmodules:

[DEBUG  ] Assembled 2 clone candidates for bar: ['../foo/bar', 'https://github.com/mslw/foo-bar.git']

Discovered thanks to this Neurostars question

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions