Added support for --nosearch to fn-copy.
diff --git a/infocalypse/__init__.py b/infocalypse/__init__.py --- a/infocalypse/__init__.py +++ b/infocalypse/__init__.py @@ -175,6 +175,7 @@ def infocalypse_copy(ui_, repo, **opts): ui_.warn("There is no stored request URI for this repo.\n" "Please set one with the --requesturi option.\n") return + params['INSERT_URI'] = insert_uri params['REQUEST_URI'] = request_uri execute_copy(ui_, repo, params, stored_cfg) @@ -284,7 +285,8 @@ cmdtable = { "fn-copy": (infocalypse_copy, [('', 'requesturi', '', 'request URI to copy from'), ('', 'inserturi', '', 'insert URI to copy to'), ] - + FCP_OPTS, + + FCP_OPTS + + NOSEARCH_OPT, "[options]"), "fn-reinsert": (infocalypse_reinsert, diff --git a/infocalypse/infcmds.py b/infocalypse/infcmds.py --- a/infocalypse/infcmds.py +++ b/infocalypse/infcmds.py @@ -55,7 +55,7 @@ DEFAULT_PARAMS = { # Non-FCP stuff 'N_CONCURRENT':4, # Maximum number of concurrent FCP requests. - 'CANCEL_TIME_SECS': 5 * 60, # Bound request time. + 'CANCEL_TIME_SECS': 10 * 60, # Bound request time. 'POLL_SECS':0.25, # Time to sleep in the polling loop. } @@ -191,9 +191,18 @@ def get_config_info(ui_, opts): params['FCP_PORT'] = cfg.defaults['PORT'] params['TMP_DIR'] = cfg.defaults['TMP_DIR'] params['VERBOSITY'] = get_verbosity(ui_) - params['NO_SEARCH'] = (bool(opts.get('nosearch')) and opts.get('uri', None)) - if bool(opts.get('nosearch')) and not opts.get('uri', None): - ui_.status('--nosearch ignored because --uri was not set.\n') + params['NO_SEARCH'] = (bool(opts.get('nosearch')) and + (opts.get('uri', None) or opts.get('requesturi', None))) + + request_uri = opts.get('uri') or opts.get('requesturi') + if bool(opts.get('nosearch')) and not request_uri: + if opts.get('uri'): + arg_name = 'uri' + else: + assert opts.get('requesturi') + arg_name = 'requesturi' + + ui_.status('--nosearch ignored because --%s was not set.\n' % arg_name) params['AGGRESSIVE_SEARCH'] = (bool(opts.get('aggressive')) and not params['NO_SEARCH']) if bool(opts.get('aggressive')) and params['NO_SEARCH']: diff --git a/infocalypse/insertingbundles.py b/infocalypse/insertingbundles.py --- a/infocalypse/insertingbundles.py +++ b/infocalypse/insertingbundles.py @@ -67,6 +67,16 @@ class InsertingBundles(RequestQueueState self.parent.ctx.ui_.status("--- Initial Graph ---\n") self.parent.ctx.ui_.status(graph_to_string(graph) +'\n') + latest_rev = graph.index_table[graph.latest_index][1] + self.parent.ctx.ui_.warn("Latest version in Freenet: %s\n" + % latest_rev[:12]) + if not self.parent.ctx.has_version(latest_rev): + self.parent.ctx.ui_.warn("The latest version in Freenet isn't in " + "the local repository.\n" + "Try doing an fn-pull to update.\n") + self.parent.transition(FAILING) # Hmmm... hard coded state name + return + # Update graph. try: self.set_new_edges(graph) @@ -160,8 +170,11 @@ class InsertingBundles(RequestQueueState if self.parent.ctx.get('REINSERT', 0) > 0: self.parent.ctx.ui_.warn("Couldn't create an identical " + "bundle to re-insert.\n" - + "Maybe the repository was inserted " - + "with a different version of hg?\n") + + "Possible causes:\n" + + "0) Changes been locally commited " + + "but not fn-push'd yet.\n" + + "1) The repository was inserted " + + "with a different version of hg.\n") self.parent.transition(FAILING) else: # Dunno what's going on. @@ -211,10 +224,7 @@ class InsertingBundles(RequestQueueState self.parent.ctx.ui_.status("Bad CHK: %s %s\n" % (str(edge), chk1)) self.parent.ctx.ui_.warn("CHK for reinserted edge doesn't " - + "match!\n" - + "Maybe the repository was " - + "inserted with a different " - + "version of hg?\n") + + "match!\n") self.parent.transition(FAILING) else: