fishbone for all other hooks
authorAlexander Kanevskiy <alexander.kanevskiy@intel.com>
Tue, 13 Aug 2013 11:39:50 +0000 (14:39 +0300)
committerAlexander Kanevskiy <alexander.kanevskiy@intel.com>
Tue, 13 Aug 2013 11:39:50 +0000 (14:39 +0300)
gerrithooks/change_abandoned.py [new file with mode: 0644]
gerrithooks/change_merged.py [new file with mode: 0644]
gerrithooks/change_restored.py [new file with mode: 0644]
gerrithooks/cla_signed.py [new file with mode: 0644]
gerrithooks/comment_added.py [new file with mode: 0644]
gerrithooks/draft_published.py [new file with mode: 0644]
gerrithooks/merge_failed.py [new file with mode: 0644]
gerrithooks/ref_update.py [new file with mode: 0644]
gerrithooks/ref_updated.py [new file with mode: 0644]
gerrithooks/reviewer_added.py [new file with mode: 0644]

diff --git a/gerrithooks/change_abandoned.py b/gerrithooks/change_abandoned.py
new file mode 100644 (file)
index 0000000..7ae688f
--- /dev/null
@@ -0,0 +1,53 @@
+#!/usr/bin/env
+# -*- coding: UTF-8 -*-
+# vim: sw=4 ts=4 expandtab ai
+#
+# Copyright (c) 2013 Intel, Inc.
+# License: GPLv2
+# Author: Alexander Kanevskiy <alexander.kanevskiy@intel.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License, version 2,
+# as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+
+
+"""
+change-abandoned hook entry module
+"""
+
+import sys
+import argparse
+
+from gerrithooks.common import run_plugin_hooks
+
+def parse_cmdline(argv):
+    """Parse hook command line parameters."""
+    parser = argparse.ArgumentParser(
+        description="Gerrit change-abandoned hook")
+    args = (
+            "--change",     # <change id>
+            "--change-url", # <change url>
+            "--project",    # <project name>
+            "--branch",     # <branch>
+            "--topic",      # <topic>
+            "--abandoner",  # <abandoner>
+            "--reason"      # <reason>
+        )
+    for arg in args:
+        parser.add_argument(arg)
+    parser.add_argument("-d", "--debug", action="store_true")
+    return parser.parse_args(argv)
+
+
+def main():
+    """ change-abandoned hook entry """
+
+    return run_plugin_hooks("change-abandoned", parse_cmdline)
+
+if __name__ == "__main__":
+    sys.exit(main())
diff --git a/gerrithooks/change_merged.py b/gerrithooks/change_merged.py
new file mode 100644 (file)
index 0000000..aa82878
--- /dev/null
@@ -0,0 +1,53 @@
+#!/usr/bin/env
+# -*- coding: UTF-8 -*-
+# vim: sw=4 ts=4 expandtab ai
+#
+# Copyright (c) 2013 Intel, Inc.
+# License: GPLv2
+# Author: Alexander Kanevskiy <alexander.kanevskiy@intel.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License, version 2,
+# as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+
+
+"""
+change-merged hook entry module
+"""
+
+import sys
+import argparse
+
+from gerrithooks.common import run_plugin_hooks
+
+def parse_cmdline(argv):
+    """Parse hook command line parameters."""
+    parser = argparse.ArgumentParser(
+        description="Gerrit change-merged hook")
+    args = (
+            "--change",     # <change id>
+            "--change-url", # <change url>
+            "--project",    # <project name>
+            "--branch",     # <branch>
+            "--topic",      # <topic>
+            "--submitter",  # <submitter>
+            "--commit",     # <sha1>
+        )
+    for arg in args:
+        parser.add_argument(arg)
+    parser.add_argument("-d", "--debug", action="store_true")
+    return parser.parse_args(argv)
+
+
+def main():
+    """ change-merged hook entry """
+
+    return run_plugin_hooks("change-merged", parse_cmdline)
+
+if __name__ == "__main__":
+    sys.exit(main())
diff --git a/gerrithooks/change_restored.py b/gerrithooks/change_restored.py
new file mode 100644 (file)
index 0000000..ac66758
--- /dev/null
@@ -0,0 +1,53 @@
+#!/usr/bin/env
+# -*- coding: UTF-8 -*-
+# vim: sw=4 ts=4 expandtab ai
+#
+# Copyright (c) 2013 Intel, Inc.
+# License: GPLv2
+# Author: Alexander Kanevskiy <alexander.kanevskiy@intel.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License, version 2,
+# as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+
+
+"""
+change-restored hook entry module
+"""
+
+import sys
+import argparse
+
+from gerrithooks.common import run_plugin_hooks
+
+def parse_cmdline(argv):
+    """Parse hook command line parameters."""
+    parser = argparse.ArgumentParser(
+        description="Gerrit change-restored hook")
+    args = (
+            "--change",     # <change id>
+            "--change-url", # <change url>
+            "--project",    # <project name>
+            "--branch",     # <branch>
+            "--topic",      # <topic>
+            "--restorer",   # <restorer>
+            "--reason",     # <reason>
+        )
+    for arg in args:
+        parser.add_argument(arg)
+    parser.add_argument("-d", "--debug", action="store_true")
+    return parser.parse_args(argv)
+
+
+def main():
+    """ change-restored hook entry """
+
+    return run_plugin_hooks("change-restored", parse_cmdline)
+
+if __name__ == "__main__":
+    sys.exit(main())
diff --git a/gerrithooks/cla_signed.py b/gerrithooks/cla_signed.py
new file mode 100644 (file)
index 0000000..5bfc81e
--- /dev/null
@@ -0,0 +1,49 @@
+#!/usr/bin/env
+# -*- coding: UTF-8 -*-
+# vim: sw=4 ts=4 expandtab ai
+#
+# Copyright (c) 2013 Intel, Inc.
+# License: GPLv2
+# Author: Alexander Kanevskiy <alexander.kanevskiy@intel.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License, version 2,
+# as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+
+
+"""
+cla-signed hook entry module
+"""
+
+import sys
+import argparse
+
+from gerrithooks.common import run_plugin_hooks
+
+def parse_cmdline(argv):
+    """Parse hook command line parameters."""
+    parser = argparse.ArgumentParser(
+        description="Gerrit cla-signed hook")
+    args = (
+            "--submitter",  # <submitter>
+            "--user-id",    # <user_id>
+            "--cla-id",     # <cla_id>
+        )
+    for arg in args:
+        parser.add_argument(arg)
+    parser.add_argument("-d", "--debug", action="store_true")
+    return parser.parse_args(argv)
+
+
+def main():
+    """ cla-signed hook entry """
+
+    return run_plugin_hooks("cla-signed", parse_cmdline)
+
+if __name__ == "__main__":
+    sys.exit(main())
diff --git a/gerrithooks/comment_added.py b/gerrithooks/comment_added.py
new file mode 100644 (file)
index 0000000..51772e0
--- /dev/null
@@ -0,0 +1,56 @@
+#!/usr/bin/env
+# -*- coding: UTF-8 -*-
+# vim: sw=4 ts=4 expandtab ai
+#
+# Copyright (c) 2013 Intel, Inc.
+# License: GPLv2
+# Author: Alexander Kanevskiy <alexander.kanevskiy@intel.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License, version 2,
+# as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+
+
+"""
+comment-added hook entry module
+"""
+
+import sys
+import argparse
+
+from gerrithooks.common import run_plugin_hooks
+
+def parse_cmdline(argv):
+    """Parse hook command line parameters."""
+    parser = argparse.ArgumentParser(
+        description="Gerrit comment-added hook")
+    args = (
+            "--change",     # <change id>
+            "--is-draft",   # <boolean>
+            "--change-url", # <change url>
+            "--project",    # <project name>
+            "--branch",     # <branch>
+            "--topic",      # <topic>
+            "--author",     # <comment author>
+            "--commit",     # <commit>
+            "--comment",    # <comment>
+            # TODO: [--<approval category id> <score> ...]
+        )
+    for arg in args:
+        parser.add_argument(arg)
+    parser.add_argument("-d", "--debug", action="store_true")
+    return parser.parse_known_args(argv)
+
+
+def main():
+    """ comment-added hook entry """
+
+    return run_plugin_hooks("comment-added", parse_cmdline)
+
+if __name__ == "__main__":
+    sys.exit(main())
diff --git a/gerrithooks/draft_published.py b/gerrithooks/draft_published.py
new file mode 100644 (file)
index 0000000..89eebe2
--- /dev/null
@@ -0,0 +1,54 @@
+#!/usr/bin/env
+# -*- coding: UTF-8 -*-
+# vim: sw=4 ts=4 expandtab ai
+#
+# Copyright (c) 2013 Intel, Inc.
+# License: GPLv2
+# Author: Alexander Kanevskiy <alexander.kanevskiy@intel.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License, version 2,
+# as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+
+
+"""
+draft-published hook entry module
+"""
+
+import sys
+import argparse
+
+from gerrithooks.common import run_plugin_hooks
+
+def parse_cmdline(argv):
+    """Parse hook command line parameters."""
+    parser = argparse.ArgumentParser(
+        description="Gerrit draft-published hook")
+    args = (
+            "--change",     # <change id>
+            "--change-url", # <change url>
+            "--project",    # <project name>
+            "--branch",     # <branch>
+            "--topic",      # <topic>
+            "--uploader",   # <uploader>
+            "--commit",     # <sha1>
+            "--patchset",   # <patchset id>
+        )
+    for arg in args:
+        parser.add_argument(arg)
+    parser.add_argument("-d", "--debug", action="store_true")
+    return parser.parse_args(argv)
+
+
+def main():
+    """ draft-published hook entry """
+
+    return run_plugin_hooks("draft-published", parse_cmdline)
+
+if __name__ == "__main__":
+    sys.exit(main())
diff --git a/gerrithooks/merge_failed.py b/gerrithooks/merge_failed.py
new file mode 100644 (file)
index 0000000..75b7708
--- /dev/null
@@ -0,0 +1,54 @@
+#!/usr/bin/env
+# -*- coding: UTF-8 -*-
+# vim: sw=4 ts=4 expandtab ai
+#
+# Copyright (c) 2013 Intel, Inc.
+# License: GPLv2
+# Author: Alexander Kanevskiy <alexander.kanevskiy@intel.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License, version 2,
+# as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+
+
+"""
+merge-failed hook entry module
+"""
+
+import sys
+import argparse
+
+from gerrithooks.common import run_plugin_hooks
+
+def parse_cmdline(argv):
+    """Parse hook command line parameters."""
+    parser = argparse.ArgumentParser(
+        description="Gerrit merge-failed hook")
+    args = (
+            "--change",     # <change id>
+            "--change-url", # <change url>
+            "--project",    # <project name>
+            "--branch",     # <branch>
+            "--topic",      # <topic>
+            "--submitter",  # <submitter>
+            "--commit",     # <sha1>
+            "--reason",     # <reason>
+        )
+    for arg in args:
+        parser.add_argument(arg)
+    parser.add_argument("-d", "--debug", action="store_true")
+    return parser.parse_args(argv)
+
+
+def main():
+    """ merge-failed hook entry """
+
+    return run_plugin_hooks("merge-failed", parse_cmdline)
+
+if __name__ == "__main__":
+    sys.exit(main())
diff --git a/gerrithooks/ref_update.py b/gerrithooks/ref_update.py
new file mode 100644 (file)
index 0000000..b0f8bb6
--- /dev/null
@@ -0,0 +1,51 @@
+#!/usr/bin/env
+# -*- coding: UTF-8 -*-
+# vim: sw=4 ts=4 expandtab ai
+#
+# Copyright (c) 2013 Intel, Inc.
+# License: GPLv2
+# Author: Alexander Kanevskiy <alexander.kanevskiy@intel.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License, version 2,
+# as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+
+
+"""
+ref-update hook entry module
+"""
+
+import sys
+import argparse
+
+from gerrithooks.common import run_plugin_hooks
+
+def parse_cmdline(argv):
+    """Parse hook command line parameters."""
+    parser = argparse.ArgumentParser(
+        description="Gerrit ref-update hook")
+    args = (
+            "--project",    # <project name>
+            "--refname",    # <refname>
+            "--uploader",   # <uploader>
+            "--oldrev",     # <sha1>
+            "--newrev"      # <sha1>
+        )
+    for arg in args:
+        parser.add_argument(arg)
+    parser.add_argument("-d", "--debug", action="store_true")
+    return parser.parse_args(argv)
+
+
+def main():
+    """ ref-update hook entry """
+
+    return run_plugin_hooks("ref-update", parse_cmdline)
+
+if __name__ == "__main__":
+    sys.exit(main())
diff --git a/gerrithooks/ref_updated.py b/gerrithooks/ref_updated.py
new file mode 100644 (file)
index 0000000..a7b91cc
--- /dev/null
@@ -0,0 +1,51 @@
+#!/usr/bin/env
+# -*- coding: UTF-8 -*-
+# vim: sw=4 ts=4 expandtab ai
+#
+# Copyright (c) 2013 Intel, Inc.
+# License: GPLv2
+# Author: Alexander Kanevskiy <alexander.kanevskiy@intel.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License, version 2,
+# as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+
+
+"""
+red-updated hook entry module
+"""
+
+import sys
+import argparse
+
+from gerrithooks.common import run_plugin_hooks
+
+def parse_cmdline(argv):
+    """Parse hook command line parameters."""
+    parser = argparse.ArgumentParser(
+        description="Gerrit red-updated hook")
+    args = (
+            "--oldrev",     # <old rev>
+            "--newrev",     # <new rev>
+            "--refname",    # <ref name>
+            "--project",    # <project name>
+            "--submitter",  # <submitter>
+        )
+    for arg in args:
+        parser.add_argument(arg)
+    parser.add_argument("-d", "--debug", action="store_true")
+    return parser.parse_args(argv)
+
+
+def main():
+    """ red-updated hook entry """
+
+    return run_plugin_hooks("red-updated", parse_cmdline)
+
+if __name__ == "__main__":
+    sys.exit(main())
diff --git a/gerrithooks/reviewer_added.py b/gerrithooks/reviewer_added.py
new file mode 100644 (file)
index 0000000..a11e0f6
--- /dev/null
@@ -0,0 +1,51 @@
+#!/usr/bin/env
+# -*- coding: UTF-8 -*-
+# vim: sw=4 ts=4 expandtab ai
+#
+# Copyright (c) 2013 Intel, Inc.
+# License: GPLv2
+# Author: Alexander Kanevskiy <alexander.kanevskiy@intel.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License, version 2,
+# as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+
+
+"""
+reviewer-added hook entry module
+"""
+
+import sys
+import argparse
+
+from gerrithooks.common import run_plugin_hooks
+
+def parse_cmdline(argv):
+    """Parse hook command line parameters."""
+    parser = argparse.ArgumentParser(
+        description="Gerrit reviewer-added hook")
+    args = (
+            "--change", # <change id>
+            "--change-url", # <change url>
+            "--project", # <project name>
+            "--branch", # <branch>
+            "--reviewer", # <reviewer>
+        )
+    for arg in args:
+        parser.add_argument(arg)
+    parser.add_argument("-d", "--debug", action="store_true")
+    return parser.parse_args(argv)
+
+
+def main():
+    """ reviewer-added hook entry """
+
+    return run_plugin_hooks("reviewer-added", parse_cmdline)
+
+if __name__ == "__main__":
+    sys.exit(main())