Added a mercurial hook for posting review requests when pushing to central repo.

Review Request #7100 — Created March 21, 2015 and discarded

Information

RBTools
master

Reviewers

A Mercurial hook to post to Review Board on push to a central server.

The hook was designed to make posting to Review Board easy for new or inexperienced users. It allows user to post to ReviewBoard by using the ordinary "hg push", without any need to learn or install RBTools locally.

The hook only allows the push if all commits have been approved in a review requests, otherwise it rejects it and creates a review request for the (new) commits. This is similar to "rbt post", but
1. does not require the user to install RBTools locally
2. makes sure any changes pushed to the central server have been reviewed and approved
3. makes links of all references to tickets/bugs/issues, which rbt post doesn't do.
4. automatically finds the right review request to update if there are any new commits, based the commit ID and a date/author hash. This does not require the user to confirm anything, which rbt post (often) requires. This also allows the hook to recognize rebased/amended changesets, because the date/author hash is unchanged.

The hook has been tested both with some unit testing and partly in a production environment.
Unit testing also included testing communication with server, which revealed a few issues that have been fixed.
I wasn't sure how these unit tests should be included in the test suites for RBTools, so I've left them out for now.

Description From Last Updated

Col: 61 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 68 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 39 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 42 E251 unexpected spaces around keyword / parameter equals

reviewbotreviewbot

Col: 44 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

'from rbtools.hooks.mercurial import *' used; unable to detect undefined names

reviewbotreviewbot

Col: 59 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 63 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 80 E501 line too long (80 > 79 characters)

reviewbotreviewbot

Col: 42 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 51 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 13 E128 continuation line under-indented for visual indent

reviewbotreviewbot

Col: 61 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 68 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 39 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 42 E251 unexpected spaces around keyword / parameter equals

reviewbotreviewbot

Col: 44 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 13 E128 continuation line under-indented for visual indent

reviewbotreviewbot

Col: 61 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 68 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 13 E128 continuation line under-indented for visual indent

reviewbotreviewbot

'from rbtools.hooks.mercurial import *' used; unable to detect undefined names

reviewbotreviewbot

Col: 23 W503 line break before binary operator

reviewbotreviewbot

Col: 26 W503 line break before binary operator

reviewbotreviewbot

Col: 22 W503 line break before binary operator

reviewbotreviewbot

Col: 21 W503 line break before binary operator

reviewbotreviewbot

Col: 27 W503 line break before binary operator

reviewbotreviewbot

Col: 23 W503 line break before binary operator

reviewbotreviewbot

Col: 23 W503 line break before binary operator

reviewbotreviewbot

Col: 61 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 30 W503 line break before binary operator

reviewbotreviewbot

Col: 68 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 29 W503 line break before binary operator

reviewbotreviewbot

Col: 25 W503 line break before binary operator

reviewbotreviewbot

Col: 26 W503 line break before binary operator

reviewbotreviewbot

Col: 26 W503 line break before binary operator

reviewbotreviewbot

Col: 26 W503 line break before binary operator

reviewbotreviewbot

Col: 26 W503 line break before binary operator

reviewbotreviewbot

Col: 26 W503 line break before binary operator

reviewbotreviewbot

Col: 26 W503 line break before binary operator

reviewbotreviewbot

Col: 26 W503 line break before binary operator

reviewbotreviewbot

Col: 26 W503 line break before binary operator

reviewbotreviewbot

Col: 30 W503 line break before binary operator

reviewbotreviewbot

Col: 26 W503 line break before binary operator

reviewbotreviewbot

Col: 26 W503 line break before binary operator

reviewbotreviewbot

Col: 26 W503 line break before binary operator

reviewbotreviewbot

Col: 26 W503 line break before binary operator

reviewbotreviewbot

Col: 13 E128 continuation line under-indented for visual indent

reviewbotreviewbot

'from rbtools.hooks.mercurial import *' used; unable to detect undefined names

reviewbotreviewbot

Col: 23 W503 line break before binary operator

reviewbotreviewbot

Col: 26 W503 line break before binary operator

reviewbotreviewbot

Col: 22 W503 line break before binary operator

reviewbotreviewbot

Col: 21 W503 line break before binary operator

reviewbotreviewbot

Col: 27 W503 line break before binary operator

reviewbotreviewbot

Col: 23 W503 line break before binary operator

reviewbotreviewbot

Col: 23 W503 line break before binary operator

reviewbotreviewbot

Col: 61 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 30 W503 line break before binary operator

reviewbotreviewbot

Col: 68 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 29 W503 line break before binary operator

reviewbotreviewbot

Col: 25 W503 line break before binary operator

reviewbotreviewbot

Col: 26 W503 line break before binary operator

reviewbotreviewbot

Col: 26 W503 line break before binary operator

reviewbotreviewbot

Col: 26 W503 line break before binary operator

reviewbotreviewbot

Col: 26 W503 line break before binary operator

reviewbotreviewbot

Col: 26 W503 line break before binary operator

reviewbotreviewbot

Col: 26 W503 line break before binary operator

reviewbotreviewbot

Col: 26 W503 line break before binary operator

reviewbotreviewbot

Col: 26 W503 line break before binary operator

reviewbotreviewbot

Col: 30 W503 line break before binary operator

reviewbotreviewbot

Col: 26 W503 line break before binary operator

reviewbotreviewbot

Col: 26 W503 line break before binary operator

reviewbotreviewbot

Col: 26 W503 line break before binary operator

reviewbotreviewbot

Col: 26 W503 line break before binary operator

reviewbotreviewbot

Col: 13 E128 continuation line under-indented for visual indent

reviewbotreviewbot

Col: 59 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 66 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 59 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 66 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 22 W503 line break before binary operator

reviewbotreviewbot

Branch information would be helpful

miserymisery

I think a new request should be in draft mode to allow the developer additional changes. Immediately public for updated …

miserymisery

This could fail if there is no address or the admin marked his profile information as private.

miserymisery

Col: 19 W503 line break before binary operator

reviewbotreviewbot

Col: 19 W503 line break before binary operator

reviewbotreviewbot

Col: 19 W503 line break before binary operator

reviewbotreviewbot

Col: 1 E302 expected 2 blank lines, found 1

reviewbotreviewbot

Col: 1 E303 too many blank lines (3)

reviewbotreviewbot

Col: 29 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 29 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 29 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 5 E301 expected 1 blank line, found 0

reviewbotreviewbot

Col: 1 E302 expected 2 blank lines, found 1

reviewbotreviewbot

Col: 80 E501 line too long (81 > 79 characters)

reviewbotreviewbot

Col: 80 E501 line too long (80 > 79 characters)

reviewbotreviewbot

Col: 19 W503 line break before binary operator

reviewbotreviewbot

Col: 19 W503 line break before binary operator

