(Steve Dougherty)
2013-06-20: Correct mistaken merge. Correct mistaken merge.
diff --git a/infocalypse/__init__.py b/infocalypse/__init__.py
--- a/infocalypse/__init__.py
+++ b/infocalypse/__init__.py
@@ -386,14 +386,14 @@ def infocalypse_create(ui_, repo, **opts
elif opts['uri'] != '':
insert_uri = opts['uri']
elif opts['wot'] != '':
- # Expecting nick_prefix/repo_name.R<redundancy num>/edition/
- nick_prefix, repo_desc = opts['wot'].split('/', 1)
+ # Expecting wot_id/repo_name.R<redundancy num>/edition/
+ wot_id, repo_desc = opts['wot'].split('/', 1)
import wot
ui_.status("Querying WoT for local identities.\n")
- attributes = wot.resolve_local_identity(ui_, nick_prefix)
+ attributes = wot.resolve_local_identity(ui_, wot_id)
if attributes is None:
# Something went wrong; the function already printed an error.
return
@@ -537,18 +537,7 @@ def infocalypse_pull(ui_, repo, **opts):
# TODO: How to handle redundancy? Does Infocalypse automatically try
# an R0 if an R1 fails?
- nickname_prefix = ''
- key_prefix=''
- # Could be nick@key, nick, @key
- split = wot_id.split('@')
- nickname_prefix = split[0]
-
- if len(split) == 2:
- key_prefix = split[1]
-
- repositories = wot.read_repo_listing(ui_, truster,
- nickname_prefix=nickname_prefix,
- key_prefix=key_prefix)
+ repositories = wot.read_repo_listing(ui_, truster, wot_id)
if repo_name not in repositories:
ui_.warn("Could not find repository named \"{0}\".\n".format(repo_name))
return
@@ -939,6 +928,11 @@ cmdtable = {
+ AGGRESSIVE_OPT,
"[options]"),
+ "fn-pull-request": (infocalypse_pull_request,
+ WOT_OPTS +
+ FCP_OPTS,
+ "--wot id@key/repo"),
+
"fn-push": (infocalypse_push,
[('', 'uri', '', 'insert URI to push to'),
# Buggy. Not well thought out.
@@ -1043,6 +1037,12 @@ cmdtable = {
WOT_OPTS,
"[options]"),
+ "fn-setupfreemail": (infocalypse_setupfreemail,
+ [('', 'password', '', 'Freemail password')]
+ + WOT_OPTS
+ + FCP_OPTS,
+ "[--truster nick@key] --password <password>"),
+
"fn-archive": (infocalypse_archive,
[('', 'uri', '', 'Request URI for --pull, Insert URI ' +
'for --create, --push'),
@@ -1066,6 +1066,7 @@ commands.norepo += ' fn-setupfms'
commands.norepo += ' fn-genkey'
commands.norepo += ' fn-archive'
commands.norepo += ' fn-setupwot'
+commands.norepo += ' fn-setupfreemail'
## Wrap core commands for use with freenet keys.
diff --git a/infocalypse/commands.py b/infocalypse/commands.py
--- a/infocalypse/commands.py
+++ b/infocalypse/commands.py
@@ -13,7 +13,7 @@ from wikicmds import execute_wiki, execu
from arccmds import execute_arc_create, execute_arc_pull, execute_arc_push, \
execute_arc_reinsert
-from config import read_freesite_cfg
+from config import read_freesite_cfg, Config
from validate import is_hex_string, is_fms_id
def set_target_version(ui_, repo, opts, params, msg_fmt):
@@ -195,18 +195,7 @@ def infocalypse_pull(ui_, repo, **opts):
# TODO: How to handle redundancy? Does Infocalypse automatically try
# an R0 if an R1 fails?
- nickname_prefix = ''
- key_prefix=''
- # Could be nick@key, nick, @key
- split = wot_id.split('@')
- nickname_prefix = split[0]
-
- if len(split) == 2:
- key_prefix = split[1]
-
- repositories = wot.read_repo_listing(ui_, truster,
- nickname_prefix=nickname_prefix,
- key_prefix=key_prefix)
+ repositories = wot.read_repo_listing(ui_, truster, wot_id)
if repo_name not in repositories:
ui_.warn("Could not find repository named \"{0}\".\n".format(repo_name))
return
@@ -226,6 +215,11 @@ def infocalypse_pull(ui_, repo, **opts):
# Hmmmm... can't really implement rev.
execute_pull(ui_, repo, params, stored_cfg)
+def infocalypse_pull_request(ui, repo, **opts):
+ if not opts['wot']:
+ ui.warning("Who do you want to send the pull request to? Set --wot.")
+ return
+
def infocalypse_push(ui_, repo, **opts):
""" Push to an Infocalypse repository in Freenet. """
params, stored_cfg = get_config_info(ui_, opts)
@@ -469,6 +463,21 @@ def infocalypse_setupwot(ui_, **opts):
wot.execute_setup_wot(ui_, opts)
+# TODO: Should Freemail setup also be part of fn-setup?
+# TODO: Should there be per-Identity config? Then each one would have a list
+# of repos and optionally a Freemail password.
+# Nah, FMS config is global.
+def infocalypse_setupfreemail(ui, **opts):
+ if 'truster' in opts:
+ identity = opts['truster']
+ else:
+ cfg = Config().from_ui(ui)
+ identity = cfg.defaults['TRUSTER']
+ import wot
+ # TODO: Should this be part of the normal fn-setup?
+ wot.execute_setup_freemail(ui, identity)
+
+
#----------------------------------------------------------"
def do_archive_create(ui_, opts, params, stored_cfg):
""" fn-archive --create."""