Author: ratchet
Date: 2008-11-27 20:44:15 +0000 (Thu, 27 Nov 2008)
New Revision: 23921

Modified:
   trunk/apps/pyFreenetHg/FreenetHg.py
   trunk/apps/pyFreenetHg/ReadMe.html
Log:
sync with 112:5de0cb1d7f2e


Modified: trunk/apps/pyFreenetHg/FreenetHg.py
===================================================================
--- trunk/apps/pyFreenetHg/FreenetHg.py 2008-11-27 20:38:41 UTC (rev 23920)
+++ trunk/apps/pyFreenetHg/FreenetHg.py 2008-11-27 20:44:15 UTC (rev 23921)
@@ -161,12 +161,13 @@
         if extversion < REQUIRED_EXT_VERSION:
             raise Exception("Node-ext to old. Found %d, but need %d" % 
(extversion, REQUIRED_EXT_VERSION))

-    def sendCommand(self, command):
-        self._sendCommand(command.getCommandName(), command.hasData(), 
command.getItems())
+#    def sendCommand(self, command):
+#        self._sendCommand(command.getCommandName(), command.hasData(), 
command.getItems())

-    def sendCommand(self, command, data):
+    def sendCommand(self, command, data=None):
         self._sendCommand(command.getCommandName(), True, command.getItems())
-        self._sendData(data)
+        if data is not None:
+            self._sendData(data)

     def write(self, data):
         self._sendData(data)
@@ -269,13 +270,14 @@
     putcmd.setItem('UploadFrom', 'direct')
     putcmd.setItem('DataLength', len(data))

-    connection.sendCommand(putcmd)
-    connection.write(data)
-    
+    connection.sendCommand(putcmd, data)
+
     while True:
         msg = connection.readEndMessage()

-        if msg.isMessageName('PutSuccessful'):
+        if msg.isMessageName('PutFetchable') or 
msg.isMessageName('PutSuccessful'):
+            result = msg.getValue('URI')
+            print "Insert Succeeded at: " + result
             return msg.getValue('URI')

         if msg.isMessageName('ProtocolError'):
@@ -288,7 +290,7 @@
             print "Succeeded: %d  -  Required: %d  -  Total: %d  -  Failed: %d 
 -  Final: %s" % (msg.getIntValue('Succeeded'), msg.getIntValue('Required'), 
msg.getIntValue('Total'), msg.getIntValue('FatallyFailed'), 
msg.getValue('FinalizedTotal'))
             continue

-        print msg.getMessageName()
+#        print msg.getMessageName()

 def hgBundleGet(connection, uri):

@@ -318,7 +320,7 @@
             print "Succeeded: %d  -  Required: %d  -  Total: %d  -  Failed: %d 
 -  Final: %s" % (msg.getIntValue('Succeeded'), msg.getIntValue('Required'), 
msg.getIntValue('Total'), msg.getIntValue('FatallyFailed'), 
msg.getValue('FinalizedTotal'))
             continue

-        print msg.getMessageName()
+#        print msg.getMessageName()

 #
 # fcp rape end
@@ -725,7 +727,10 @@
             msg = conn.readEndMessage()

             if msg.isMessageName('PutSuccessful'):
-                return msg.getValue('URI')
+                result = msg.getValue('URI')
+                if None == hooktype:
+                    print "Insert Succeeded at: " + result
+                break

             if msg.isMessageName('ProtocolError'):
                 raise Exception("ProtocolError(%d) - %s: %s" % 
(msg.getIntValue('Code'), msg.getValue('CodeDescription'), 
msg.getValue('ExtraDescription')))
@@ -737,7 +742,7 @@
                 print "Succeeded: %d  -  Required: %d  -  Total: %d  -  
Failed: %d  -  Final: %s" % (msg.getIntValue('Succeeded'), 
msg.getIntValue('Required'), msg.getIntValue('Total'), 
msg.getIntValue('FatallyFailed'), msg.getValue('FinalizedTotal'))
                 continue

-            print msg.getMessageName()
+            #print msg.getMessageName()

     except Exception, e:
         print e

