# HG changeset patch # User Pierre-Yves David # Date 2023-05-26 14:55:52 # Node ID e6948aafda6f730a668ad1eb0ed6a8173da0f6db # Parent 9db197c731383d36fdfdb2f041d67710566d3a87 clonebundles: move the manifest reading in a dedicated function We are about to make the logic more advanced to help hosting solution, so we need to centralize it first. diff --git a/mercurial/bundlecaches.py b/mercurial/bundlecaches.py --- a/mercurial/bundlecaches.py +++ b/mercurial/bundlecaches.py @@ -25,6 +25,9 @@ urlreq = util.urlreq CB_MANIFEST_FILE = b'clonebundles.manifest' +def get_manifest(repo): + return repo.vfs.tryread(CB_MANIFEST_FILE) + @attr.s class bundlespec: diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -349,7 +349,7 @@ class localpeer(repository.peer): return self._caps def clonebundles(self): - return self._repo.tryread(bundlecaches.CB_MANIFEST_FILE) + return bundlecaches.get_manifest(self._repo) def debugwireargs(self, one, two, three=None, four=None, five=None): """Used to test argument passing over the wire""" diff --git a/mercurial/wireprotov1server.py b/mercurial/wireprotov1server.py --- a/mercurial/wireprotov1server.py +++ b/mercurial/wireprotov1server.py @@ -274,9 +274,8 @@ def clonebundles(repo, proto): depending on the request. e.g. you could advertise URLs for the closest data center given the client's IP address. """ - return wireprototypes.bytesresponse( - repo.vfs.tryread(bundlecaches.CB_MANIFEST_FILE) - ) + manifest = bundlecaches.get_manifest(repo) + return wireprototypes.bytesresponse(manifest) wireprotocaps = [