reviewbotreviewbot

Col: 19 W503 line break before binary operator

reviewbotreviewbot

Col: 19 W503 line break before binary operator

reviewbotreviewbot

These imports should follow the PEP-8 standard (3 sections, first standard library, then third party, then "local" imports). We also …

daviddavid

We should avoid using str (which has different meanings in python 2 and 3) and instead use six.text_type

daviddavid

Please add a blank line before this.

daviddavid

You don't need the + here, since strings will auto concatenate. Can we also say "repository's" instead of "repo's"?

daviddavid

Please add a blank line before this.

daviddavid

This check should be not ticket_url

daviddavid

We generally use older-style format strings (`'%d changesets recieved' % len(changesets).

daviddavid

Please add blank lines around the conditional blocks here and below.

daviddavid

For multi-line docstrings, the closing """ should go on the next line.

daviddavid

You can skip the [] inside all and it will be a bit more efficient (using a generator expression instead …

daviddavid

Please use % formatting.

daviddavid

This looks like it's part of a different change.

daviddavid

""" on the next line.

daviddavid

The formatted-in string needs to be run through re.escape. Please also use %-formatting.

daviddavid

Please rearrange according to PEP-8.

daviddavid

Please put each key/value on its own line.

daviddavid

This should use six.text_type rather than str.

daviddavid

This should fit on one line.

daviddavid

Can you just put the format inline in the function call?

daviddavid

This could be a single statement: return max([ datetime_from_timestamp(diff.timestamp) for diff in revreq.get_diffs(only_fields='timestamp') ])

daviddavid

""" on the next line.

daviddavid

""" on the next line.

daviddavid

This should be "Review Board", not "ReviewBoard"

daviddavid

Same here.

daviddavid

And here.

daviddavid

And here.

daviddavid

This should all be a single format operation rather than a format and a bunch of concatenations. You can also …

daviddavid

Please import unicode_literals at the top of this file.

daviddavid

Docstrings for TestCase test methods shouldn't end in periods.

daviddavid

Docstrings for TestCase test methods shouldn't end in periods.

daviddavid

Docstrings for TestCase test methods shouldn't end in periods.

daviddavid

'itertools' imported but unused

reviewbotreviewbot

Col: 19 W503 line break before binary operator

reviewbotreviewbot

Col: 19 W503 line break before binary operator

reviewbotreviewbot

Col: 19 W503 line break before binary operator

reviewbotreviewbot

Col: 1 E302 expected 2 blank lines, found 1

reviewbotreviewbot

Col: 5 E301 expected 1 blank line, found 0

reviewbotreviewbot

Col: 80 E501 line too long (81 > 79 characters)

reviewbotreviewbot

Col: 5 E301 expected 1 blank line, found 0

reviewbotreviewbot

Col: 1 E302 expected 2 blank lines, found 1

reviewbotreviewbot

Col: 1 E302 expected 2 blank lines, found 1

reviewbotreviewbot

Col: 1 E302 expected 2 blank lines, found 1

reviewbotreviewbot

Col: 1 E302 expected 2 blank lines, found 1

reviewbotreviewbot

Col: 1 E302 expected 2 blank lines, found 1

reviewbotreviewbot

Col: 1 E402 module level import not at top of file

reviewbotreviewbot

Col: 1 E302 expected 2 blank lines, found 0

reviewbotreviewbot

Col: 1 E302 expected 2 blank lines, found 1

reviewbotreviewbot

Col: 1 E302 expected 2 blank lines, found 1

reviewbotreviewbot

Col: 27 E127 continuation line over-indented for visual indent

reviewbotreviewbot

Col: 1 E303 too many blank lines (3)

reviewbotreviewbot

Col: 29 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 29 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 29 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

local variable 'repo_id2' is assigned to but never used

reviewbotreviewbot

Col: 5 E301 expected 1 blank line, found 0

reviewbotreviewbot

Col: 1 E302 expected 2 blank lines, found 1

reviewbotreviewbot

Col: 80 E501 line too long (80 > 79 characters)

reviewbotreviewbot

Col: 80 E501 line too long (81 > 79 characters)

reviewbotreviewbot

'hg' imported but unused

reviewbotreviewbot

'ui' imported but unused

reviewbotreviewbot

Col: 19 W503 line break before binary operator

reviewbotreviewbot

Col: 19 W503 line break before binary operator

reviewbotreviewbot

Col: 19 W503 line break before binary operator

reviewbotreviewbot

Col: 19 W503 line break before binary operator

reviewbotreviewbot

'itertools' imported but unused

reviewbotreviewbot

Code looks for "ticket_id_prefixes"

miserymisery

repo_root cannot be found here on reviewboard because reviewboard will use a remote connection like http://mercurial/scm/hg/Test. "hg root" will return …

miserymisery

Documentation uses "ticket_prefixes"

miserymisery

The link works if we replace "re.escape(base_url)" with "base_url", otherwise the URL is broken and reviewboard shows a broken link. …

miserymisery

Missing ticket_prefixes here :-) find_ticket_refs(new_plain_description, ticket_prefixes)

miserymisery

Col: 19 W503 line break before binary operator

reviewbotreviewbot

Col: 19 W503 line break before binary operator

reviewbotreviewbot

Col: 19 W503 line break before binary operator

reviewbotreviewbot

Col: 1 E302 expected 2 blank lines, found 1

reviewbotreviewbot

Col: 5 E301 expected 1 blank line, found 0

reviewbotreviewbot

Col: 80 E501 line too long (81 > 79 characters)

reviewbotreviewbot

Col: 5 E301 expected 1 blank line, found 0

reviewbotreviewbot

Col: 1 E302 expected 2 blank lines, found 1

reviewbotreviewbot

Col: 1 E302 expected 2 blank lines, found 1

reviewbotreviewbot

Col: 1 E302 expected 2 blank lines, found 1

reviewbotreviewbot

Col: 1 E302 expected 2 blank lines, found 1

reviewbotreviewbot

Col: 1 E302 expected 2 blank lines, found 1

reviewbotreviewbot

Col: 1 E402 module level import not at top of file

reviewbotreviewbot

Col: 1 E302 expected 2 blank lines, found 0

reviewbotreviewbot

Col: 1 E302 expected 2 blank lines, found 1

reviewbotreviewbot

Col: 1 E302 expected 2 blank lines, found 1

reviewbotreviewbot

Col: 27 E127 continuation line over-indented for visual indent

reviewbotreviewbot

Col: 1 E303 too many blank lines (3)

reviewbotreviewbot

Col: 29 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 29 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 29 E226 missing whitespace around arithmetic operator

reviewbotreviewbot

Col: 5 E301 expected 1 blank line, found 0

reviewbotreviewbot

Col: 1 E302 expected 2 blank lines, found 1

reviewbotreviewbot

Col: 80 E501 line too long (80 > 79 characters)

reviewbotreviewbot

Col: 80 E501 line too long (81 > 79 characters)

reviewbotreviewbot

Col: 19 W503 line break before binary operator

reviewbotreviewbot

Col: 19 W503 line break before binary operator

reviewbotreviewbot

Col: 19 W503 line break before binary operator

reviewbotreviewbot

Col: 19 W503 line break before binary operator

reviewbotreviewbot

reviewboardhook can be CONFIG_SECTION

miserymisery

reviewboardhook can be CONFIG_SECTION

miserymisery

This will fail if "line" is unicode. We fixed it with hasher.update(line.encode('utf-8')) UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in …

miserymisery

It would be nice if the "get description" could be a separate function. So we can use it to check …

miserymisery

If you push multiple changesets in different branches this won't work with our workflow. Could you change it to this? …

miserymisery

^1 will leads to a broken "base_commit_id" See: https://code.google.com/p/reviewboard/issues/detail?id=3915 I added this as a work-around to rbtools in "clients/mercurial.py" at …

miserymisery

Col: 17 W503 line break before binary operator

reviewbotreviewbot

see above

miserymisery

see above

miserymisery

base_commit_id needs to be passed here, too. Because otherwise reviewboard will use "tip" as base and this will fail if …

miserymisery

We changed it to this since a rebase could lead to a useless "whitespace changed"-update: if len(line) > 0 and …

miserymisery
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        rbtools/hooks/mercurial_push.py
        rbtools/hooks/tests.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        rbtools/hooks/mercurial_push.py
        rbtools/hooks/tests.py
    
    
  2. rbtools/hooks/common.py (Diff revision 1)
     
     
    Show all issues
    Col: 61
     E226 missing whitespace around arithmetic operator
    
  3. rbtools/hooks/common.py (Diff revision 1)
     
     
    Show all issues
    Col: 68
     E226 missing whitespace around arithmetic operator
    
  4. rbtools/hooks/mercurial.py (Diff revision 1)
     
     
    Show all issues
    Col: 39
     E226 missing whitespace around arithmetic operator
    
  5. rbtools/hooks/mercurial.py (Diff revision 1)
     
     
    Show all issues
    Col: 42
     E251 unexpected spaces around keyword / parameter equals
    
  6. rbtools/hooks/mercurial.py (Diff revision 1)
     
     
    Show all issues
    Col: 44
     E226 missing whitespace around arithmetic operator
    
  7. rbtools/hooks/mercurial_push.py (Diff revision 1)
     
     
    Show all issues
     'from rbtools.hooks.mercurial import *' used; unable to detect undefined names
    
  8. rbtools/hooks/mercurial_push.py (Diff revision 1)
     
     
    Show all issues
    Col: 59
     E226 missing whitespace around arithmetic operator
    
  9. rbtools/hooks/mercurial_push.py (Diff revision 1)
     
     
    Show all issues
    Col: 63
     E226 missing whitespace around arithmetic operator
    
  10. rbtools/hooks/mercurial_push.py (Diff revision 1)
     
     
    Show all issues
    Col: 80
     E501 line too long (80 > 79 characters)
    
  11. rbtools/hooks/mercurial_push.py (Diff revision 1)
     
     
    Show all issues
    Col: 42
     E226 missing whitespace around arithmetic operator
    
  12. rbtools/hooks/mercurial_push.py (Diff revision 1)
     
     
    Show all issues
    Col: 51
     E226 missing whitespace around arithmetic operator
    
  13. rbtools/hooks/tests.py (Diff revision 1)
     
     
    Show all issues
    Col: 13
     E128 continuation line under-indented for visual indent
    
  14. 
      
HA
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        rbtools/hooks/tests.py
    
    Ignored Files:
        contrib/tools/mercurial-push
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        rbtools/hooks/tests.py
    
    Ignored Files:
        contrib/tools/mercurial-push
    
    
  2. rbtools/hooks/common.py (Diff revision 2)
     
     
    Show all issues
    Col: 61
     E226 missing whitespace around arithmetic operator
    
  3. rbtools/hooks/common.py (Diff revision 2)
     
     
    Show all issues
    Col: 68
     E226 missing whitespace around arithmetic operator
    
  4. rbtools/hooks/mercurial.py (Diff revision 2)
     
     
    Show all issues
    Col: 39
     E226 missing whitespace around arithmetic operator
    
  5. rbtools/hooks/mercurial.py (Diff revision 2)
     
     
    Show all issues
    Col: 42
     E251 unexpected spaces around keyword / parameter equals
    
  6. rbtools/hooks/mercurial.py (Diff revision 2)
     
     
    Show all issues
    Col: 44
     E226 missing whitespace around arithmetic operator
    
  7. rbtools/hooks/tests.py (Diff revision 2)
     
     
    Show all issues
    Col: 13
     E128 continuation line under-indented for visual indent
    
  8. 
      
HA
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        rbtools/hooks/tests.py
    
    Ignored Files:
        contrib/tools/mercurial-push
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        rbtools/hooks/tests.py
    
    Ignored Files:
        contrib/tools/mercurial-push
    
    
  2. rbtools/hooks/common.py (Diff revision 3)
     
     
    Show all issues
    Col: 61
     E226 missing whitespace around arithmetic operator
    
  3. rbtools/hooks/common.py (Diff revision 3)
     
     
    Show all issues
    Col: 68
     E226 missing whitespace around arithmetic operator
    
  4. rbtools/hooks/tests.py (Diff revision 3)
     
     
    Show all issues
    Col: 13
     E128 continuation line under-indented for visual indent
    
  5. 
      
HA
HA
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        contrib/tools/mercurial_push.py
        setup.py
        rbtools/hooks/tests.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        contrib/tools/mercurial_push.py
        setup.py
        rbtools/hooks/tests.py
    
    
  2. contrib/tools/mercurial_push.py (Diff revision 4)
     
     
    Show all issues
     'from rbtools.hooks.mercurial import *' used; unable to detect undefined names
    
  3. contrib/tools/mercurial_push.py (Diff revision 4)
     
     
    Show all issues
    Col: 23
     W503 line break before binary operator
    
  4. contrib/tools/mercurial_push.py (Diff revision 4)
     
     
    Show all issues
    Col: 26
     W503 line break before binary operator
    
  5. contrib/tools/mercurial_push.py (Diff revision 4)
     
     
    Show all issues
    Col: 22
     W503 line break before binary operator
    
  6. contrib/tools/mercurial_push.py (Diff revision 4)
     
     
    Show all issues
    Col: 21
     W503 line break before binary operator
    
  7. contrib/tools/mercurial_push.py (Diff revision 4)
     
     
    Show all issues
    Col: 27
     W503 line break before binary operator
    
  8. rbtools/hooks/common.py (Diff revision 4)
     
     
    Show all issues
    Col: 23
     W503 line break before binary operator
    
  9. rbtools/hooks/common.py (Diff revision 4)
     
     
    Show all issues
    Col: 23
     W503 line break before binary operator
    
  10. rbtools/hooks/common.py (Diff revision 4)
     
     
    Show all issues
    Col: 61
     E226 missing whitespace around arithmetic operator
    
  11. rbtools/hooks/common.py (Diff revision 4)
     
     
    Show all issues
    Col: 30
     W503 line break before binary operator
    
  12. rbtools/hooks/common.py (Diff revision 4)
     
     
    Show all issues
    Col: 68
     E226 missing whitespace around arithmetic operator
    
  13. rbtools/hooks/mercurial.py (Diff revision 4)
     
     
    Show all issues
    Col: 29
     W503 line break before binary operator
    
  14. rbtools/hooks/mercurial.py (Diff revision 4)
     
     
    Show all issues
    Col: 25
     W503 line break before binary operator
    
  15. rbtools/hooks/mercurial.py (Diff revision 4)
     
     
    Show all issues
    Col: 26
     W503 line break before binary operator
    
  16. rbtools/hooks/mercurial.py (Diff revision 4)
     
     
    Show all issues
    Col: 26
     W503 line break before binary operator
    
  17. rbtools/hooks/mercurial.py (Diff revision 4)
     
     
    Show all issues
    Col: 26
     W503 line break before binary operator
    
  18. rbtools/hooks/mercurial.py (Diff revision 4)
     
     
    Show all issues
    Col: 26
     W503 line break before binary operator
    
  19. rbtools/hooks/mercurial.py (Diff revision 4)
     
     
    Show all issues
    Col: 26
     W503 line break before binary operator
    
  20. rbtools/hooks/mercurial.py (Diff revision 4)
     
     
    Show all issues
    Col: 26
     W503 line break before binary operator
    
  21. rbtools/hooks/mercurial.py (Diff revision 4)
     
     
    Show all issues
    Col: 26
     W503 line break before binary operator
    
  22. rbtools/hooks/mercurial.py (Diff revision 4)
     
     
    Show all issues
    Col: 26
     W503 line break before binary operator
    
  23. rbtools/hooks/mercurial.py (Diff revision 4)
     
     
    Show all issues
    Col: 30
     W503 line break before binary operator
    
  24. rbtools/hooks/mercurial.py (Diff revision 4)
     
     
    Show all issues
    Col: 26
     W503 line break before binary operator
    
  25. rbtools/hooks/mercurial.py (Diff revision 4)
     
     
    Show all issues
    Col: 26
     W503 line break before binary operator
    
  26. rbtools/hooks/mercurial.py (Diff revision 4)
     
     
    Show all issues
    Col: 26
     W503 line break before binary operator
    
  27. rbtools/hooks/mercurial.py (Diff revision 4)
     
     
    Show all issues
    Col: 26
     W503 line break before binary operator
    
  28. rbtools/hooks/tests.py (Diff revision 4)
     
     
    Show all issues
    Col: 13
     E128 continuation line under-indented for visual indent
    
  29. 
      
HA
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        contrib/tools/mercurial_push.py
        rbtools/hooks/tests.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        contrib/tools/mercurial_push.py
        rbtools/hooks/tests.py
    
    
  2. contrib/tools/mercurial_push.py (Diff revision 5)
     
     
    Show all issues
     'from rbtools.hooks.mercurial import *' used; unable to detect undefined names
    
  3. contrib/tools/mercurial_push.py (Diff revision 5)
     
     
    Show all issues
    Col: 23
     W503 line break before binary operator
    
  4. contrib/tools/mercurial_push.py (Diff revision 5)
     
     
    Show all issues
    Col: 26
     W503 line break before binary operator
    
  5. contrib/tools/mercurial_push.py (Diff revision 5)
     
     
    Show all issues
    Col: 22
     W503 line break before binary operator
    
  6. contrib/tools/mercurial_push.py (Diff revision 5)
     
     
    Show all issues
    Col: 21
     W503 line break before binary operator
    
  7. contrib/tools/mercurial_push.py (Diff revision 5)
     
     
    Show all issues
    Col: 27
     W503 line break before binary operator
    
  8. rbtools/hooks/common.py (Diff revision 5)
     
     
    Show all issues
    Col: 23
     W503 line break before binary operator
    
  9. rbtools/hooks/common.py (Diff revision 5)
     
     
    Show all issues
    Col: 23
     W503 line break before binary operator
    
  10. rbtools/hooks/common.py (Diff revision 5)
     
     
    Show all issues
    Col: 61
     E226 missing whitespace around arithmetic operator
    
  11. rbtools/hooks/common.py (Diff revision 5)
     
     
    Show all issues
    Col: 30
     W503 line break before binary operator
    
  12. rbtools/hooks/common.py (Diff revision 5)
     
     
    Show all issues
    Col: 68
     E226 missing whitespace around arithmetic operator
    
  13. rbtools/hooks/mercurial.py (Diff revision 5)
     
     
    Show all issues
    Col: 29
     W503 line break before binary operator
    
  14. rbtools/hooks/mercurial.py (Diff revision 5)
     
     
    Show all issues
    Col: 25
     W503 line break before binary operator
    
  15. rbtools/hooks/mercurial.py (Diff revision 5)
     
     
    Show all issues
    Col: 26
     W503 line break before binary operator
    
  16. rbtools/hooks/mercurial.py (Diff revision 5)
     
     
    Show all issues
    Col: 26
     W503 line break before binary operator
    
  17. rbtools/hooks/mercurial.py (Diff revision 5)
     
     
    Show all issues
    Col: 26
     W503 line break before binary operator
    
  18. rbtools/hooks/mercurial.py (Diff revision 5)
     
     
    Show all issues
    Col: 26
     W503 line break before binary operator
    
  19. rbtools/hooks/mercurial.py (Diff revision 5)
     
     
    Show all issues
    Col: 26
     W503 line break before binary operator
    
  20. rbtools/hooks/mercurial.py (Diff revision 5)
     
     
    Show all issues
    Col: 26
     W503 line break before binary operator
    
  21. rbtools/hooks/mercurial.py (Diff revision 5)
     
     
    Show all issues
    Col: 26
     W503 line break before binary operator
    
  22. rbtools/hooks/mercurial.py (Diff revision 5)
     
     
    Show all issues
    Col: 26
     W503 line break before binary operator
    
  23. rbtools/hooks/mercurial.py (Diff revision 5)
     
     
    Show all issues
    Col: 30
     W503 line break before binary operator
    
  24. rbtools/hooks/mercurial.py (Diff revision 5)
     
     
    Show all issues
    Col: 26
     W503 line break before binary operator
    
  25. rbtools/hooks/mercurial.py (Diff revision 5)
     
     
    Show all issues
    Col: 26
     W503 line break before binary operator
    
  26. rbtools/hooks/mercurial.py (Diff revision 5)
     
     
    Show all issues
    Col: 26
     W503 line break before binary operator
    
  27. rbtools/hooks/mercurial.py (Diff revision 5)
     
     
    Show all issues
    Col: 26
     W503 line break before binary operator
    
  28. rbtools/hooks/tests.py (Diff revision 5)
     
     
    Show all issues
    Col: 13
     E128 continuation line under-indented for visual indent
    
  29. 
      
HA
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        contrib/tools/mercurial_push.py
        rbtools/hooks/tests.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        contrib/tools/mercurial_push.py
        rbtools/hooks/tests.py
    
    
  2. rbtools/hooks/common.py (Diff revision 6)
     
     
    Show all issues
    Col: 59
     E226 missing whitespace around arithmetic operator
    
  3. rbtools/hooks/common.py (Diff revision 6)
     
     
    Show all issues
    Col: 66
     E226 missing whitespace around arithmetic operator
    
  4. 
      
HA
HA
HA
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        contrib/tools/mercurial_push.py
        rbtools/hooks/tests.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        contrib/tools/mercurial_push.py
        rbtools/hooks/tests.py
    
    
  2. rbtools/hooks/common.py (Diff revision 7)
     
     
    Show all issues
    Col: 59
     E226 missing whitespace around arithmetic operator
    
  3. rbtools/hooks/common.py (Diff revision 7)
     
     
    Show all issues
    Col: 66
     E226 missing whitespace around arithmetic operator
    
  4. rbtools/hooks/mercurial.py (Diff revision 7)
     
     
    Show all issues
    Col: 22
     W503 line break before binary operator
    
  5. 
      
HA
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        contrib/tools/mercurial_push.py
        rbtools/hooks/tests.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        contrib/tools/mercurial_push.py
        rbtools/hooks/tests.py
    
    
  2. 
      
HA
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        contrib/tools/mercurial_push.py
        rbtools/hooks/tests.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        contrib/tools/mercurial_push.py
        rbtools/hooks/tests.py
    
    
  2. 
      
misery
  1. Thank you for the hook and the implementation of my ideas. You got a mail! ;-)

  2. rbtools/hooks/mercurial.py (Diff revision 9)
     
     
    Show all issues

    Branch information would be helpful

  3. rbtools/hooks/mercurial.py (Diff revision 9)
     
     
    Show all issues

    I think a new request should be in draft mode to allow the developer additional changes. Immediately public for updated requests are ok. Maybe an option?

  4. rbtools/hooks/mercurial.py (Diff revision 9)
     
     
    Show all issues

    This could fail if there is no address or the admin marked his profile information as private.

  5. 
      
HA
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        contrib/tools/mercurial_push.py
        rbtools/hooks/tests.py
    
    
    
    Tool: Pyflakes
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        contrib/tools/mercurial_push.py
        rbtools/hooks/tests.py
    
    
  2. 
      
HA
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        contrib/tools/test_reviewboardhook.py
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        contrib/tools/mercurial_push.py
        rbtools/hooks/tests.py
    
    
  2. contrib/tools/test_reviewboardhook.py (Diff revision 11)
     
     
    Show all issues
    Col: 19
     W503 line break before binary operator
    
  3. contrib/tools/test_reviewboardhook.py (Diff revision 11)
     
     
    Show all issues
    Col: 19
     W503 line break before binary operator
    
  4. contrib/tools/test_reviewboardhook.py (Diff revision 11)
     
     
    Show all issues
    Col: 19
     W503 line break before binary operator
    
  5. contrib/tools/test_reviewboardhook.py (Diff revision 11)
     
     
    Show all issues
    Col: 1
     E302 expected 2 blank lines, found 1
    
  6. contrib/tools/test_reviewboardhook.py (Diff revision 11)
     
     
    Show all issues
    Col: 1
     E303 too many blank lines (3)
    
  7. contrib/tools/test_reviewboardhook.py (Diff revision 11)
     
     
    Show all issues
    Col: 29
     E226 missing whitespace around arithmetic operator
    
  8. contrib/tools/test_reviewboardhook.py (Diff revision 11)
     
     
    Show all issues
    Col: 29
     E226 missing whitespace around arithmetic operator
    
  9. contrib/tools/test_reviewboardhook.py (Diff revision 11)
     
     
    Show all issues
    Col: 29
     E226 missing whitespace around arithmetic operator
    
  10. contrib/tools/test_reviewboardhook.py (Diff revision 11)
     
     
    Show all issues
    Col: 5
     E301 expected 1 blank line, found 0
    
  11. contrib/tools/test_reviewboardhook.py (Diff revision 11)
     
     
    Show all issues
    Col: 1
     E302 expected 2 blank lines, found 1
    
  12. contrib/tools/test_reviewboardhook.py (Diff revision 11)
     
     
    Show all issues
    Col: 80
     E501 line too long (81 > 79 characters)
    
  13. contrib/tools/test_reviewboardhook.py (Diff revision 11)
     
     
    Show all issues
    Col: 80
     E501 line too long (80 > 79 characters)
    
  14. contrib/tools/test_reviewboardhook.py (Diff revision 11)
     
     
    Show all issues
    Col: 19
     W503 line break before binary operator
    
  15. contrib/tools/test_reviewboardhook.py (Diff revision 11)
     
     
    Show all issues
    Col: 19
     W503 line break before binary operator
    
  16. contrib/tools/test_reviewboardhook.py (Diff revision 11)
     
     
    Show all issues
    Col: 19
     W503 line break before binary operator
    
  17. contrib/tools/test_reviewboardhook.py (Diff revision 11)
     
     
    Show all issues
    Col: 19
     W503 line break before binary operator
    
  18. 
      
HA
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        contrib/tools/mercurial_push.py
        rbtools/utils/review_request.py
        rbtools/hooks/mercurial.py
        rbtools/commands/post.py
        rbtools/clients/mercurial.py
        rbtools/hooks/common.py
        rbtools/hooks/tests.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        contrib/tools/mercurial_push.py
        rbtools/utils/review_request.py
        rbtools/hooks/mercurial.py
        rbtools/commands/post.py
        rbtools/clients/mercurial.py
        rbtools/hooks/common.py
        rbtools/hooks/tests.py
    
    
  2. 
      
david
  1. You have a mix of single-quoted and double-quoted strings throughout this change. Please go through and make sure you're using single quotes for everything unless the string itself has a single quote in it (for example, if there's a possesive).

  2. contrib/tools/mercurial_push.py (Diff revision 12)
     
     
     
     
     
     
     
    Show all issues

    These imports should follow the PEP-8 standard (3 sections, first standard library, then third party, then "local" imports). We also alphebetize imports when possible. As a result:

    import itertools
    import getpass
    import logging
    
    import rbtools.hooks.mercurial as hghook
    from rbtools.api.errors import APIError
    from rbtools.utils.filesystem import load_config
    
  3. contrib/tools/mercurial_push.py (Diff revision 12)
     
     
    Show all issues

    We should avoid using str (which has different meanings in python 2 and 3) and instead use six.text_type

  4. contrib/tools/mercurial_push.py (Diff revision 12)
     
     
    Show all issues

    Please add a blank line before this.

  5. contrib/tools/mercurial_push.py (Diff revision 12)
     
     
    Show all issues

    You don't need the + here, since strings will auto concatenate. Can we also say "repository's" instead of "repo's"?

  6. contrib/tools/mercurial_push.py (Diff revision 12)
     
     
    Show all issues

    Please add a blank line before this.

  7. contrib/tools/mercurial_push.py (Diff revision 12)
     
     
    Show all issues

    This check should be not ticket_url

  8. contrib/tools/mercurial_push.py (Diff revision 12)
     
     
    Show all issues

    We generally use older-style format strings (`'%d changesets recieved' % len(changesets).

  9. contrib/tools/mercurial_push.py (Diff revision 12)
     
     
     
     
     
    Show all issues

    Please add blank lines around the conditional blocks here and below.

  10. contrib/tools/mercurial_push.py (Diff revision 12)
     
     
    Show all issues

    For multi-line docstrings, the closing """ should go on the next line.

  11. contrib/tools/mercurial_push.py (Diff revision 12)
     
     
    Show all issues

    You can skip the [] inside all and it will be a bit more efficient (using a generator expression instead of a list comprehension)

  12. contrib/tools/mercurial_push.py (Diff revision 12)
     
     
    Show all issues

    Please use % formatting.

  13. rbtools/clients/mercurial.py (Diff revision 12)
     
     
    Show all issues

    This looks like it's part of a different change.

  14. rbtools/hooks/common.py (Diff revision 12)
     
     
    Show all issues

    """ on the next line.

  15. rbtools/hooks/common.py (Diff revision 12)
     
     
    Show all issues

    The formatted-in string needs to be run through re.escape. Please also use %-formatting.

  16. rbtools/hooks/mercurial.py (Diff revision 12)
     
     
     
     
     
     
     
     
     
     
    Show all issues

    Please rearrange according to PEP-8.

  17. rbtools/hooks/mercurial.py (Diff revision 12)
     
     
    Show all issues

    Please put each key/value on its own line.

  18. rbtools/hooks/mercurial.py (Diff revision 12)
     
     
    Show all issues

    This should use six.text_type rather than str.

  19. rbtools/hooks/mercurial.py (Diff revision 12)
     
     
     
    Show all issues

    This should fit on one line.

  20. rbtools/hooks/mercurial.py (Diff revision 12)
     
     
     
    Show all issues

    Can you just put the format inline in the function call?

  21. rbtools/hooks/mercurial.py (Diff revision 12)
     
     
     
     
    Show all issues

    This could be a single statement:

    return max([
        datetime_from_timestamp(diff.timestamp)
        for diff in revreq.get_diffs(only_fields='timestamp')
    ])
    
  22. rbtools/hooks/mercurial.py (Diff revision 12)
     
     
    Show all issues

    """ on the next line.

  23. rbtools/hooks/mercurial.py (Diff revision 12)
     
     
    Show all issues

    """ on the next line.

  24. rbtools/hooks/mercurial.py (Diff revision 12)
     
     
    Show all issues

    This should be "Review Board", not "ReviewBoard"

  25. rbtools/hooks/mercurial.py (Diff revision 12)
     
     
    Show all issues

    Same here.

  26. rbtools/hooks/mercurial.py (Diff revision 12)
     
     
    Show all issues

    And here.

  27. rbtools/hooks/mercurial.py (Diff revision 12)
     
     
    Show all issues

    And here.

  28. rbtools/hooks/mercurial.py (Diff revision 12)
     
     
     
     
     
     
    Show all issues

    This should all be a single format operation rather than a format and a bunch of concatenations. You can also use python's built-in concatenation:

    raise LoginError(
        'Could not open Review Board repository for path "%s". '
        'Please check with your server administrator to ensure '
        'you have the correct permissions.'
        % path)
    
  29. rbtools/hooks/tests.py (Diff revision 12)
     
     
     
    Show all issues

    Please import unicode_literals at the top of this file.

  30. rbtools/hooks/tests.py (Diff revision 12)
     
     
    Show all issues

    Docstrings for TestCase test methods shouldn't end in periods.

  31. rbtools/hooks/tests.py (Diff revision 12)
     
     
    Show all issues

    Docstrings for TestCase test methods shouldn't end in periods.

  32. rbtools/hooks/tests.py (Diff revision 12)
     
     
    Show all issues

    Docstrings for TestCase test methods shouldn't end in periods.

  33. 
      
HA
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        contrib/tools/test_reviewboardhook.py
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        contrib/tools/mercurial_push.py
        rbtools/hooks/tests.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        contrib/tools/test_reviewboardhook.py
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        contrib/tools/mercurial_push.py
        rbtools/hooks/tests.py
    
    
  2. contrib/tools/mercurial_push.py (Diff revision 13)
     
     
    Show all issues
     'itertools' imported but unused
    
  3. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 19
     W503 line break before binary operator
    
  4. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 19
     W503 line break before binary operator
    
  5. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 19
     W503 line break before binary operator
    
  6. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 1
     E302 expected 2 blank lines, found 1
    
  7. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 5
     E301 expected 1 blank line, found 0
    
  8. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 80
     E501 line too long (81 > 79 characters)
    
  9. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 5
     E301 expected 1 blank line, found 0
    
  10. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 1
     E302 expected 2 blank lines, found 1
    
  11. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 1
     E302 expected 2 blank lines, found 1
    
  12. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 1
     E302 expected 2 blank lines, found 1
    
  13. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 1
     E302 expected 2 blank lines, found 1
    
  14. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 1
     E302 expected 2 blank lines, found 1
    
  15. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 1
     E402 module level import not at top of file
    
  16. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 1
     E302 expected 2 blank lines, found 0
    
  17. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 1
     E302 expected 2 blank lines, found 1
    
  18. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 1
     E302 expected 2 blank lines, found 1
    
  19. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 27
     E127 continuation line over-indented for visual indent
    
  20. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 1
     E303 too many blank lines (3)
    
  21. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 29
     E226 missing whitespace around arithmetic operator
    
  22. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 29
     E226 missing whitespace around arithmetic operator
    
  23. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 29
     E226 missing whitespace around arithmetic operator
    
  24. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
     local variable 'repo_id2' is assigned to but never used
    
  25. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 5
     E301 expected 1 blank line, found 0
    
  26. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 1
     E302 expected 2 blank lines, found 1
    
  27. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 80
     E501 line too long (80 > 79 characters)
    
  28. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 80
     E501 line too long (81 > 79 characters)
    
  29. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
     'hg' imported but unused
    
  30. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
     'ui' imported but unused
    
  31. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 19
     W503 line break before binary operator
    
  32. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 19
     W503 line break before binary operator
    
  33. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 19
     W503 line break before binary operator
    
  34. contrib/tools/test_reviewboardhook.py (Diff revision 13)
     
     
    Show all issues
    Col: 19
     W503 line break before binary operator
    
  35. 
      
HA
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        contrib/tools/mercurial_push.py
        rbtools/hooks/tests.py
    
    
    
    Tool: Pyflakes
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        contrib/tools/mercurial_push.py
        rbtools/hooks/tests.py
    
    
  2. contrib/tools/mercurial_push.py (Diff revision 14)
     
     
    Show all issues
     'itertools' imported but unused
    
  3. 
      
HA
HA
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        contrib/tools/mercurial_push.py
        rbtools/hooks/tests.py
    
    
    
    Tool: Pyflakes
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        contrib/tools/mercurial_push.py
        rbtools/hooks/tests.py
    
    
  2. 
      
misery
  1. 
      
  2. contrib/tools/mercurial_push.py (Diff revision 15)
     
     
     
     
     
    Show all issues

    Code looks for "ticket_id_prefixes"

  3. contrib/tools/mercurial_push.py (Diff revision 15)
     
     
    Show all issues

    repo_root cannot be found here on reviewboard because reviewboard will use a remote connection like http://mercurial/scm/hg/Test. "hg root" will return "/opt/hg/Test".

  4. contrib/tools/mercurial_push.py (Diff revision 15)
     
     
     
    Show all issues

    Documentation uses "ticket_prefixes"

  5. 
      
HA
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        contrib/tools/mercurial_push.py
        rbtools/hooks/tests.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        contrib/tools/mercurial_push.py
        rbtools/hooks/tests.py
    
    
  2. 
      
misery
  1. 
      
  2. rbtools/hooks/mercurial.py (Diff revision 16)
     
     
    Show all issues

    Missing ticket_prefixes here :-)

    find_ticket_refs(new_plain_description, ticket_prefixes)
    
    1. Thanks for taking the time to find these errors!

  3. 
      
