share: stop using 'islocal' with repo instance
Having this level of polymorphism of the `islocal` function is weird, and we
already have a way to know if the repo is local from the object itself.
We are about to deprecate passing a non-bytes object to `islocal`, so clean this
up beforehand.
We might want to clean up this function too in the future, however this is
another adventure.
--- a/mercurial/hg.py Tue Nov 29 19:54:55 2022 +0100
+++ b/mercurial/hg.py Wed Nov 30 11:12:48 2022 +0100
@@ -299,8 +299,13 @@
):
'''create a shared repository'''
- if not islocal(source):
- raise error.Abort(_(b'can only share local repositories'))
+ not_local_msg = _(b'can only share local repositories')
+ if util.safehasattr(source, 'local'):
+ if source.local() is None:
+ raise error.Abort(not_local_msg)
+ elif not islocal(source):
+ # XXX why are we getting bytes here ?
+ raise error.Abort(not_local_msg)
if not dest:
dest = defaultdest(source)