mercurial/unionrepo.py
changeset 51870 1b17309cdaab
parent 51859 f4733654f144
child 51871 8315175f678d
equal deleted inserted replaced
51869:0afd58c72175 51870:1b17309cdaab
    12 """
    12 """
    13 
    13 
    14 from __future__ import annotations
    14 from __future__ import annotations
    15 
    15 
    16 import contextlib
    16 import contextlib
    17 
    17 import typing
    18 
    18 
    19 from .i18n import _
    19 from .i18n import _
    20 
    20 
    21 from . import (
    21 from . import (
    22     changelog,
    22     changelog,
   245 class unionpeer(localrepo.localpeer):
   245 class unionpeer(localrepo.localpeer):
   246     def canpush(self):
   246     def canpush(self):
   247         return False
   247         return False
   248 
   248 
   249 
   249 
   250 class unionrepository:
   250 _union_repo_baseclass = object
       
   251 
       
   252 if typing.TYPE_CHECKING:
       
   253     _union_repo_baseclass = localrepo.localrepository
       
   254 
       
   255 
       
   256 class unionrepository(_union_repo_baseclass):
   251     """Represents the union of data in 2 repositories.
   257     """Represents the union of data in 2 repositories.
   252 
   258 
   253     Instances are not usable if constructed directly. Use ``instance()``
   259     Instances are not usable if constructed directly. Use ``instance()``
   254     or ``makeunionrepository()`` to create a usable instance.
   260     or ``makeunionrepository()`` to create a usable instance.
   255     """
   261     """
   256 
   262 
       
   263     # noinspection PyMissingConstructor
   257     def __init__(self, repo2, url):
   264     def __init__(self, repo2, url):
   258         self.repo2 = repo2
   265         self.repo2 = repo2
   259         self._url = url
   266         self._url = url
   260 
   267 
   261         self.ui.setconfig(b'phases', b'publish', False, b'unionrepo')
   268         self.ui.setconfig(b'phases', b'publish', False, b'unionrepo')