misery
  1. 
      
  2. rbtools/hooks/common.py (Diff revision 16)
     
     
    Show all issues

    The link works if we replace "re.escape(base_url)" with "base_url", otherwise the URL is broken and reviewboard shows a broken link.

    Example:
    [reviewboardhook]
    ticket_url=https://some.domain.de/jira/browse/
    ticket_id_prefixes=EXAMPLEAPP-
    
    1. You are absolutely correct. re.escape escapes too much. I now replace only backslashes, which should suffice.

      In the future I hope to be able to retrieve ticket_url directly from the Review Board repository configuration, but this is not supported by Review Board yet.

  3. 
      
HA
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        contrib/tools/test_reviewboardhook.py
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        contrib/tools/mercurial_push.py
        rbtools/hooks/tests.py
    
    
  2. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 19
     W503 line break before binary operator
    
  3. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 19
     W503 line break before binary operator
    
  4. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 19
     W503 line break before binary operator
    
  5. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 1
     E302 expected 2 blank lines, found 1
    
  6. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 5
     E301 expected 1 blank line, found 0
    
  7. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 80
     E501 line too long (81 > 79 characters)
    
  8. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 5
     E301 expected 1 blank line, found 0
    
  9. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 1
     E302 expected 2 blank lines, found 1
    
  10. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 1
     E302 expected 2 blank lines, found 1
    
  11. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 1
     E302 expected 2 blank lines, found 1
    
  12. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 1
     E302 expected 2 blank lines, found 1
    
  13. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 1
     E302 expected 2 blank lines, found 1
    
  14. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 1
     E402 module level import not at top of file
    
  15. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 1
     E302 expected 2 blank lines, found 0
    
  16. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 1
     E302 expected 2 blank lines, found 1
    
  17. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 1
     E302 expected 2 blank lines, found 1
    
  18. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 27
     E127 continuation line over-indented for visual indent
    
  19. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 1
     E303 too many blank lines (3)
    
  20. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 29
     E226 missing whitespace around arithmetic operator
    
  21. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 29
     E226 missing whitespace around arithmetic operator
    
  22. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 29
     E226 missing whitespace around arithmetic operator
    
  23. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 5
     E301 expected 1 blank line, found 0
    
  24. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 1
     E302 expected 2 blank lines, found 1
    
  25. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 80
     E501 line too long (80 > 79 characters)
    
  26. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 80
     E501 line too long (81 > 79 characters)
    
  27. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 19
     W503 line break before binary operator
    
  28. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 19
     W503 line break before binary operator
    
  29. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 19
     W503 line break before binary operator
    
  30. contrib/tools/test_reviewboardhook.py (Diff revision 17)
     
     
    Show all issues
    Col: 19
     W503 line break before binary operator
    
  31. 
      
