hgext/narrow/__init__.py
changeset 43076 2372284d9457
parent 42813 268662aac075
child 43077 687b865b95ad
equal deleted inserted replaced
43075:57875cf423c9 43076:2372284d9457
    17 from mercurial import (
    17 from mercurial import (
    18     localrepo,
    18     localrepo,
    19     registrar,
    19     registrar,
    20 )
    20 )
    21 
    21 
    22 from mercurial.interfaces import (
    22 from mercurial.interfaces import repository
    23     repository,
       
    24 )
       
    25 
    23 
    26 from . import (
    24 from . import (
    27     narrowbundle2,
    25     narrowbundle2,
    28     narrowcommands,
    26     narrowcommands,
    29     narrowrepo,
    27     narrowrepo,
    40 # absent someone needing the full support for ellipsis nodes in
    38 # absent someone needing the full support for ellipsis nodes in
    41 # repositories with merges, it's unlikely this work will get done. As
    39 # repositories with merges, it's unlikely this work will get done. As
    42 # of this writining in late 2017, all repositories large enough for
    40 # of this writining in late 2017, all repositories large enough for
    43 # ellipsis nodes to be a hard requirement also enforce strictly linear
    41 # ellipsis nodes to be a hard requirement also enforce strictly linear
    44 # history for other scaling reasons.
    42 # history for other scaling reasons.
    45 configitem('experimental', 'narrowservebrokenellipses',
    43 configitem(
    46            default=False,
    44     'experimental',
    47            alias=[('narrow', 'serveellipses')],
    45     'narrowservebrokenellipses',
       
    46     default=False,
       
    47     alias=[('narrow', 'serveellipses')],
    48 )
    48 )
    49 
    49 
    50 # Export the commands table for Mercurial to see.
    50 # Export the commands table for Mercurial to see.
    51 cmdtable = narrowcommands.table
    51 cmdtable = narrowcommands.table
    52 
    52 
       
    53 
    53 def featuresetup(ui, features):
    54 def featuresetup(ui, features):
    54     features.add(repository.NARROW_REQUIREMENT)
    55     features.add(repository.NARROW_REQUIREMENT)
       
    56 
    55 
    57 
    56 def uisetup(ui):
    58 def uisetup(ui):
    57     """Wraps user-facing mercurial commands with narrow-aware versions."""
    59     """Wraps user-facing mercurial commands with narrow-aware versions."""
    58     localrepo.featuresetupfuncs.add(featuresetup)
    60     localrepo.featuresetupfuncs.add(featuresetup)
    59     narrowbundle2.setup()
    61     narrowbundle2.setup()
    60     narrowcommands.setup()
    62     narrowcommands.setup()
    61     narrowwirepeer.uisetup()
    63     narrowwirepeer.uisetup()
       
    64 
    62 
    65 
    63 def reposetup(ui, repo):
    66 def reposetup(ui, repo):
    64     """Wraps local repositories with narrow repo support."""
    67     """Wraps local repositories with narrow repo support."""
    65     if not repo.local():
    68     if not repo.local():
    66         return
    69         return
    68     repo.ui.setconfig('experimental', 'narrow', True, 'narrow-ext')
    71     repo.ui.setconfig('experimental', 'narrow', True, 'narrow-ext')
    69     if repository.NARROW_REQUIREMENT in repo.requirements:
    72     if repository.NARROW_REQUIREMENT in repo.requirements:
    70         narrowrepo.wraprepo(repo)
    73         narrowrepo.wraprepo(repo)
    71         narrowwirepeer.reposetup(repo)
    74         narrowwirepeer.reposetup(repo)
    72 
    75 
       
    76 
    73 templatekeyword = narrowtemplates.templatekeyword
    77 templatekeyword = narrowtemplates.templatekeyword
    74 revsetpredicate = narrowtemplates.revsetpredicate
    78 revsetpredicate = narrowtemplates.revsetpredicate