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