diff mercurial/localrepo.py @ 1730:0f1d2c75db5e

add prechangegroup and pretxnchangegroup hooks. prechangegroup lets you stop push, pull or unbundle before it begins. pretxnchangegroup lets you inspect changegroup before transaction is committed, and roll back if you not like it.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Wed, 15 Feb 2006 10:49:30 -0800
parents 801756d0ca84
children d3e6da334b85
line wrap: on
line diff
--- a/mercurial/localrepo.py	Wed Feb 15 10:40:15 2006 -0800
+++ b/mercurial/localrepo.py	Wed Feb 15 10:49:30 2006 -0800
@@ -1342,6 +1342,9 @@
 
         if not source:
             return
+
+        self.hook('prechangegroup', throw=True)
+
         changesets = files = revisions = 0
 
         tr = self.transaction()
@@ -1384,6 +1387,9 @@
                          " with %d changes to %d files%s\n")
                          % (changesets, revisions, files, heads))
 
+        self.hook('pretxnchangegroup', throw=True,
+                  node=hex(self.changelog.node(cor+1)))
+
         tr.close()
 
         if changesets > 0: