Skip to content

remote: use local cache as default remote #2601

@dashohoxha

Description

@dashohoxha

I will try to explain the idea with a simple example, which can be constructed by this script:

#!/bin/bash
set -o verbose

rm -rf proj1
mkdir proj1
cd proj1

git init
dvc init -q
git commit -m 'Init DVC'

dvc remote add -d self $(pwd)/.dvc/cache
git add .
git commit -m 'Set default remote'

echo test1 > file
dvc add file
git add .
git commit -m 'test1'
git tag v1

echo test2 > file
dvc commit -f file.dvc
git add .
git commit -m 'test2'
git tag v2

echo test3 > file
dvc commit -f file.dvc
git add .
git commit -m 'test3'
git tag v3

dvc status
git log --oneline

Now let's try these:

cd proj1/
dvc remote list
ls
dvc get . file --rev=v1 -o file.v1
dvc get . file --rev=v2 -o file.v2
ls
cat file
cat file.v1
cat file.v2

So, using dvc get and its --rev option we can get previous versions of a file, and this seems cool to me (at least it is easier than the traditional git checkout + dvc checkout way).

However dvc get requires a default remote, otherwise it doesn't work. In the example above I have "tricked" it by using the local cache as a default remote:

dvc remote add -d self $(pwd)/.dvc/cache

Without this trick it would have failed.

So, I was thinking, what if DVC uses by default the local cache as a default remote?
This could also help in other cases when a default remote is required and the command is failing because of this (one of these cases might be this one: #2599).

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionrequires active participation to reach a conclusionfeature requestRequesting a new featurep2-mediumMedium priority, should be done, but less important

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions