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/chk.py +3 -2
@@ 56,8 56,9 @@ def chk_to_bytes(chk):
assert chk.startswith(b'CHK@')
# NO / or filename allowed.
- print(chk, len(chk))
- assert len(chk) == ENCODED_CHK_SIZE
+ print(chk.decode('utf-8'), len(chk))
+ # accept padding
+ assert len(chk) == ENCODED_CHK_SIZE + chk.count(b'=')
fields = chk[4:].split(b',')
assert len(fields) == 3
M infocalypse/commands.py +3 -3
@@ 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']:
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)