M infocalypse/__init__.py +6 -2
@@ 349,7 349,11 @@ from .keys import strip_protocol, parse_
_freenetschemes = ('freenet', ) # TODO: add fn
for _scheme in _freenetschemes:
- hg.schemes[_scheme] = freenetrepo
+ # added in Mercurial 6.4
+ if hasattr(hg, 'repo_schemes') and hasattr(hg, 'peer_schemes'):
+ hg.peer_schemes[_scheme] = freenetrepo
+ else:
+ hg.schemes[_scheme] = freenetrepo
#----------------------------------------------------------"
@@ 595,7 599,7 @@ def findcommonoutgoing(orig, *args, **op
else:
return orig(*args, **opts)
# really wrap the functions
-extensions.wrapfunction(discovery, b'findcommonoutgoing', findcommonoutgoing)
+extensions.wrapfunction(discovery, 'findcommonoutgoing', findcommonoutgoing)
# wrap the commands
M infocalypse/bundlecache.py +3 -2
@@ 128,7 128,7 @@ class BundleCache:
cached = self.get_cached_bundle(index_pair, out_file)
if not cached is None:
- #print "make_bundle -- cache hit: ", index_pair
+ # print("make_bundle -- cache hit: ", index_pair)
return cached
delete_out_file = out_file is None
@@ 148,7 148,8 @@ class BundleCache:
#print 'HEADS:', list(heads)
commands.bundle(self.ui_, self.repo, out_file,
base=list(parents),
- rev=list(heads))
+ rev=list(heads),
+ type=b"zstd-v2") # use bundle v2 format: support more caching and bookmarks
finally:
self.ui_.popbuffer()
M infocalypse/chk.py +2 -1
@@ 56,7 56,8 @@ def chk_to_bytes(chk):
assert chk.startswith(b'CHK@')
# NO / or filename allowed.
- assert len(chk) == ENCODED_CHK_SIZE
+ # accept padding
+ assert len(chk) == ENCODED_CHK_SIZE + chk.count(b'=')
fields = chk[4:].split(b',')
assert len(fields) == 3
M infocalypse/commands.py +8 -12
@@ 106,9 106,9 @@ def infocalypse_create(ui_, repo, local_
new_name = USK(insert_uri).get_repo_name()
if new_name in names:
- replace = ui_.prompt(b"A repository with the name '{0}' is already"
- b" published by {1}. Replace it? [y/N]"
- .format(new_name.decode("utf-8"), local_identity).encode("utf-8"),
+ replace = ui_.prompt((b"A repository with the name '%b' is already"
+ b" published by %b. Replace it? [y/N]")
+ % (new_name, local_identity),
default='n')
if not replace.lower() in ['y', b'y']:
@@ 201,15 201,11 @@ def infocalypse_reinsert(ui_, repo, **op
option levels:
-1: Re-insert top key(s) and graph(s).
-
-2: Re-insert top key(s) if possible, graph(s), latest update.
-
-3: Re-insert top key(s) if possible, graph(s), all bootstrap CHKs.
-
-4: Insert redundant keys for > 7Mb updates.
-
-5: Re-insert redundant updates > 7Mb.
+- 1: Re-insert top key(s) and graph(s).
+- 2: Re-insert top key(s) if possible, graph(s), latest update.
+- 3: Re-insert top key(s) if possible, graph(s), all bootstrap CHKs.
+- 4: Insert redundant keys for > 7Mb updates.
+- 5: Re-insert redundant updates > 7Mb.
Levels 1 and 4 require the private key.
"""
M infocalypse/fcpconnection.py +2 -1
@@ 175,7 175,7 @@ class NonBlockingSocket(IAsyncSocket):
if self.buffer:
chunk = self.buffer[:SEND_BLOCK]
sent = self.socket.send(chunk)
- #print "WRITING:", self.buffer[:sent]
+ # print("WRITING:", self.buffer[:sent])
assert sent >= 0
#print "TO_WIRE:"
#print repr(self.buffer[:sent])
@@ 532,6 532,7 @@ class FCPConnection:
assert not client.response
assert not b'Identifier' in client.in_params.fcp_params
assert not 'Identifier' in client.in_params.fcp_params
+ # print(client.in_params.fcp_params)
client.in_params.fcp_params = self.convert_params_keys_to_bytes(client.in_params.fcp_params)
identifier = make_id()
client.in_params.fcp_params[b'Identifier'] = identifier
M infocalypse/freenetrepo.py +2 -2
@@ 8,7 8,7 @@
# This software may be used and distributed according to the terms
# of the GNU General Public License, incorporated herein by reference.
-from mercurial import util
+from mercurial import util, error
try:
from mercurial.peer import peerrepository
except ImportError:
@@ 27,7 27,7 @@ class freenetrepo(peerrepository):
def __init__(self, ui, path, create):
if create: # pragma: no cover
- raise util.Abort('Cannot create a freenet repository, yet.')
+ raise error.Abort('Cannot create a freenet repository, yet.')
self.ui = ui
# if "/" in path and "#" in path.split("/")[-1]:
# path = "/".join(path.split("/")[:-1] +
M infocalypse/requestingbundles.py +3 -3
@@ 386,13 386,13 @@ class RequestingBundles(RetryingRequestL
assert not self.top_key_tuple is None
if self.parent.params.get('DUMP_TOP_KEY', False):
- text = "Fixed up top key CHKs:\n"
+ text = b"Fixed up top key CHKs:\n"
for update in self.top_key_tuple[1]:
for chk in update[3]:
if chk in edges:
- text += " " + str(edges[chk]) + ":" + chk + "\n"
+ text += b" " + edges[chk] + b":" + chk + b"\n"
else:
- text += " BAD TOP KEY DATA!" + ":" + chk + "\n"
+ text += b" BAD TOP KEY DATA!" + b":" + chk + b"\n"
self.parent.ctx.ui_.status(text)
all_heads = get_heads(graph)