hgkw/updatekw.py
author Christian Ebert <blacktrash@gmx.net>
Thu, 14 Dec 2006 10:33:35 +0100
branchupdatehook
changeset 7 e5f131217f87
parent 5 85d1f5bf7cfc
child 19 d1f478aa61c5
permissions -rw-r--r--
Add pretxnkw module for updatehook branch

# $Hg: updatekw.py,v$

from hgkw import kwexpander

def updatekw(ui=None, repo=None, hooktype='', **args):
    '''Important: returns False on success, True on failure.'''

    if not ui or not repo or hooktype != 'update':
        # bail out with error
        return True

    parent1 = repo.dirstate.parents()[0]
    node = repo.changectx(parent1)

    (modified, added, removed, deleted,
            unknown, ignored, clean) = repo.status(node1=parent1)

    candidates = modified + added + clean

    return kwexpander.expandkw(ui, repo, parent1, node, candidates)