Corresponding of `dvc get` for uploading (`dvc set`?)
As part of the large ticket created for GTO, @aguschin identified one part that belongs to dvc.
Desired feature
Given a git repository using dvc, I would like to commit a dvc-tracked file without explicitely git cloning it (or be inside of it already). The file could be new, or it could just be an updated version of an existing one.
The feature is in the same spirit as dvc get, but it's for the other direction, uploading instead of downloading.
Behavior
Behavior in its simplest form could be equivalent to what one can obtain with the following bash function:
function git-dvc-remote-commit-and-push {
# Args:
# 1. repo url
# 2. absolute path to files to register. IMPORTANT: if it is a folder the path must end with a "/"
# 3. destination relative path in artifact registry git repo
# 4. commit message
# 5. dvc remote modify OPTION
# 6. dvc remote modify VALUE
TMP_REPO_FOLDER=".tmp-model-registry-$(date +'%s')"
git clone -q --depth 1 $1 ${TMP_REPO_FOLDER}
pushd ${TMP_REPO_FOLDER}
mkdir -p $3
cp -r $2 $3
dvc add -R $3
git commit -m "$4"
git push --repo $1
DEFAULT_REMOTE="$(cat .dvc/config | grep -e "remote =" | sed 's/.*remote = \(.*\)/\1/g')"
dvc remote modify ${DEFAULT_REMOTE} $5 $6
dvc push -R $3
popd
rm -rf $TMP_REPO_FOLDER
}
I think https://github.com/iterative/dvc/issues/6485 is a (long) related discussion
Tracked in #6485