Show More
@@ -1,78 +1,78 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 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
|
12 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
|
13 | # be specifying the version(s) of Mercurial they are tested with, or | |
|
14 | # leave the attribute unspecified. | |
|
15 | testedwith = b'ships-with-hg-core' | |
|
16 | ||
|
17 | 11 | from mercurial import ( |
|
18 | 12 | localrepo, |
|
19 | 13 | registrar, |
|
20 | 14 | ) |
|
21 | 15 | |
|
22 | 16 | from mercurial.interfaces import repository |
|
23 | 17 | |
|
24 | 18 | from . import ( |
|
25 | 19 | narrowbundle2, |
|
26 | 20 | narrowcommands, |
|
27 | 21 | narrowrepo, |
|
28 | 22 | narrowtemplates, |
|
29 | 23 | narrowwirepeer, |
|
30 | 24 | ) |
|
31 | 25 | |
|
26 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
|
27 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
|
28 | # be specifying the version(s) of Mercurial they are tested with, or | |
|
29 | # leave the attribute unspecified. | |
|
30 | testedwith = b'ships-with-hg-core' | |
|
31 | ||
|
32 | 32 | configtable = {} |
|
33 | 33 | configitem = registrar.configitem(configtable) |
|
34 | 34 | # Narrowhg *has* support for serving ellipsis nodes (which are used at |
|
35 | 35 | # least by Google's internal server), but that support is pretty |
|
36 | 36 | # fragile and has a lot of problems on real-world repositories that |
|
37 | 37 | # have complex graph topologies. This could probably be corrected, but |
|
38 | 38 | # absent someone needing the full support for ellipsis nodes in |
|
39 | 39 | # repositories with merges, it's unlikely this work will get done. As |
|
40 | 40 | # of this writining in late 2017, all repositories large enough for |
|
41 | 41 | # ellipsis nodes to be a hard requirement also enforce strictly linear |
|
42 | 42 | # history for other scaling reasons. |
|
43 | 43 | configitem( |
|
44 | 44 | b'experimental', |
|
45 | 45 | b'narrowservebrokenellipses', |
|
46 | 46 | default=False, |
|
47 | 47 | alias=[(b'narrow', b'serveellipses')], |
|
48 | 48 | ) |
|
49 | 49 | |
|
50 | 50 | # Export the commands table for Mercurial to see. |
|
51 | 51 | cmdtable = narrowcommands.table |
|
52 | 52 | |
|
53 | 53 | |
|
54 | 54 | def featuresetup(ui, features): |
|
55 | 55 | features.add(repository.NARROW_REQUIREMENT) |
|
56 | 56 | |
|
57 | 57 | |
|
58 | 58 | def uisetup(ui): |
|
59 | 59 | """Wraps user-facing mercurial commands with narrow-aware versions.""" |
|
60 | 60 | localrepo.featuresetupfuncs.add(featuresetup) |
|
61 | 61 | narrowbundle2.setup() |
|
62 | 62 | narrowcommands.setup() |
|
63 | 63 | narrowwirepeer.uisetup() |
|
64 | 64 | |
|
65 | 65 | |
|
66 | 66 | def reposetup(ui, repo): |
|
67 | 67 | """Wraps local repositories with narrow repo support.""" |
|
68 | 68 | if not repo.local(): |
|
69 | 69 | return |
|
70 | 70 | |
|
71 | 71 | repo.ui.setconfig(b'experimental', b'narrow', True, b'narrow-ext') |
|
72 | 72 | if repository.NARROW_REQUIREMENT in repo.requirements: |
|
73 | 73 | narrowrepo.wraprepo(repo) |
|
74 | 74 | narrowwirepeer.reposetup(repo) |
|
75 | 75 | |
|
76 | 76 | |
|
77 | 77 | templatekeyword = narrowtemplates.templatekeyword |
|
78 | 78 | revsetpredicate = narrowtemplates.revsetpredicate |
General Comments 0
You need to be logged in to leave comments.
Login now