(Steve Dougherty)
2013-08-30: Add --truster support to built-in commands. Add --truster support to built-in commands. Truster is only relevant to pull URIs.
diff --git a/.bugs/bugs b/.bugs/bugs
--- a/.bugs/bugs
+++ b/.bugs/bugs
@@ -9,7 +9,7 @@ Preserve non-Infocalypse repositories in
set the timezone to UTC on cloning a freenet repo to avoid timezone-based attacks. | owner:Arne Babenhauserheide <bab@draketo.de>, open:True, id:4dfc4cc28a7fa69f040776a7138da78ee89ec819, time:1355764180.36
mime-type problems | owner:Arne Babenhauserheide <bab@draketo.de>, open:False, id:5916e6e8328e20d8b0276b76b7116dd432730778, time:1353463866.97
| owner:, open:False, id:65d8d544370f80538e325dae0b6c2da449c5bcfe, time:1373407147.03
-Add --truster support to built-in commands. | owner:Steve Dougherty <steve@asksteved.com>, open:True, id:673a3103a58988552e0ef0b0ab20e8c75c9f6b1f, time:1375736861.8
+Add --truster support to built-in commands. | owner:Steve Dougherty <steve@asksteved.com>, open:False, id:673a3103a58988552e0ef0b0ab20e8c75c9f6b1f, time:1375736861.8
Add i18n support for messages. | owner:, open:True, id:7760991aef41c6d38be5315f742f6a6f350a0a76, time:1375010635.52
Fix implied clone destination when cloning from freenet:. | owner:Steve Dougherty <steve@asksteved.com>, open:False, id:9bd3ef617ba8871d28fbdae2500542e93302c791, time:1375736289.27
Unit tests involving the node are hard. | owner:Steve Dougherty <steve@asksteved.com>, open:True, id:b01a53e59a2096254ecacdcee7673df5323d786e, time:1375737309.25
diff --git a/infocalypse/__init__.py b/infocalypse/__init__.py
--- a/infocalypse/__init__.py
+++ b/infocalypse/__init__.py
@@ -568,7 +568,7 @@ extensions.wrapfunction(discovery, 'find
# wrap the commands
-def freenetpathtouri(ui, path, operation, repo=None):
+def freenetpathtouri(ui, path, operation, repo=None, truster_identifier=None):
"""
Return a usable request or insert URI. Expects a freenet:// or freenet:
protocol to be specified.
@@ -586,6 +586,8 @@ def freenetpathtouri(ui, path, operation
* "clone-push" - insert URI for repository that might
not exist. (Skips looking up
published name and edition.)
+ :param truster_identifier: An override string identifier for a truster
+ specified on the command line.
"""
# TODO: Is this the only URL encoding that may happen? Why not use a more
# semantically meaningful function?
@@ -600,7 +602,7 @@ def freenetpathtouri(ui, path, operation
if not path.startswith("USK"):
import wot
if operation == "pull":
- truster = get_truster(ui, repo)
+ truster = get_truster(ui, repo, truster_identifier)
return wot.resolve_pull_uri(ui, path, truster)
elif operation == "push":
return wot.resolve_push_uri(ui, path)
@@ -630,7 +632,7 @@ def freenetpull(orig, *args, **opts):
# only act differently, if the target is an infocalypse repo.
if not isfreenetpath(path):
return orig(*args, **opts)
- uri = freenetpathtouri(ui, path, "pull", repo)
+ uri = freenetpathtouri(ui, path, "pull", repo, opts.get('truster'))
opts["uri"] = uri
opts["aggressive"] = True # always search for the latest revision.
return infocalypse_pull(ui, repo, **opts)
@@ -729,7 +731,8 @@ def freenetclone(orig, *args, **opts):
# check whether to create, pull or copy
pulluri, pushuri = None, None
if isfreenetpath(source):
- pulluri = parse_repo_path(freenetpathtouri(ui, source, "pull"))
+ pulluri = parse_repo_path(
+ freenetpathtouri(ui, source, "pull", None, opts.get('truster')))
if isfreenetpath(dest):
pushuri = parse_repo_path(freenetpathtouri(ui, dest, "clone-push"),