Modified: trunk/apps/pyFreenetHg/ReadMe.html
===================================================================
--- trunk/apps/pyFreenetHg/ReadMe.html  2008-11-27 20:38:41 UTC (rev 23920)
+++ trunk/apps/pyFreenetHg/ReadMe.html  2008-11-27 20:44:15 UTC (rev 23921)
@@ -3,6 +3,7 @@
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 <title>Freenet and mercurial</title>
+<style type="text/css">@import url("schmucklos.css?type=text/css");</style>
 </head>
 <body style="margin: 1cm">
 <p>&nbsp;</p>
@@ -61,7 +62,7 @@
 <p>
 Mercurial is written in python and has a plugin system. so it should not be to 
much difficulty to get it
 working with freenet.<br>
-<pre>
+<pre xml:space="preserve" class="wiki">
 the basic idea: wrap around (selected) commands and use freenet as transport 
instead of files
      hg fcp-bundle   -> wraps around hg bundle and put a chk/usk instead a 
local file
      hg fcp-unbundle -> wraps around hg unbundle and get it from a chk/usk 
instead a local file        
@@ -91,7 +92,7 @@
 <p>download <a href="FreenetHg.py" target="_blank">FreenetHg.py</a> and put it 
somewhere.<br>
 add the following to your <i>~/.hgrc</i>:
 </p>
-<pre>
+<pre xml:space="preserve" class="wiki">
 [extensions]
 freenethg=/path/to/FreenetHg.py
 </pre>
@@ -102,7 +103,7 @@

 <a name="conf_username"><h4>Username</h4></a>
 <p>To prevent identity leaks you should add a username to each 
<i>./hg/hgrc</i>:
-<pre>
+<pre xml:space="preserve" class="wiki">
 [ui]
 username = Your Name
 </pre>
@@ -118,7 +119,7 @@
 </p>
 <a name="conf_updatestatic_hook"><h5>updatestatic_hook</h5></a>
 This is the most simple hook. The repository gets updated on every commit.
-<pre>
+<pre xml:space="preserve" class="wiki">
 [hooks]
 commit = python:freenethg.updatestatic_hook

@@ -131,7 +132,7 @@
 <a name="conf_updatestatic_hook2"><h5>updatestatic_hook2</h5></a>
 With this hook configuration, update of repository only takes place if the 
given <i>uploadkeyword</i> is in the commit message.
 (The repository can be updated at any time with <i>hg fcp-updatestatic</i>).
-<pre>
+<pre xml:space="preserve" class="wiki">
 [hooks]
 commit = python:freenethg.updatestatic_hook2

@@ -144,7 +145,7 @@
 </pre>
 <a name="conf_updatestatic_hook3"><h5>updatestatic_hook3</h5></a>
 This hook is still under development. It will use the SiteToolPlugin to reduce 
the size of inserts for big repositories.
-<pre>
+<pre xml:space="preserve" class="wiki">
 [hooks]
 commit = python:freenethg.updatestatic_hook3

@@ -203,7 +204,7 @@
 You can provide your own html template by adding this option to section 
<i>freenethg</i>:<br>
 &nbsp;<br>

-<pre>
+<pre xml:space="preserve" class="wiki">
 [freenethg]
 indextemplate = /path/to/template
 </pre>
@@ -224,7 +225,7 @@
 <p>
 First, put a <i>notify=&lt;group&gt;</i> in your <i>.hg/hgrc</i>, then add a 
special config section for this group.<br>

-<pre>
+<pre xml:space="preserve" class="wiki">
 [freenethg]
 notify = name name2 ...

@@ -247,7 +248,7 @@
 <a name="not_fms"><h4>FMS</h4></a>
 This is an example notification config for FMS:

-<pre>
+<pre xml:space="preserve" class="wiki">
 [freenethg]
 .
 .
@@ -255,8 +256,8 @@

 [notify_fmstest]
 type = fmsnntp
-updatestatic_message_template = /home/klaus/devel/fmstemplate.txt (optional)
-bundle_message_template = /home/klaus/devel/fmstemplate_bundle.txt (optional)
+updatestatic_message_template = /path/to/fmstemplate.txt (optional)
+bundle_message_template = /path/to/fmstemplate_bundle.txt (optional)
 fmsuser = Alice
 fmshost = 127.0.0.1
 fmsport = 1119


Reply via email to