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

Fix #6205: Fixed diff summary to only show states with values. #6229

Merged
merged 4 commits into from
Jul 6, 2021

Conversation

hadasarik
Copy link
Contributor

@hadasarik hadasarik commented Jun 25, 2021

Fixes: #6205

Thank you for the contribution - we'll try to review it as soon as possible. πŸ™

@hadasarik hadasarik requested a review from a team as a code owner June 25, 2021 19:25
@hadasarik hadasarik requested a review from pmrowla June 25, 2021 19:25
Copy link
Contributor

@pmrowla pmrowla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hadasarik thanks for the PR! See my comments, there's a couple small issues

dvc/command/diff.py Show resolved Hide resolved
dvc/command/diff.py Outdated Show resolved Hide resolved
Comment on lines 114 to 120
states_values = []
for state in states:
state_value = summary[state]
if state_value > 0:
states_values.append(f"{state_value} {state}")

ui.write(fmt.format_map(summary))
ui.write("files summary: " + ", ".join(states_values))
Copy link
Member

@skshetry skshetry Jun 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally find loops to be confusing for small stuff. Generators/Comprehensions might be clearer of the intent, eg:

summary = ", ".join(generator)

Also, ui.write is basically a small wrapper around print, so you could get rid of "+" and just do:

ui.write("files summary:", summary)

WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@skshetry Fixed :)

@pmrowla pmrowla added this to In progress in DVC 29 June - 12 July 2021 via automation Jul 6, 2021
@pmrowla pmrowla added the ui user interface / interaction label Jul 6, 2021
@pmrowla pmrowla merged commit 9d9ff10 into iterative:master Jul 6, 2021
DVC 29 June - 12 July 2021 automation moved this from In progress to Done Jul 6, 2021
@hadasarik hadasarik deleted the fix/dvc-diff-summary branch July 6, 2021 13:04
@jorgeorpinel
Copy link
Contributor

Hi @hadasarik @skshetry @pmrowla

This require small docs updates to https://dvc.org/doc/command-reference/diff and https://dvc.org/doc/command-reference/exp/apply please (find files summary).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ui user interface / interaction
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

ui: fix dvc diff summary
4 participants