k0s  committed b0a1948

[svn r5055] revert r4425

  • Participants
  • Parent commits 2e1b2bb

Comments (0)

Files changed (5)

File 0.11/repository_hook_system/README

-To make the sample TicketChanger plugin work, you need to add this to
-your trac.ini:
-post-commit = TicketChanger
-You also need to add a post-commit hook to SVN:
-full_path_to_python full_path_to_repository_hook_system/ --hook=post-commit -p full_path_to_repository $REV

File 0.11/repository_hook_system/

     def is_available(repository, hookname):
         """can this subscriber be invoked on this hook?"""        
-    def after_commit(changeset):
-        """what to do after a commit"""
-    def before_commit(changeset):
-        """what to do before a commit"""
-    def other_repository_action(*args):
-        """what to do in the case of some other repositiory action"""
+    def invoke(changeset):
+        """what to do on a commit"""
 ### interfaces for the hook system
 class IRepositoryChangeListener(Interface):
-    """This is a particular type of repository (SVN, Git, etc)'s change
-    listener."""
+    """listeners to changes from repository hooks"""
     def type():
         """list of types of repository to listen for changes"""

File 0.11/repository_hook_system/

         # find the active listeners
         listeners = ExtensionPoint(IRepositoryChangeListener).extensions(env)
         # find the listener for the given repository type and invoke the hook
         for listener in listeners:
             if env.config.get('trac', 'repository_type') in listener.type():
-                changeset = listener.changeset(repo, hook, *args)
+                changeset = listener.changeset(repo, *args)
                 subscribers = listener.subscribers(hook)
                 for subscriber in subscribers:
-                    funcname = hook.replace("-","_")
-                    func = getattr(subscriber, funcname, None)
-                    if func:
-                        func(changeset)
+                    subscriber.invoke(changeset)
 def filename():
     return os.path.abspath(__file__.rstrip('c'))

File 0.11/repository_hook_system/

 from trac.config import ListOption
 from trac.core import *
 from trac.util.text import CRLF
-from trac.versioncontrol.api import NoSuchChangeset
 from utils import iswritable
 class SVNHookSystem(FileSystemHooks):
                  in getattr(self, hookname, []) 
                  and subscriber.is_available(self.type(), hookname) ]
-    def changeset(self, repo, hook, revision):
+    def changeset(self, repo, revision):
         return the changeset given the repository object and revision number
-            if hook == 'pre-commit':
-                chgset = {'transaction' : revision} #Trac has no way to get a transaction out of svn
-            else:
-                chgset = repo.get_changeset(revision)
+            chgset = repo.get_changeset(revision)
         except NoSuchChangeset:
             # XXX should probably throw an exception (same one?)
             return # out of scope changesets are not cached

File 0.11/repository_hook_system/

     def is_available(self, repository, hookname):
         return True
-    def post_commit(self, chgset):
+    def invoke(self, chgset):
         # regular expressions        
         ticket_prefix = '(?:#|(?:ticket|issue|bug)[: ]?)'