Dvc: brancher: yields working tree on clean state

Created on 10 Aug 2019  路  9Comments  路  Source: iterative/dvc

On the description of brancher it reads the following:

    Yields:
        str: the display name for the currently selected tree, it could be:
            - a git revision identifier
            - empty string it there is no branches to iterate over
            - "Working Tree" if there are uncommited changes in the SCM repo

The relevant part is the last one, it should yield the "working tree" only if the repository is dirty.
It would be fixed with the following (under brancher.py):

    if repo.scm.is_dirty():
        yield "working tree"

I think this make sense, because for dvc metrics show it is annoying to see the "working tree" when there's no difference from the current branch.

enhancement p3-nice-to-have refactoring research

Most helpful comment

@efiop , I'd say it is a priority 3 and more like an enhancement.

git init
dvc init
dvc run -m foo 'echo 100 > foo'
git add -A
git commit -m "metrics foo"
$ dvc metrics show --all-branches
working tree:
    foo: 100
master:
    foo: 100

So, the problem is that working tree is being returned when you can tell that there's no difference between the current branch and the working tree (because _the HEAD is clean_ -- not sure if I'm using the correct terminology :sweat_smile: )

All 9 comments

@mroutis could you give more context please?

Sure, @shcheklein , let me edit the description :sweat_smile: .

@mroutis @Suor Is this still relevant? There was some dedup optimization in brancher.

@efiop , I'd say it is a priority 3 and more like an enhancement.

git init
dvc init
dvc run -m foo 'echo 100 > foo'
git add -A
git commit -m "metrics foo"
$ dvc metrics show --all-branches
working tree:
    foo: 100
master:
    foo: 100

So, the problem is that working tree is being returned when you can tell that there's no difference between the current branch and the working tree (because _the HEAD is clean_ -- not sure if I'm using the correct terminology :sweat_smile: )

Other approach is adding "working tree" with a comma, same as dup branches or tags.

Votes split on priority and whether include it into the next sprint: +1s from @mroutis and @Suor, -1 from @efiop and @pared.

Goes as bonus for next sprint if we go well.

Just discovered that --all-branches and friends are noop for dvc status when neither cloud nor remote option is specified. So:

  • this issue is only about metrics show, other commands don't care
  • should fail or show a warning on a noop option use.

@Suor Indeed, it only affects status if -c is also specified. So need a group of mutually required (or whatever it is called) flags there.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

dmpetrov picture dmpetrov  路  3Comments

siddygups picture siddygups  路  3Comments

mdscruggs picture mdscruggs  路  3Comments

dnabanita7 picture dnabanita7  路  3Comments