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

cmd-ref: make changes related to update --rev #1090

Merged
merged 2 commits into from
Apr 6, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 4 additions & 4 deletions content/docs/command-reference/import.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Several of the values above are pulled from the original stage file
subfields under `repo` are used to save the origin and version of the
dependency, respectively.

## Example: Fixed revisions and updating to different revision
## Example: Importing and updating fixed revisions

To import a specific version of a <abbr>data artifact</abbr>, we may use the
`--rev` option:
Expand Down Expand Up @@ -165,9 +165,9 @@ deps:
If `rev` is a Git branch or tag (where the underlying commit changes), the data
source may have updates at a later time. To bring it up to date if so (and
update `rev_lock` in the DVC-file), simply use `dvc update <stage>.dvc`. If
`rev` is a specific commit (does not change), `dvc update` will never have an
effect on the import stage. You may `dvc update` to a different commit, using
`--rev`:
`rev` is a specific commit hash (does not change), `dvc update` without options
will not have an effect on the import stage. You may force-update it to a
different commit with `dvc update --rev`:

```dvc
$ dvc update --rev cats-dogs-v2
Expand Down
30 changes: 14 additions & 16 deletions content/docs/command-reference/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ Note that import stages are considered always locked, meaning that if you run
`dvc repro`, they won't be updated. `dvc update` is the only command that can
update them.

`dvc update` will not have an effect on import stages that are fixed to a commit
hash (`rev` field in the DVC-file). To update the imported artifacts to a
certain revision, `--rev` with specified revision can be used.
`dvc update` without flags will not have an effect on import stages that are
fixed to a commit hash (`rev` field in the DVC-file). Use the `--rev` option to
update an imported artifact to a different revision.

```dvc
dvc update --rev master
Expand All @@ -52,7 +52,7 @@ dvc update --rev master

- `-v`, `--verbose` - displays detailed tracing information.

## Example: Updating imported artifacts
## Example

Let's first import a data artifact from our
[get started example repo](https://github.com/iterative/example-get-started):
Expand Down Expand Up @@ -84,29 +84,30 @@ stable.

## Example: Updating imported artifacts to a specified revision

Let's import a data artifact from an older commit from our
[get started example repo](https://github.com/iterative/example-get-started) at
Let's import a model from an older version of our
[get started example repo](https://github.com/iterative/example-get-started)
first:

```dvc
$ dvc import --rev baseline-experiment [email protected]:iterative/example-get-started model.pkl
$ dvc import --rev baseline-experiment \
[email protected]:iterative/example-get-started model.pkl
Importing 'model.pkl ([email protected]:iterative/example-get-started)'
-> 'model.pkl'
```

After this, the import stage (DVC-file) `model.pkl.dvc` is created.

Let's try to run `dvc update` on the given stage file, and see what happens.
After this, the import stage (DVC-file) `model.pkl.dvc` is created. Let's try to
run `dvc update` on the given stage file, and see what happens.

```dvc
$ dvc update model.pkl.dvc
```

There was no output at all, meaning, the `model.pkl` file was not updated. This
is because, we tied the import stage with a `rev` that never changes (i.e. tag
is tied to a specific commit). Therefore, it was not updated.
is because we tied the import stage to a `rev` that hasn't changed
(i.e.`baseline-experiment` tag points to a specific Git commit). Therefore, it
was not updated.

Let's try to update the model to a different experiment `bigrams-experiment`:
Let's try to update the model to a different version:

```dvc
$ dvc update --rev bigrams-experiment model.pkl.dvc
Expand All @@ -116,6 +117,3 @@ Importing 'model.pkl ([email protected]:iterative/example-get-started)'

The import stage is overwritten, and will get updated from the latest changes in
the given revision (i.e. `bigrams-experiment` tag).

> In the above example, the value for `rev` in the new import stage will be
> `bigrams-experiment`.