equal
deleted
inserted
replaced
|
1 # Copyright 2008-2009 LShift Ltd |
|
2 # |
|
3 # Authors: |
|
4 # Paul Crowley <paul@lshift.net> |
|
5 # |
|
6 # This software may be used and distributed according to the terms |
|
7 # of the GNU General Public License, incorporated herein by reference. |
|
8 |
|
9 from mercurial.i18n import _ |
|
10 import mercurial.util |
|
11 import mercurial.node |
|
12 |
|
13 import os |
|
14 import time |
|
15 import changes |
|
16 |
|
17 def hook(ui, repo, hooktype, node=None, source=None, **kwargs): |
|
18 if hooktype != 'changegroup': |
|
19 raise mercurial.util.Abort(_('logging installed as wrong hook type,' |
|
20 ' must be changegroup but is %s') % hooktype) |
|
21 t = time.strftime("%Y-%m-%d_%H:%M:%S", time.gmtime()) |
|
22 user = os.environ['REMOTE_USER'] |
|
23 # FIXME: lock it |
|
24 log = open(repo.join("push-log"), "a+") |
|
25 try: |
|
26 for ctx in changes.changes(repo, node): |
|
27 log.write("%s push key=%s changeset=%s\n" % |
|
28 (t, user, mercurial.node.hex(ctx.node()))) |
|
29 finally: |
|
30 log.close() |
|
31 |