-
-
Notifications
You must be signed in to change notification settings - Fork 31.3k
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
difflib should separate filename from timestamp with tab #51834
Comments
The patch inserts \t character between filename and timestamp in unified According to specification by Guido Van Rossum =) And de-facto output from various tools And the common sense --- diff.py Sun Dec 27 16:08:28 2009 |
I don't think the conditional checks around the timestamps are |
Conditional checks are required to prevent leaving trailing whitespace in [1] http://code.google.com/p/python-patch/issues/detail?id=2 |
Shouldn't the patch tool handle that? FWIW, both the "svn diff" and *nix Would the code in example.py work in your tool to handle both tabs and |
Filenames may contain spaces too. --- handle dis Sun Dec 27 16:08:28 2009 The last line is space separated filename and date in Russian locale. Stripping trailing whitespace when there is no timestamp serves the same |
I agree that splitting with a tab character is good, but I think it If the separator is different based on what data is provided, then it |
This patch makes sure filename and date split by tab in every case when |
Is there any reason why you changed some of the examples in the docstrings (e.g. 'Sat Jan 26 23:30:50 1991' -> '1991-01-26 23:30:50')? |
It is the same reason as for removing recommendation from docstring to generate timestamps in the format returned by time.ctime(). See issue bpo-7582 |
The reason is to provide a good usage example. |
depends on issue bpo-7583 |
Refreshed patches - feel free to apply in any order you want. Convenience link for reviews: |
These patches are incrementally add features. Feel free to apply one that suits most. Codereview provides more convenient way to review differences between these. attaching optional patch that removes recommendation to use ctime format for timestamps |
Your last patch looks the best to me. I agree both that a tab should not be emitted if there is no date (which is what git, for example, does), and that ISO 8601 timestamps should be promoted as the preferred format. As you pointed out, bpo-7583 needs to be resolved before this can be applied. In the meantime it would be nice to add an additional test for the no-tab-if-no-date case. |
We could avoid the 7583 problem by making the doctests use NORMALIZE_WHITESPACE and moving the real *tests* into the unittests for the module. I think that would be a good thing to do anyway. |
Added unittest for tab with and without set filedate. |
Great, thanks. I'll check this in when the branch is unfrozen. |
Applied to trunk in r8004 and py3k in r8006. |
r80004 and r80006 to be exact. Great! Thanks! =) |
Yes, thanks for the typo correction. |
tag:difflib |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: