From pmpp at freenetproject.org Wed Jul 2 16:35:49 2008 From: pmpp at freenetproject.org (pmpp at freenetproject.org) Date: Wed, 2 Jul 2008 16:35:49 +0000 (UTC) Subject: [Pyfreenet] r20936 - trunk/apps/pyFreenet/fcp Message-ID: <20080702163549.0B844479B95@freenetproject.org> Author: pmpp Date: 2008-07-02 16:35:48 +0000 (Wed, 02 Jul 2008) New Revision: 20936 Modified: trunk/apps/pyFreenet/fcp/put.py Log: oops \r Modified: trunk/apps/pyFreenet/fcp/put.py =================================================================== --- trunk/apps/pyFreenet/fcp/put.py 2008-07-02 16:15:33 UTC (rev 20935) +++ trunk/apps/pyFreenet/fcp/put.py 2008-07-02 16:35:48 UTC (rev 20936) @@ -59,12 +59,12 @@ print " The mimetype under which to insert the key. If not given, then" print " an attempt will be made to guess it from the filename. If no" print " filename is given, or if this attempt fails, the mimetype" - print " 'text/plain' will be used as a fallback" - print " -c, --compress" - print " Enable compression of inserted data (default is no compression)" - print " -d, --disk" - print " Try to have the node access file on disk directly , it will try then a fallback is provided" - print " nb:give the path relative to node filesystem not from where you're running this program" + print " 'text/plain' will be used as a fallback" + print " -c, --compress" + print " Enable compression of inserted data (default is no compression)" + print " -d, --disk" + print " Try to have the node access file on disk directly , it will try then a fallback is provided" + print " nb:give the path relative to node filesystem not from where you're running this program" print " -p, --persistence=" print " Set the persistence type, one of 'connection', 'reboot' or 'forever'" print " -g, --global" @@ -121,20 +121,20 @@ sys.exit(2) output = None verbose = False - #print cmdopts - - makeDDARequest=False - opts['nocompress'] = True + #print cmdopts + makeDDARequest=False + opts['nocompress'] = True + for o, a in cmdopts: if o in ("-V", "--version"): print "This is %s, version %s" % (progname, node.fcpVersion) - sys.exit(0) - + sys.exit(0) + elif o in ("-?", "-h", "--help"): help() - sys.exit(0) - + sys.exit(0) + elif o in ("-v", "--verbosity"): if verbosity < node.DETAIL: verbosity = node.DETAIL @@ -145,7 +145,7 @@ elif o in ("-H", "--fcpHost"): fcpHost = a - + elif o in ("-P", "--fcpPort"): try: fcpPort = int(a) @@ -153,15 +153,15 @@ usage("Invalid fcpPort argument %s" % repr(a)) elif o in ("-m", "--mimetype"): - mimetype = a - - elif o in ("-c", "--compress"): - opts['nocompress'] = False - - elif o in ("-d","--disk"): - makeDDARequest=True - - + mimetype = a + + elif o in ("-c", "--compress"): + opts['nocompress'] = False + + elif o in ("-d","--disk"): + makeDDARequest=True + + elif o in ("-p", "--persistence"): if a not in ("connection", "reboot", "forever"): usage("Persistence must be one of 'connection', 'reboot', 'forever'") @@ -190,11 +190,11 @@ usage("Invalid timeout '%s'" % a) opts['timeout'] = timeout - # process args + # process args nargs = len(args) if nargs < 1 or nargs > 2: usage("Invalid number of arguments") - + uri = args[0] if not uri.startswith("freenet:"): uri = "freenet:" + uri @@ -227,42 +227,42 @@ traceback.print_exc(file=sys.stderr) usage("Failed to connect to FCP service at %s:%s" % (fcpHost, fcpPort)) - - TestDDARequest=False - - if makeDDARequest: - if infile is not None: - ddareq=dict() - ddafile = os.path.abspath(infile) - - ddareq["Directory"]= os.path.dirname(ddafile) - ddareq["WantReadDirectory"]="True" - ddareq["WantWriteDirectory"]="false" - print "Absolute filepath used for node direct disk access :",ddareq["Directory"] - print "File to insert :",os.path.basename( ddafile ) - TestDDARequest=n.testDDA(**ddareq) - print "Result of dda request :",TestDDARequest - - if TestDDARequest: - opts["file"]=ddafile - uri = n.put(uri,**opts) - else: - sys.stderr.write("%s: disk access failed to insert file %s fallback to direct\n" % (progname,ddafile) ) - else: - sys.stderr.write("%s: disk access need a disk filename\n" % progname ) - # try to insert the key using "direct" way if dda has failed - if not TestDDARequest: + TestDDARequest=False + + if makeDDARequest: + if infile is not None: + ddareq=dict() + ddafile = os.path.abspath(infile) + + ddareq["Directory"]= os.path.dirname(ddafile) + ddareq["WantReadDirectory"]="True" + ddareq["WantWriteDirectory"]="false" + print "Absolute filepath used for node direct disk access :",ddareq["Directory"] + print "File to insert :",os.path.basename( ddafile ) + TestDDARequest=n.testDDA(**ddareq) + print "Result of dda request :",TestDDARequest + + if TestDDARequest: + opts["file"]=ddafile + uri = n.put(uri,**opts) + else: + sys.stderr.write("%s: disk access failed to insert file %s fallback to direct\n" % (progname,ddafile) ) + else: + sys.stderr.write("%s: disk access need a disk filename\n" % progname ) + + # try to insert the key using "direct" way if dda has failed + if not TestDDARequest: # grab the data if not infile: data = sys.stdin.read() else: try: - data = file(infile, "rb").read() + data = file(infile, "rb").read() except: n.shutdown() usage("Failed to read input from file %s" % repr(infile)) - + try: #print "opts=%s" % str(opts) uri = n.put(uri, data=data, **opts) @@ -272,7 +272,7 @@ n.shutdown() sys.stderr.write("%s: Failed to insert key %s\n" % (progname, repr(uri))) sys.exit(1) - + if nowait: # got back a job ticket, wait till it has been sent uri.waitTillReqSent() From saces at freenetproject.org Wed Jul 30 19:09:11 2008 From: saces at freenetproject.org (saces at freenetproject.org) Date: Wed, 30 Jul 2008 19:09:11 +0000 (UTC) Subject: [Pyfreenet] r21504 - trunk/apps/pyFreenetHg Message-ID: <20080730190911.1F677478B50@freenetproject.org> Author: saces Date: 2008-07-30 19:09:10 +0000 (Wed, 30 Jul 2008) New Revision: 21504 Modified: trunk/apps/pyFreenetHg/ReadMe.html Log: fix a typo Modified: trunk/apps/pyFreenetHg/ReadMe.html =================================================================== --- trunk/apps/pyFreenetHg/ReadMe.html 2008-07-30 18:49:24 UTC (rev 21503) +++ trunk/apps/pyFreenetHg/ReadMe.html 2008-07-30 19:09:10 UTC (rev 21504) @@ -40,7 +40,7 @@

 [extensions]
-hgk=/path/to/FreenetHg.py
+freenethg=/path/to/FreenetHg.py
 
 [freenethg]
 config=/path/to/config.file



From saces at freenetproject.org  Wed Jul 30 22:45:29 2008
From: saces at freenetproject.org (saces at freenetproject.org)
Date: Wed, 30 Jul 2008 22:45:29 +0000 (UTC)
Subject: [Pyfreenet] r21514 - trunk/apps/pyFreenetHg
Message-ID: <20080730224529.C01014797B7@freenetproject.org>

Author: saces
Date: 2008-07-30 22:45:29 +0000 (Wed, 30 Jul 2008)
New Revision: 21514

Modified:
   trunk/apps/pyFreenetHg/INSTALL
   trunk/apps/pyFreenetHg/ReadMe.html
Log:
update doc

Modified: trunk/apps/pyFreenetHg/INSTALL
===================================================================
--- trunk/apps/pyFreenetHg/INSTALL	2008-07-30 22:30:58 UTC (rev 21513)
+++ trunk/apps/pyFreenetHg/INSTALL	2008-07-30 22:45:29 UTC (rev 21514)
@@ -17,22 +17,21 @@
 [extensions]
 freenethg=/path/to/FreenetHg.py
 
-[freenethg]
-config=/path/to/config.file
+now run "hg help", it should show you new fcp-* commands.
 
