author | Pulkit Goyal <pulkit@yandex-team.ru> |
Sun, 30 Sep 2018 03:42:35 +0530 | |
changeset 39933 | d5498db5f86a |
parent 39766 | 9358f5066811 |
child 39934 | a24f4638d6c1 |
permissions | -rw-r--r-- |
36079
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1 |
# narrowrepo.py - repository which supports narrow revlogs, lazy loading |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
2 |
# |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
3 |
# Copyright 2017 Google, Inc. |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
4 |
# |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
5 |
# This software may be used and distributed according to the terms of the |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
6 |
# GNU General Public License version 2 or any later version. |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
7 |
|
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
8 |
from __future__ import absolute_import |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
9 |
|
39933
d5498db5f86a
narrow: move the wireprotocol narrow capability name to core
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39766
diff
changeset
|
10 |
from mercurial import ( |
d5498db5f86a
narrow: move the wireprotocol narrow capability name to core
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39766
diff
changeset
|
11 |
wireprotoserver, |
d5498db5f86a
narrow: move the wireprotocol narrow capability name to core
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39766
diff
changeset
|
12 |
) |
d5498db5f86a
narrow: move the wireprotocol narrow capability name to core
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39766
diff
changeset
|
13 |
|
36079
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
14 |
from . import ( |
38128
1cba497491be
narrow: only wrap dirstate functions once, instead of per-reposetup
Kyle Lippincott <spectral@google.com>
parents:
37380
diff
changeset
|
15 |
narrowdirstate, |
39529
e82da0fcc7c5
narrow: move wire proto capabilities to narrowwirepeer
Martin von Zweigbergk <martinvonz@google.com>
parents:
39528
diff
changeset
|
16 |
narrowwirepeer, |
36079
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
17 |
) |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
18 |
|
36466
a8b4d7673d8e
narrow: move checking for narrow requirement into _narrowmatch()
Martin von Zweigbergk <martinvonz@google.com>
parents:
36464
diff
changeset
|
19 |
def wraprepo(repo): |
36079
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
20 |
"""Enables narrow clone functionality on a single local repository.""" |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
21 |
|
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
22 |
class narrowrepository(repo.__class__): |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
23 |
|
38128
1cba497491be
narrow: only wrap dirstate functions once, instead of per-reposetup
Kyle Lippincott <spectral@google.com>
parents:
37380
diff
changeset
|
24 |
def _makedirstate(self): |
1cba497491be
narrow: only wrap dirstate functions once, instead of per-reposetup
Kyle Lippincott <spectral@google.com>
parents:
37380
diff
changeset
|
25 |
dirstate = super(narrowrepository, self)._makedirstate() |
1cba497491be
narrow: only wrap dirstate functions once, instead of per-reposetup
Kyle Lippincott <spectral@google.com>
parents:
37380
diff
changeset
|
26 |
return narrowdirstate.wrapdirstate(self, dirstate) |
1cba497491be
narrow: only wrap dirstate functions once, instead of per-reposetup
Kyle Lippincott <spectral@google.com>
parents:
37380
diff
changeset
|
27 |
|
39528
2862e9b868c5
narrow: check "narrow" wire protocol capability, not bundle2 capability
Martin von Zweigbergk <martinvonz@google.com>
parents:
38872
diff
changeset
|
28 |
def peer(self): |
2862e9b868c5
narrow: check "narrow" wire protocol capability, not bundle2 capability
Martin von Zweigbergk <martinvonz@google.com>
parents:
38872
diff
changeset
|
29 |
peer = super(narrowrepository, self).peer() |
39933
d5498db5f86a
narrow: move the wireprotocol narrow capability name to core
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39766
diff
changeset
|
30 |
peer._caps.add(wireprotoserver.NARROWCAP) |
39529
e82da0fcc7c5
narrow: move wire proto capabilities to narrowwirepeer
Martin von Zweigbergk <martinvonz@google.com>
parents:
39528
diff
changeset
|
31 |
peer._caps.add(narrowwirepeer.ELLIPSESCAP) |
39528
2862e9b868c5
narrow: check "narrow" wire protocol capability, not bundle2 capability
Martin von Zweigbergk <martinvonz@google.com>
parents:
38872
diff
changeset
|
32 |
return peer |
2862e9b868c5
narrow: check "narrow" wire protocol capability, not bundle2 capability
Martin von Zweigbergk <martinvonz@google.com>
parents:
38872
diff
changeset
|
33 |
|
36079
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
34 |
repo.__class__ = narrowrepository |