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