hgext/hooklib/__init__.py
author Martin von Zweigbergk <martinvonz@google.com>
Thu, 19 Nov 2020 10:29:06 -0800
changeset 45880 7a273336d3d3
parent 44413 4cabeea6d214
child 48875 6000f5b25c9b
permissions -rw-r--r--
errors: restructure formatparse() to clarify conditions a bit The `similar` list will be calculated only for `error.UnknownIdentifier`. It was then printed only if `inst.location is None`, which is true for that exception type, but it's an indirect condition to rely on. Also, it looked from the code like it could both report similarities and print a hint. That would be a little awkward because the similarity report looks similar to the hint (both are printed within parentheses). I also added a `elif` to clarify that. I plan to refactor this more coming patches so the similarity report actually is a hint. Differential Revision: https://phab.mercurial-scm.org/D9343
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
44413
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     1
"""collection of simple hooks for common tasks (EXPERIMENTAL)
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     2
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     3
This extension provides a number of simple hooks to handle issues
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     4
commonly found in repositories with many contributors:
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     5
- email notification when changesets move from draft to public phase
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     6
- email notification when changesets are obsoleted
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     7
- enforcement of draft phase for all incoming changesets
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     8
- enforcement of a no-branch-merge policy
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     9
- enforcement of a no-multiple-heads policy
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    10
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    11
The implementation of the hooks is subject to change, e.g. whether to
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    12
implement them as individual hooks or merge them into the notify
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    13
extension as option. The functionality itself is planned to be supported
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    14
long-term.
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    15
"""
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    16
from __future__ import absolute_import
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    17
from . import (
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    18
    changeset_obsoleted,
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    19
    changeset_published,
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    20
)
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    21
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    22
# configtable is only picked up from the "top-level" module of the extension,
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    23
# so expand it here to ensure all items are properly loaded
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    24
configtable = {}
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    25
configtable.update(changeset_published.configtable)
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    26
configtable.update(changeset_obsoleted.configtable)