HA
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        contrib/tools/mercurial_push.py
        rbtools/utils/review_request.py
        rbtools/hooks/tests.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        contrib/tools/mercurial_push.py
        rbtools/utils/review_request.py
        rbtools/hooks/tests.py
    
    
  2. 
      
misery
  1. 
      
  2. rbtools/hooks/mercurial.py (Diff revision 18)
     
     
    Show all issues

    If you push multiple changesets in different branches this won't work with our workflow. Could you change it to this?

    branch = extcmd(['hg', 'id', '--branch', '-r', changesets[0]]).strip()
    
    1. We added our workflow in the following code. It acts more like gerrit and the "one_review_per_changeset" option I told you. We rewrote the "push_review_hook_base" for that... I appreciate that you could merge our workflow as a separate method/option to your code. :-)

      def push_review_hook_base(root, rbrepo, node, url, submitter):
          """Run the hook with given API root, Review Board repo and changeset.
      
          node is the commit ID of the first changeset in the push.
          url is the Review Board server URL.
          submitter is the user name of the user that is submitting.
          """
          ticket_url = get_ticket_url()
          ticket_prefixes = get_ticket_prefixes()
          changesets = hghook.list_of_incoming(node)
          parent = node + '^1'
          LOGGER.info('%d changesets received.', len(changesets))
      
          approvals = []
          revreqs = []
          for changeset in changesets:
              try:
                  revreq = hghook.find_review_request(root, rbrepo, changeset)
                  diff_hash = hghook.calc_diff_hash(hghook.calculate_diff(root, [changeset], None)['diff'])
                  branch = hghook.extcmd(['hg', 'id', '--branch', '-r', changeset]).strip()
      
                  if revreq.branch == branch and 'diff_hash' in revreq.extra_data and diff_hash == revreq.extra_data['diff_hash']:
                      if hghook.approved_by_others(revreq):
                          LOGGER.info('Found approved review request (%d) for changeset: %s', revreq.id, changeset)
                          approvals.append(True)
                          revreqs.append(revreq)
                      else:
                          LOGGER.info('Found unchanged review request (%d) for changeset: %s', revreq.id, changeset)
                          approvals.append(False)
                  else:
                      LOGGER.info('Updating review request (%d) for changeset: %s', revreq.id, changeset)
                      update_and_publish(root, ticket_url, ticket_prefixes, [changeset], revreq, parent)
                      approvals.append(False)
      
              except hghook.NotFoundError:
                  if is_approved([changeset]):
                      approvals.append(True)
                  else:
                      revreq = create(root, rbrepo, submitter, url, changeset)
                      LOGGER.info('Creating review request (%d) for new changeset: %s', revreq.id, changeset)
                      update_and_publish(root, ticket_url, ticket_prefixes, [changeset], revreq, parent)
                      approvals.append(False)
      
          if all(approvals):
              for revreq in revreqs:
                  LOGGER.info('Closing review request: ' + revreq.absolute_url)
                  hghook.close_request(revreq)
              return hghook.HOOK_SUCCESS
          elif any(approvals):
              last_approved = approvals.index(False) - 1
              if last_approved > -1:
                  LOGGER.info('If you want to push the already approved changes,')
                  LOGGER.info('you can (probably) do this by executing')
                  LOGGER.info('hg push -r %s', changesets[last_approved])
      
          return hghook.HOOK_FAILED
      
    2. Up until now, the hook was designed for changesets that were in the same branch and with only one head. If the changesets belong to different branches, I guess the best/easiest option is to have one review request per changeset, as you suggest. I'll try to merge this code with the existing one.

    3. Did you found some time to merge it? :-)

  3. 
      
