[PATCH] D30773: Make git-clang-format python 3 compatible

2017-04-21 Thread Jonathan B Coe via Phabricator via cfe-commits
jbcoe accepted this revision. jbcoe added a comment. This revision is now accepted and ready to land. LGTM https://reviews.llvm.org/D30773 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-com

[PATCH] D30773: Make git-clang-format python 3 compatible

2017-04-20 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 96025. EricWF added a comment. I've committed all but the `str` vs `byte` changes upstream. https://reviews.llvm.org/D30773 Files: tools/clang-format/git-clang-format Index: tools/clang-format/git-clang-format

[PATCH] D30773: Make git-clang-format python 3 compatible

2017-03-11 Thread Michał Górny via Phabricator via cfe-commits
mgorny added inline comments. Comment at: tools/clang-format/git-clang-format:306 +try: +return to_string(bytes.decode('utf-8')) +except AttributeError: # 'str' object has no attribute 'decode'. EricWF wrote: > mgorny wrote: > > EricWF wrote: > >

[PATCH] D30773: Make git-clang-format python 3 compatible

2017-03-11 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 91456. EricWF added a comment. - Rewrite `to_string` for clarities sake. https://reviews.llvm.org/D30773 Files: tools/clang-format/git-clang-format Index: tools/clang-format/git-clang-format

[PATCH] D30773: Make git-clang-format python 3 compatible

2017-03-11 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added inline comments. Comment at: tools/clang-format/git-clang-format:306 +try: +return to_string(bytes.decode('utf-8')) +except AttributeError: # 'str' object has no attribute 'decode'. mgorny wrote: > EricWF wrote: > > mgorny wrote: > >

[PATCH] D30773: Make git-clang-format python 3 compatible

2017-03-10 Thread Michał Górny via Phabricator via cfe-commits
mgorny added inline comments. Comment at: tools/clang-format/git-clang-format:306 +try: +return to_string(bytes.decode('utf-8')) +except AttributeError: # 'str' object has no attribute 'decode'. EricWF wrote: > mgorny wrote: > > This logic looks r

[PATCH] D30773: Make git-clang-format python 3 compatible

2017-03-10 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 91452. EricWF marked an inline comment as done. EricWF added a comment. - rename variables so they don't conflict with type names. https://reviews.llvm.org/D30773 Files: tools/clang-format/git-clang-format Index: tools/clang-format/git-clang-format ==

Re: [PATCH] D30773: Make git-clang-format python 3 compatible

2017-03-10 Thread Eric Fiselier via cfe-commits
On Thu, Mar 9, 2017 at 9:36 AM, Nico Weber wrote: > Consider landing the obvious bits (print function, mostly) separately and > use this only for the interesting bits. > Sounds good. I just wanted to make sure I got the simple bits right as well. If this doesn't get reviewed in the next week I'

[PATCH] D30773: Make git-clang-format python 3 compatible

2017-03-10 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF marked 4 inline comments as done. EricWF added inline comments. Comment at: tools/clang-format/git-clang-format:293 +def to_bytes(str): +# Encode to UTF-8 to get binary data. These functions are all lifted directly from `lit/util.py` ==

[PATCH] D30773: Make git-clang-format python 3 compatible

2017-03-10 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 91449. EricWF added a comment. Add complete implementation. As far as I've tested this works perfectly in both python2 and python3. https://reviews.llvm.org/D30773 Files: tools/clang-format/git-clang-format Index: tools/clang-format/git-clang-format

Re: [PATCH] D30773: Make git-clang-format python 3 compatible

2017-03-09 Thread Nico Weber via cfe-commits
Consider landing the obvious bits (print function, mostly) separately and use this only for the interesting bits. On Thu, Mar 9, 2017 at 11:10 AM, Michał Górny via Phabricator via cfe-commits wrote: > mgorny added inline comments. > > > > Comment at: tools/clang-format/git-clang

[PATCH] D30773: Make git-clang-format python 3 compatible

2017-03-09 Thread Michał Górny via Phabricator via cfe-commits
mgorny added inline comments. Comment at: tools/clang-format/git-clang-format:293 +def to_bytes(str): +# Encode to UTF-8 to get binary data. Pretty much a nit but using variable names that match type names can be a bit confusing here. Co

[PATCH] D30773: Make git-clang-format python 3 compatible

2017-03-09 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 91145. EricWF added a comment. This still isn't working in python3 due to more bytes vs str issues, but this is my progress so far. https://reviews.llvm.org/D30773 Files: tools/clang-format/git-clang-format Index: tools/clang-format/git-clang-format

[PATCH] D30773: Make git-clang-format python 3 compatible

2017-03-09 Thread Kim Gräsman via Phabricator via cfe-commits
kimgr added inline comments. Comment at: tools/clang-format/git-clang-format:323 allowed_extensions = frozenset(allowed_extensions) - for filename in dictionary.keys(): + for filename in list(dictionary.keys()): base_ext = filename.rsplit('.', 1) EricWF

[PATCH] D30773: Make git-clang-format python 3 compatible

2017-03-09 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF marked 2 inline comments as done. EricWF added inline comments. Comment at: tools/clang-format/git-clang-format:323 allowed_extensions = frozenset(allowed_extensions) - for filename in dictionary.keys(): + for filename in list(dictionary.keys()): base_ext = filen

[PATCH] D30773: Make git-clang-format python 3 compatible

2017-03-09 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF marked 4 inline comments as done. EricWF added inline comments. Comment at: tools/clang-format/git-clang-format:323 allowed_extensions = frozenset(allowed_extensions) - for filename in dictionary.keys(): + for filename in list(dictionary.keys()): base_ext = filen

[PATCH] D30773: Make git-clang-format python 3 compatible

2017-03-09 Thread Kim Gräsman via Phabricator via cfe-commits
kimgr added a comment. Some nits from a Python3 hacker. Comment at: tools/clang-format/git-clang-format:143 for filename in ignored_files: -print ' ', filename +print(' ', filename) if changed_lines: I find `print('template', tai

[PATCH] D30773: Make git-clang-format python 3 compatible

2017-03-08 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment. In https://reviews.llvm.org/D30773#696349, @mgorny wrote: > In https://reviews.llvm.org/D30773#696301, @EricWF wrote: > > > There seem to be a couple cases where it's non-trivial to convert the > > output from `bytes` to `str`. I'll look into this further and update. > >

[PATCH] D30773: Make git-clang-format python 3 compatible

2017-03-08 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment. In https://reviews.llvm.org/D30773#696301, @EricWF wrote: > There seem to be a couple cases where it's non-trivial to convert the output > from `bytes` to `str`. I'll look into this further and update. Generally bytes<->str conversion should be done using `.decode()` an

[PATCH] D30773: Make git-clang-format python 3 compatible

2017-03-08 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF planned changes to this revision. EricWF added a comment. There seem to be a couple cases where it's non-trivial to convert the output from `bytes` to `str`. I'll look into this further and update. https://reviews.llvm.org/D30773 ___ cfe-com

[PATCH] D30773: Make git-clang-format python 3 compatible

2017-03-08 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF created this revision. This patch attempts to make `git-clang-format` both python2 and python3 compatible. Currently it only works in python2. https://reviews.llvm.org/D30773 Files: tools/clang-format/git-clang-format Index: tools/clang-format/git-clang-format ===