# HG changeset patch
# User Paul Crowley <paul@lshift.net>
# Date 1235143455 0
# Node ID 2661b21688d424b9dfdbbce6e31d5742748c5252
# Parent  e2ca551c282254918daf0d42f0f2fb82840f2ebb
Log pulls too

diff -r e2ca551c2822 -r 2661b21688d4 src/init/conf/remote-hgrc
--- a/src/init/conf/remote-hgrc	Fri Feb 20 15:19:51 2009 +0000
+++ b/src/init/conf/remote-hgrc	Fri Feb 20 15:24:15 2009 +0000
@@ -6,4 +6,5 @@
 [hooks]
 pretxnchangegroup.access = python:access.hook
 changegroup.aaaaa_logging = python:logging.hook
+outgoing.aaaaa_logging = python:logging.hook
 
diff -r e2ca551c2822 -r 2661b21688d4 src/logging.py
--- a/src/logging.py	Fri Feb 20 15:19:51 2009 +0000
+++ b/src/logging.py	Fri Feb 20 15:24:15 2009 +0000
@@ -15,17 +15,21 @@
 import changes
         
 def hook(ui, repo, hooktype, node=None, source=None, **kwargs):
-    if hooktype != 'changegroup':
+    if hooktype == 'changegroup':
+        op = "push"
+    elif hooktype == 'outgoing':
+        op = "pull"
+    else:
         raise mercurial.util.Abort(_('logging installed as wrong hook type,'
-            ' must be changegroup but is %s') % hooktype)
+            ' must be changegroup or outgoing but is %s') % hooktype)
     t = time.strftime("%Y-%m-%d_%H:%M:%S", time.gmtime())
     user = os.environ['REMOTE_USER']
     # FIXME: lock it
     log = open(repo.join("push-log"), "a+")
     try:
         for ctx in changes.changes(repo, node):
-            log.write("%s push key=%s changeset=%s\n" % 
-                (t, user, mercurial.node.hex(ctx.node())))
+            log.write("%s %s key=%s changeset=%s\n" % 
+                (t, op, user, mercurial.node.hex(ctx.node())))
     finally:
         log.close()