misery
  1. 
      
  2. contrib/tools/mercurial_push.py (Diff revision 18)
     
     
    Show all issues

    reviewboardhook can be CONFIG_SECTION

  3. contrib/tools/mercurial_push.py (Diff revision 18)
     
     
     
    Show all issues

    reviewboardhook can be CONFIG_SECTION

  4. 
      
misery
  1. If this is a separate method we can check this in our workflow

    if revreq.branch == branch and 'diff_hash' in revreq.extra_data and diff_hash == revreq.extra_data['diff_hash'] and hghook.get_description([changeset], revreq, ticket_url, ticket_prefixes) == revreq.description:
    

    instead of

    if revreq.branch == branch and 'diff_hash' in revreq.extra_data and diff_hash == revreq.extra_data['diff_hash']:
    
    1. Do you need to check the description in order to determine if the changeset should be approved? Is it because you want to enforce certain commit message standards? What I do in the current version is to run update_draft() for all changesets, which updates the description and the diff (if necessary). Then I approve the changeset if "Ship it"s have been issued after the last diff update.

    2. Yes and no... we don't wait that another one "approves" it again but the commit message it reviewed as well like in gerrit. For now it should be updated just before it will be pushed to be equal with a the changeset.

  2. rbtools/hooks/mercurial.py (Diff revision 18)
     
     
     
     
     
     
     
     
     
     
     
     
    Show all issues

    It would be nice if the "get description" could be a separate function. So we can use it to check if something is changed before we update the review request.

    def get_description(changesets, revreq, ticket_url, ticket_prefixes):
        old_description = revreq.description
        new_plain_description = generate_description(changesets)
        linked_description = linkify_ticket_refs(new_plain_description,
                                                 ticket_url, ticket_prefixes)
        return join_descriptions(old_description, linked_description)
    
    1. Well... return value needs to be stripped here, otherwise the equal check will fail

         return join_descriptions(old_description, linked_description).strip()
      
  3. 
      
