##// END OF EJS Templates
narrow: use repo.local() instead of isinstance()...
Martin von Zweigbergk -
r37203:6d43b39f default
parent child Browse files
Show More
@@ -1,97 +1,97 b''
1 1 # __init__.py - narrowhg extension
2 2 #
3 3 # Copyright 2017 Google, Inc.
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7 '''create clones which fetch history data for subset of files (EXPERIMENTAL)'''
8 8
9 9 from __future__ import absolute_import
10 10
11 11 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
12 12 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
13 13 # be specifying the version(s) of Mercurial they are tested with, or
14 14 # leave the attribute unspecified.
15 15 testedwith = 'ships-with-hg-core'
16 16
17 17 from mercurial import (
18 18 changegroup,
19 19 extensions,
20 20 hg,
21 21 localrepo,
22 22 registrar,
23 23 verify as verifymod,
24 24 )
25 25
26 26 from . import (
27 27 narrowbundle2,
28 28 narrowchangegroup,
29 29 narrowcommands,
30 30 narrowcopies,
31 31 narrowdirstate,
32 32 narrowmerge,
33 33 narrowpatch,
34 34 narrowrepo,
35 35 narrowrevlog,
36 36 narrowtemplates,
37 37 narrowwirepeer,
38 38 )
39 39
40 40 configtable = {}
41 41 configitem = registrar.configitem(configtable)
42 42 # Narrowhg *has* support for serving ellipsis nodes (which are used at
43 43 # least by Google's internal server), but that support is pretty
44 44 # fragile and has a lot of problems on real-world repositories that
45 45 # have complex graph topologies. This could probably be corrected, but
46 46 # absent someone needing the full support for ellipsis nodes in
47 47 # repositories with merges, it's unlikely this work will get done. As
48 48 # of this writining in late 2017, all repositories large enough for
49 49 # ellipsis nodes to be a hard requirement also enforce strictly linear
50 50 # history for other scaling reasons.
51 51 configitem('experimental', 'narrowservebrokenellipses',
52 52 default=False,
53 53 alias=[('narrow', 'serveellipses')],
54 54 )
55 55
56 56 # Export the commands table for Mercurial to see.
57 57 cmdtable = narrowcommands.table
58 58
59 59 def featuresetup(ui, features):
60 60 features.add(changegroup.NARROW_REQUIREMENT)
61 61
62 62 def uisetup(ui):
63 63 """Wraps user-facing mercurial commands with narrow-aware versions."""
64 64 localrepo.featuresetupfuncs.add(featuresetup)
65 65 narrowrevlog.setup()
66 66 narrowbundle2.setup()
67 67 narrowmerge.setup()
68 68 narrowcommands.setup()
69 69 narrowchangegroup.setup()
70 70 narrowwirepeer.uisetup()
71 71
72 72 def reposetup(ui, repo):
73 73 """Wraps local repositories with narrow repo support."""
74 if not isinstance(repo, localrepo.localrepository):
74 if not repo.local():
75 75 return
76 76
77 77 narrowrepo.wraprepo(repo)
78 78 if changegroup.NARROW_REQUIREMENT in repo.requirements:
79 79 narrowcopies.setup(repo)
80 80 narrowdirstate.setup(repo)
81 81 narrowpatch.setup(repo)
82 82 narrowwirepeer.reposetup(repo)
83 83
84 84 def _verifierinit(orig, self, repo, matcher=None):
85 85 # The verifier's matcher argument was desgined for narrowhg, so it should
86 86 # be None from core. If another extension passes a matcher (unlikely),
87 87 # we'll have to fail until matchers can be composed more easily.
88 88 assert matcher is None
89 89 orig(self, repo, repo.narrowmatch())
90 90
91 91 def extsetup(ui):
92 92 extensions.wrapfunction(verifymod.verifier, '__init__', _verifierinit)
93 93 extensions.wrapfunction(hg, 'postshare', narrowrepo.wrappostshare)
94 94 extensions.wrapfunction(hg, 'copystore', narrowrepo.unsharenarrowspec)
95 95
96 96 templatekeyword = narrowtemplates.templatekeyword
97 97 revsetpredicate = narrowtemplates.revsetpredicate
General Comments 0
You need to be logged in to leave comments. Login now