Author: saces Date: To: pyfreenet Subject: [Pyfreenet] r22115 - trunk/apps/pyFreenetHg
Author: saces
Date: 2008-08-23 12:10:37 +0000 (Sat, 23 Aug 2008)
New Revision: 22115
Modified:
trunk/apps/pyFreenetHg/FreenetHg.py
Log:
upload trigger by keyword in commit comment works now
Modified: trunk/apps/pyFreenetHg/FreenetHg.py
===================================================================
--- trunk/apps/pyFreenetHg/FreenetHg.py 2008-08-23 12:09:39 UTC (rev 22114)
+++ trunk/apps/pyFreenetHg/FreenetHg.py 2008-08-23 12:10:37 UTC (rev 22115)
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-
+# -*- coding: utf-8 -*-
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
@@ -15,6 +15,8 @@
from mercurial import hg
from mercurial import commands
+from mercurial import repo,cmdutil,util,ui,revlog,node
+from mercurial.node import bin
- kw = ui.config('freenethg', 'uploadkeyword')
+ # if ukw not set or empty throw an error
- # if kw not set throw an error
+ ukw = ui.config('freenethg', 'uploadkeyword')
+ if not ukw:
+ raise Exception, 'required config option »uploadkeyword« not set'
+
+ if len(ukw.strip()) == 0:
+ raise Exception, 'the keyword must contains at least one printable non-whitespace char'
+
+ comment = repo.changelog.read(bin(node))[4]
+
+ if ukw in comment:
+ updatestatic_hook(ui, repo, hooktype, node, kwargs)
+
+def updatestatic_hook3(ui, repo, hooktype, node=None, source=None, **kwargs):
+ """update static """
+
+ # if ukw not set or empty throw an error
+
+ ukw = ui.config('freenethg', 'uploadkeyword')
+
+ if not ukw:
+ raise ConfigError, 'required config option »uploadkeyword« not set'
+
+ # the keyword must contains at least one printable non-whitespace char
+ # test_ukw = ukw.trim()
+
+ #if test_ukw == "":
+ # raise ConfigError, 'required config option »uploadkeyword« cant be empty'
+
+ # if kw not set or empty throw an error
+
# message = getCommitMessage
# if messege not contains kw
# nothing to do, return