author | Christian Ebert <blacktrash@gmx.net> |
Sat, 16 Dec 2006 15:53:45 +0100 | |
branch | updatehook |
changeset 21 | 536c1797202d |
parent 20 | 6dc2b4268920 |
child 26 | bda0dec1aaf1 |
permissions | -rw-r--r-- |
20
6dc2b4268920
Simplify for $Hg$ expansion scheme
Christian Ebert <blacktrash@gmx.net>
parents:
7
diff
changeset
|
1 |
# $Hg$ |
7
e5f131217f87
Add pretxnkw module for updatehook branch
Christian Ebert <blacktrash@gmx.net>
parents:
diff
changeset
|
2 |
|
20
6dc2b4268920
Simplify for $Hg$ expansion scheme
Christian Ebert <blacktrash@gmx.net>
parents:
7
diff
changeset
|
3 |
import kwexpander |
7
e5f131217f87
Add pretxnkw module for updatehook branch
Christian Ebert <blacktrash@gmx.net>
parents:
diff
changeset
|
4 |
|
20
6dc2b4268920
Simplify for $Hg$ expansion scheme
Christian Ebert <blacktrash@gmx.net>
parents:
7
diff
changeset
|
5 |
def pretxnkw(ui, repo, hooktype, **args): |
7
e5f131217f87
Add pretxnkw module for updatehook branch
Christian Ebert <blacktrash@gmx.net>
parents:
diff
changeset
|
6 |
'''Important: returns False on success, True on failure.''' |
e5f131217f87
Add pretxnkw module for updatehook branch
Christian Ebert <blacktrash@gmx.net>
parents:
diff
changeset
|
7 |
|
20
6dc2b4268920
Simplify for $Hg$ expansion scheme
Christian Ebert <blacktrash@gmx.net>
parents:
7
diff
changeset
|
8 |
if hooktype != 'pretxncommit': |
7
e5f131217f87
Add pretxnkw module for updatehook branch
Christian Ebert <blacktrash@gmx.net>
parents:
diff
changeset
|
9 |
# bail out with error |
e5f131217f87
Add pretxnkw module for updatehook branch
Christian Ebert <blacktrash@gmx.net>
parents:
diff
changeset
|
10 |
return True |
e5f131217f87
Add pretxnkw module for updatehook branch
Christian Ebert <blacktrash@gmx.net>
parents:
diff
changeset
|
11 |
|
20
6dc2b4268920
Simplify for $Hg$ expansion scheme
Christian Ebert <blacktrash@gmx.net>
parents:
7
diff
changeset
|
12 |
tip = repo.changelog.tip() |
6dc2b4268920
Simplify for $Hg$ expansion scheme
Christian Ebert <blacktrash@gmx.net>
parents:
7
diff
changeset
|
13 |
modified, added = repo.status()[:2] |
7
e5f131217f87
Add pretxnkw module for updatehook branch
Christian Ebert <blacktrash@gmx.net>
parents:
diff
changeset
|
14 |
candidates = modified + added |
20
6dc2b4268920
Simplify for $Hg$ expansion scheme
Christian Ebert <blacktrash@gmx.net>
parents:
7
diff
changeset
|
15 |
# TODO: check whether we need parent1&2 like in updatekw |
7
e5f131217f87
Add pretxnkw module for updatehook branch
Christian Ebert <blacktrash@gmx.net>
parents:
diff
changeset
|
16 |
|
20
6dc2b4268920
Simplify for $Hg$ expansion scheme
Christian Ebert <blacktrash@gmx.net>
parents:
7
diff
changeset
|
17 |
return kwexpander.expandkw(ui, repo, |
6dc2b4268920
Simplify for $Hg$ expansion scheme
Christian Ebert <blacktrash@gmx.net>
parents:
7
diff
changeset
|
18 |
tip, args['node'][0:12], candidates, update=False) |