----
+type "hg help commandname" for further details
 
-the config file must exist, but can be emty (0 Bytes)
-if its read only, you need to add the keys for the updater by yourself:
+more about plugin install: http://www.selenic.com/mercurial/wiki/index.cgi/UsingExtensions
 
-[/path/to/repo]
-inserturi=USK at bar
-requesturi=USK at foo
 
----
+Hook configuration:
 
-now run "hg help", it should show you new fcp-* commands.
+add the following to your /.hg/hgrc:
 
-type "hg help commandname" for further details
+[hooks]
+precommit = python:freenethg.updatestatic_hook
 
-more about plugin install: http://www.selenic.com/mercurial/wiki/index.cgi/UsingExtensions
\ No newline at end of file
+[freenethg]
+inserturi = USK at insertiru/1/name
+
+

Modified: trunk/apps/pyFreenetHg/ReadMe.html
===================================================================
--- trunk/apps/pyFreenetHg/ReadMe.html	2008-07-30 22:30:58 UTC (rev 21513)
+++ trunk/apps/pyFreenetHg/ReadMe.html	2008-07-30 22:45:29 UTC (rev 21514)
@@ -34,36 +34,26 @@
 

hg clone|pull static-http://127.0.0.1:8888/USK at fQGiK~CfI8zO4cuNyhPRLqYZ5TyGUme8lMiRnS9TCaU,E3S1MLoeeeEM45fDLdVV~n8PCr9pt6GMq0tuH4dRP7c,AQACAAE/freenethg/1/ /tmp/your/local/path

install

read install instructions

-

download FreenetHg.py and put it somewhere.
add the following to your ~/.hgrc:

 [extensions]
 freenethg=/path/to/FreenetHg.py
-
-[freenethg]
-config=/path/to/config.file
 
-

config

-

the configfile is needed if you want to make your repository accessible via static-http

-

the config file have the following syntax:

-
-[/path/to/repos]
-InsertURI=USK at foo/projectname/1
-RequestURI=USK at bar/projectname/1
-
-

adding hook for auto update (hgrc):

+

adding hook for auto update (./hg/hgrc):

 [hooks]
-incoming = python:FreenetHq.updatestatic_hook
-commit = python:FreenetHq.updatestatic_hook
+commit = python:freenethg.updatestatic_hook
+
+[freenethg]
+inserturi = USK at foo,bar/1/Name
 
-

eclipse

+ From saces at freenetproject.org Thu Jul 31 13:30:53 2008 From: saces at freenetproject.org (saces at freenetproject.org) Date: Thu, 31 Jul 2008 13:30:53 +0000 (UTC) Subject: [Pyfreenet] r21537 - trunk/apps/pyFreenetHg Message-ID: <20080731133053.38F84478A36@freenetproject.org> Author: saces Date: 2008-07-31 13:30:52 +0000 (Thu, 31 Jul 2008) New Revision: 21537 Modified: trunk/apps/pyFreenetHg/INSTALL trunk/apps/pyFreenetHg/ReadMe.html Log: update doc Modified: trunk/apps/pyFreenetHg/INSTALL =================================================================== --- trunk/apps/pyFreenetHg/INSTALL 2008-07-31 13:17:54 UTC (rev 21536) +++ trunk/apps/pyFreenetHg/INSTALL 2008-07-31 13:30:52 UTC (rev 21537) @@ -32,6 +32,7 @@ precommit = python:freenethg.updatestatic_hook [freenethg] -inserturi = USK at insertiru/1/name +inserturi = USK at inserturi/Name/1 +fcphost = 127.0.0.1 +fcpport = 9481 - Modified: trunk/apps/pyFreenetHg/ReadMe.html =================================================================== --- trunk/apps/pyFreenetHg/ReadMe.html 2008-07-31 13:17:54 UTC (rev 21536) +++ trunk/apps/pyFreenetHg/ReadMe.html 2008-07-31 13:30:52 UTC (rev 21537) @@ -48,7 +48,10 @@ commit = python:freenethg.updatestatic_hook [freenethg] -inserturi = USK at foo,bar/1/Name +inserturi = USK at foo,bar/Name/1 +fcphost = 127.0.0.1 +fcpport = 9481 +