-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add --git argument with 7 inputs #48
base: master
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
As of now, this actually works as a git diff driver. And only that way. I had to disable the other mode. Argparse won't even let me set |
I messed with this a good deal and got it to function, but I can't get the help message to be correct. Argparse doesn't support mutually exclusive groups with positional arguments so I'm processioning the arguments twice, only requiring the normal oldfile newfile args if By the way there are two commits in here that fix things unrelated to this PR. Would you like those as separate PRs? |
In testing this in a bunch of git repository situations, I ran across one thing Git is doing that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I will install a local copy of this and test it over the weekend. Will you add documentation for the changes that you added to support use with git and the new --git
flag?
The CI fails are for a linting issue (too many blank lines in a module) and a stderr expected string for the mutually exclusive arguments that are changed here. I can update those to address the test fails. |
Commits f27ca3a and what other one contains a bug fix? |
Sorry, just seeing this message. I will take a look over the weekend and be in touch so that we can discuss how to approach this. We may be able to mock a simple "empty" ttx XML file so that the contents all show up as added or deleted. |
Rebased on master changes in d04f6dd |
Fixed lint CI test fail in a82cc9c |
060c775 updates the help message to include the seven positional arg types required for the
|
ab4c414 should fix the unit test that broke on the new stderr string for the exclusive |
@alerque Caleb, are you able to provide an example of an approach so that I can reproduce the fontTools attempt to read a "missing file" that you indicated in #48 (comment)? Once I can reproduce this I will look into adding the exception handling so that we can find a way to mock a file/string that can be used for the diff. |
Thanks for your work on this! I'll have a look to see what I can add including maybe documentation of how to configure git in a bit here.
The setup for this is pretty simple. Get yourself a font file and stick it in a new directory.
Because the file |
Perfect! Thanks! |
Thank you. I will try to work on the fontTools exception this week. |
Rebased on a fontTools bug fix @ 3d6c3f0 |
Should we also document usage as a Git diff-tool do you think? This has nothing to do with the changes here and my preference is strongly to use it as a diff-driver, but perhaps having both documented would clear up any possible confusion? |
IMO it is fine to document only the recommended approach. Let's see if anyone wanders by who needs diff tool information. |
It is possible to execute fdiff as a diff tool runner for other executables. Thoughts about using the git driver approach here with support for other diff tools (e.g., If we can't make the args work, we'll need to gate the external diff path with a validation so that the user is aware and add this to the docs. |
Thoughts about this @alerque ? I will return to this over the weekend to see if we can get this ready to release. Still trying to figure out how to approach some tests for this in the CI. The git history dependency makes it tricky. |
We need to be able to accept args such as /dev/null and /dev/stdin and these do not meet truth test with os.path.isfile. See source-foundry#48 (comment) for discussion
OK, I am now able to reproduce your issue with fontTools when a diff occurs at the introduction of a new font file (and presumably removal of a font file which I haven't tested yet). I'll continue work on this so that we can catch the exception and handle it with a mock string. I will likely just use an empty string as the comparison. This will show the entire TTX XML text as added (or removed in the case of the removal of a font) which is what we want. We're close! |
…approach for exclusive args
Co-Authored-By: Chris Simpkins <[email protected]>
We need to be able to accept args such as /dev/null and /dev/stdin and these do not meet truth test with os.path.isfile. See source-foundry#48 (comment) for discussion
Rebased on the v2.0.0 changes that landed in master today. Commit 3a1f283 |
Co-Authored-By: Chris Simpkins <[email protected]>
We need to be able to accept args such as /dev/null and /dev/stdin and these do not meet truth test with os.path.isfile. See source-foundry#48 (comment) for discussion
As I understand it this is now just waiting on |
Yep. I think that we are very close. We need to come up with an approach to the null files which I think will just be a mocked empty file so that everything is appropriately shown as an added or deleted line in the diff. And we need tests. I'll have time to continue work on it this weekend. If you have any thoughts feel free to push commits or weigh in on the thread! |
One more case I didn't test yet is how |
Any thoughts about how to automate the testing so that they can be added in our unit tests in the CI? |
If this was a shell thing, I would do something like...
I could easily mock that up in a shell script, but not sure how the process will play with Python's testing framework. |
4624544
to
3a1f283
Compare
Fixes #25.
I had a look at the argparse stuff in fdiff and I couldn't make heads or tails of where to put this. A
--git
argument makes sense, and argparse seems to have a way to specify the next N arguments belong to it, but I can't make sense of where to put the program logic or how to retrieve the parameters since none of the other arguments seem to be doing anything similar. I'm not really familiar with argparse!Does this sketch look like the right general place to put this?