# HG changeset patch # User Pierre-Yves David # Date 2022-11-30 10:12:48 # Node ID 229e0ed88895f076d172af8eb9498970a322b944 # Parent d9791643aab78c962e92357ab6f25f85dd819637 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. diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -299,8 +299,13 @@ def share( ): '''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)