-
Notifications
You must be signed in to change notification settings - Fork 56
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
WIP: Add -r / --revision argument for specifying which Git revision to compare to #43
Conversation
f31b703
to
f47e907
Compare
-r
/ --revision
argument for specifying which Git revision to compare tof47e907
to
b0bd353
Compare
Ah well, I see we started working on the same thing at the same time twice ! |
I was also thinking in a config file (pyproject.toml at the root of the repo?) having the ability to give a revision to be used by default. But +1. |
😄 yes... the solutions are pretty similar. Do you know if there's a difference in any situation between I'm also considering different names for the option. Git documentation shows From the glossary:
So I see your point about "commit-ish" – for example a tag object is not a commit or a revision. But I also think
These are the reasons I came up with |
Summary of the main differences between mine vs. your solution:
The rest of the differences are mostly a matter of taste. @Carreau could you review my MR and point out any flaws and design decisions you dislike? Also if you accept my invite on GitHub to become a collaborator on this repository, I can assign the MR for you to review. |
c98fd59
to
0346c04
Compare
2723dd9
to
db6ed81
Compare
Yeah, my main concern would be if users have staged only some ; or partial version of a file I think it may differ; but I'm not too sure. I think that's fine enough and can be refined in further iteration if there are complaint. I actually like |
I think that |
db6ed81
to
9c9ffc2
Compare
f28d466
to
27766ca
Compare
Makes testing easier.
In unit tests, take advantage of `contextlib.suppress()` so separate code paths with and without a context manager are not needed. See https://stackoverflow.com/a/45187287/15770
This is actually my first real-life test of the `--revision` feature. What I did was - set `skip-string-normalization = false` for Black in `pyproject.toml` - run `darker src -r master` in the `revision-argument` branch - revert `pyproject.toml` - commit the changes
27766ca
to
ad2b403
Compare
Sourcery Code Quality Report (beta)❌ Merging this PR will decrease code quality in the affected files by 0.19 out of 10.
Here are some functions in these files that still need a tune-up:
Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Let us know what you think of it by mentioning @sourcery-ai in a comment. |
That's a good idea, @Carreau. I created #49 to think about configuration files for Darker. I think we should solve that in a separate PR. You didn't yet approve this pull request – do you have any additional remarks or could we merge? |
Sorry, approved !
Yes, I saw, and you tagged 1.2.0, which I think is reasonable. Just |
These were missed in #43. Fix them now in this MR even though they are unrelated. Will get reviewed in the same go and fixed in time for the 1.1.0 release.
Fixes #42. Should be reviewed and merged only after #48 has been merged.
TODO: unit tests
git_get_unmodified_content()
with a non-HEAD
revisiontest_revision()
with unmodified content compared to the given revision