misery
  1. 
      
  2. rbtools/hooks/mercurial.py (Diff revision 18)
     
     
    Show all issues

    This will fail if "line" is unicode.
    We fixed it with hasher.update(line.encode('utf-8'))

    UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 68: ordinal not in range(128)

    1. I thought line would be a byte string already? The diff should be a byte string, hence also line?

    2. Well, I don't know. I just got this error if the diff contains special signs or an umlaut - so I added that as a work-around.

  3. 
      
HA
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        contrib/tools/mercurial_push.py
        rbtools/clients/mercurial.py
        rbtools/hooks/tests.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        rbtools/hooks/common.py
        rbtools/hooks/mercurial.py
        contrib/tools/mercurial_push.py
        rbtools/clients/mercurial.py
        rbtools/hooks/tests.py
    
    
  2. contrib/tools/mercurial_push.py (Diff revision 19)
     
     
    Show all issues
    Col: 17
     W503 line break before binary operator
    
  3. 
      
misery
  1. Ping! Could some reviewer look into it to have it finally merged? We use this since 3-4 month without any problems.

  2. 
      
misery
  1. 
      
  2. contrib/tools/mercurial_push.py (Diff revision 19)
     
     
    Show all issues

    ^1 will leads to a broken "base_commit_id"

    See:
    https://code.google.com/p/reviewboard/issues/detail?id=3915

    I added this as a work-around to rbtools in "clients/mercurial.py" at "def diff":

            if "^" in base_commit_id:
                base_commit_id = self._execute(
                    ['hg', 'log', '-r', base_commit_id, '-T {node}'],
                    env=self._hg_env, results_unicode=False)
    
  3. contrib/tools/mercurial_push.py (Diff revision 19)
     
     
    Show all issues

    see above

  4. rbtools/hooks/mercurial.py (Diff revision 19)
     
     
    Show all issues

    see above

  5. rbtools/hooks/mercurial.py (Diff revision 19)
     
     
    Show all issues

    base_commit_id needs to be passed here, too. Because otherwise reviewboard will use "tip" as base and this will fail if the changeset is based on a special branch.

    diffs.upload_diff(diff_info['diff'],
                              base_commit_id=diff_info['base_commit_id'])
    
  6. rbtools/hooks/mercurial.py (Diff revision 19)
     
     
    Show all issues

    We changed it to this since a rebase could lead to a useless "whitespace changed"-update:

    if len(line) > 0 and (line[0] == b'+' or line[0] == b'-'):
    

    Also this will use the embedded "date" in the patch that will be changed after a rebase.

    Our workaround in "clients/mercurial.py" at "def diff":

    diff_cmd = ['hg', 'diff', '--hidden', '--nodates']
    
  7. 
      
david
Review request changed
Status:
Discarded