Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Issue 29341347: Noissue - Add a script for converting Rietveld patches to Git format (Closed)

Created:
May 12, 2016, 5:50 p.m. by Vasily Kuznetsov
Modified:
May 17, 2016, 4:20 p.m.
Reviewers:
Sebastian Noack
Visibility:
Public.

Description

Noissue - Add a script for converting Rietveld patches to Git format

Patch Set 1 #

Total comments: 11

Patch Set 2 : Address review comments #

Total comments: 2

Patch Set 3 : Make flake8 check a bit more general in tox.ini #

Unified diffs Side-by-side diffs Delta from patch set Stats (+352 lines, -0 lines) Patch
A patchconv/README.md View 1 chunk +31 lines, -0 lines 0 comments Download
A patchconv/patchconv.py View 1 1 chunk +76 lines, -0 lines 0 comments Download
A patchconv/setup.py View 1 1 chunk +26 lines, -0 lines 0 comments Download
A patchconv/tests/add_empty_file.txt View 1 chunk +7 lines, -0 lines 0 comments Download
A patchconv/tests/add_file.txt View 1 chunk +15 lines, -0 lines 0 comments Download
A patchconv/tests/copy_and_change.txt View 1 chunk +23 lines, -0 lines 0 comments Download
A patchconv/tests/copy_file.txt View 1 chunk +9 lines, -0 lines 0 comments Download
A patchconv/tests/delete_file.txt View 1 chunk +7 lines, -0 lines 0 comments Download
A patchconv/tests/glitch.txt View 1 chunk +6 lines, -0 lines 0 comments Download
A patchconv/tests/move_and_change.txt View 1 chunk +23 lines, -0 lines 0 comments Download
A patchconv/tests/move_file.txt View 1 chunk +9 lines, -0 lines 0 comments Download
A patchconv/tests/simple_change_file.txt View 1 chunk +21 lines, -0 lines 0 comments Download
A patchconv/tests/test_rietveld_to_git.py View 1 1 chunk +84 lines, -0 lines 0 comments Download
A patchconv/tox.ini View 1 2 1 chunk +15 lines, -0 lines 0 comments Download

Messages

Total messages: 6
Vasily Kuznetsov
With this converter we can apply patches from reviews even if they have moves, copies ...
May 12, 2016, 5:56 p.m. (2016-05-12 17:56:35 UTC) #1
Sebastian Noack
https://codereview.adblockplus.org/29341347/diff/29341348/patchconv/patchconv.py File patchconv/patchconv.py (right): https://codereview.adblockplus.org/29341347/diff/29341348/patchconv/patchconv.py#newcode74 patchconv/patchconv.py:74: def script(): This seems to be an unconventional name ...
May 12, 2016, 9:44 p.m. (2016-05-12 21:44:27 UTC) #2
Vasily Kuznetsov
https://codereview.adblockplus.org/29341347/diff/29341348/patchconv/patchconv.py File patchconv/patchconv.py (right): https://codereview.adblockplus.org/29341347/diff/29341348/patchconv/patchconv.py#newcode74 patchconv/patchconv.py:74: def script(): On 2016/05/12 21:44:26, Sebastian Noack wrote: > ...
May 12, 2016, 11:25 p.m. (2016-05-12 23:25:16 UTC) #3
Sebastian Noack
https://codereview.adblockplus.org/29341347/diff/29341348/patchconv/patchconv.py File patchconv/patchconv.py (right): https://codereview.adblockplus.org/29341347/diff/29341348/patchconv/patchconv.py#newcode74 patchconv/patchconv.py:74: def script(): On 2016/05/12 23:25:16, Vasily Kuznetsov wrote: > ...
May 12, 2016, 11:48 p.m. (2016-05-12 23:48:52 UTC) #4
Vasily Kuznetsov
https://codereview.adblockplus.org/29341347/diff/29341348/patchconv/patchconv.py File patchconv/patchconv.py (right): https://codereview.adblockplus.org/29341347/diff/29341348/patchconv/patchconv.py#newcode74 patchconv/patchconv.py:74: def script(): On 2016/05/12 23:48:51, Sebastian Noack wrote: > ...
May 17, 2016, 3:57 p.m. (2016-05-17 15:57:31 UTC) #5
Sebastian Noack
May 17, 2016, 4:04 p.m. (2016-05-17 16:04:10 UTC) #6
LGTM

https://codereview.adblockplus.org/29341347/diff/29341348/patchconv/patchconv.py
File patchconv/patchconv.py (right):

https://codereview.adblockplus.org/29341347/diff/29341348/patchconv/patchconv...
patchconv/patchconv.py:74: def script():
On 2016/05/17 15:57:30, Vasily Kuznetsov wrote:
> On 2016/05/12 23:48:51, Sebastian Noack wrote:
> > On 2016/05/12 23:25:16, Vasily Kuznetsov wrote:
> > > On 2016/05/12 21:44:26, Sebastian Noack wrote:
> > > > This seems to be an unconventional name for an entry point function, or
is
> > it
> > > > indeed common? As far as I can tell people usually call it main()?
> > > > 
> > > > Also I wonder whether it makes quickly testing changes unnecessarily
> > > complicated
> > > > since you cannot run this module as script without installing it first.
> > > 
> > > Quickly testing is still pretty easy after `setup.py develop` but you're
> > > probably right that `main` is a more conventional name. Let's make it
> main().
> > > 
> > > Done.
> > 
> > I'm just curious is this common practice? Most Python scripts like this I've
> > seen so far use if __name__ == '__main__'
> 
> if __name__ == '__main__' allows running the script with `python script.py` or
> `python -m package.script`. However, this script is installed via
> `console_scripts` entry point in setup.py, so it can be run simply by typing
> `patchconv`. With this in mind it seems to me that the other ways of running
it
> are a bit redundant. If we want more flexibility, I could add `if __name__ ==
> '__main__': main()` to the end of this file to enable the other options. Do
you
> think it would be useful?

I don't have a strong opinion here.

Powered by Google App Engine
This is Rietveld