Giter VIP home page Giter VIP logo

gerrit-hooks's People

Contributors

jf-ct avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

jf-ct

gerrit-hooks's Issues

Implement support for multiple args in hashtag-created hook

The current implementation of the hashtag-created hook would only allow one of each:

  1. --removed
  2. --added
  3. --hashtag

Support for multiple of these needs to be implemented, since bulk-changes to hashtags are currently not supported due to this limitation.

When arguments are passed to script via $@ in bash script, quoted parameters like --author get truncated

This may not be a bug in the library, but it may be possible to set nargs="+" and then have some logic to do a ' '.join(gerrit_args.author) (and so on for similar fields)

So far I have had to do a workaround after parsing (using sys.argv) for the following fields:

  • --uploader
  • --change-owner
  • --author

Another similar issue occurs when Gerrit passes --topic without any argument, and the parser expects one to be there. (i.e. some of the configurations could be tweaked for certain options)

Maybe instead of _generate_parser() there could be an extra step before that like _generate_options() so that the options could be modified before the call to _generate_parser()

Add Auto-detection of Hook type

Currently, the developers have to define the type of hook they're writing, by passing a str to the build_parser_for() function (or using the HookType container class to do so).

Since the hook names are identical to the file names in the common case, add an auto-detection mechanism, to automatically select the appropriate parser to build.

It could then look like this:

import gerrit_hooks

options = gerrit_hooks.parse_options()

Where parse_options() would throw an error if we can't make anything of the current file-type.

no handling for change-deleted hook

https://gerrit.googlesource.com/plugins/hooks/+/refs/heads/stable-2.15/src/main/resources/Documentation/hooks.md#change_deleted

Traceback (most recent call last):
  File "...", line ..., in <module>
    gerrit_parser = gerrit_hooks.build_parser_for(args.gerrit_event)
  File "/usr/local/lib/python3.5/dist-packages/gerrit_hooks/hook.py", line 37, in build_parser_for
    cli_flags = HookFlagDefinitions()[hook_type]
  File "/usr/local/lib/python3.5/dist-packages/gerrit_hooks/containers.py", line 172, in __getitem__
    flag_string = self.__mapping__[item]
KeyError: 'change-deleted'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.