Mercurial > hg
annotate hgext/narrow/narrowwirepeer.py @ 44363:f7459da77f23
nodemap: introduce an option to use mmap to read the nodemap mapping
The performance and memory benefit is much greater if we don't have to copy all
the data in memory for each information. So we introduce an option (on by
default) to read the data using mmap.
This changeset is the last one definition the API for index support nodemap
data. (they have to be able to use the mmaping).
Below are some benchmark comparing the best we currently have in 5.3 with the
final step of this series (using the persistent nodemap implementation in
Rust). The benchmark run `hg perfindex` with various revset and the following
variants:
Before:
* do not use the persistent nodemap
* use the CPython implementation of the index for nodemap
* use mmapping of the changelog index
After:
* use the MixedIndex Rust code, with the NodeTree object for nodemap access
(still in review)
* use the persistent nodemap data from disk
* access the persistent nodemap data through mmap
* use mmapping of the changelog index
The persistent nodemap greatly speed up most operation on very large
repositories. Some of the previously very fast lookup end up a bit slower because
the persistent nodemap has to be setup. However the absolute slowdown is very
small and won't matters in the big picture.
Here are some numbers (in seconds) for the reference copy of mozilla-try:
Revset Before After abs-change speedup
-10000: 0.004622 0.005532 0.000910 × 0.83
-10: 0.000050 0.000132 0.000082 × 0.37
tip 0.000052 0.000085 0.000033 × 0.61
0 + (-10000:) 0.028222 0.005337 -0.022885 × 5.29
0 0.023521 0.000084 -0.023437 × 280.01
(-10000:) + 0 0.235539 0.005308 -0.230231 × 44.37
(-10:) + :9 0.232883 0.000180 -0.232703 ×1293.79
(-10000:) + (:99) 0.238735 0.005358 -0.233377 × 44.55
:99 + (-10000:) 0.317942 0.005593 -0.312349 × 56.84
:9 + (-10:) 0.313372 0.000179 -0.313193 ×1750.68
:9 0.316450 0.000143 -0.316307 ×2212.93
On smaller repositories, the cost of nodemap related operation is not as big, so
the win is much more modest. Yet it helps shaving a handful of millisecond here
and there.
Here are some numbers (in seconds) for the reference copy of mercurial:
Revset Before After abs-change speedup
-10: 0.000065 0.000097 0.000032 × 0.67
tip 0.000063 0.000078 0.000015 × 0.80
0 0.000561 0.000079 -0.000482 × 7.10
-10000: 0.004609 0.003648 -0.000961 × 1.26
0 + (-10000:) 0.005023 0.003715 -0.001307 × 1.35
(-10:) + :9 0.002187 0.000108 -0.002079 ×20.25
(-10000:) + 0 0.006252 0.003716 -0.002536 × 1.68
(-10000:) + (:99) 0.006367 0.003707 -0.002660 × 1.71
:9 + (-10:) 0.003846 0.000110 -0.003736 ×34.96
:9 0.003854 0.000099 -0.003755 ×38.92
:99 + (-10000:) 0.007644 0.003778 -0.003866 × 2.02
Differential Revision: https://phab.mercurial-scm.org/D7894
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 11 Feb 2020 11:18:52 +0100 |
parents | 9f70512ae2cf |
children | d2e1dcd4490d |
rev | line source |
---|---|
36079
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1 # narrowwirepeer.py - passes narrow spec with unbundle command |
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 |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
10 from mercurial import ( |
40070
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
11 bundle2, |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
12 error, |
36079
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
13 extensions, |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
14 hg, |
40070
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
15 narrowspec, |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
16 pycompat, |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
17 wireprototypes, |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
18 wireprotov1peer, |
39523
c90514043eaa
narrow: add narrow and ellipses as server capabilities
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
36351
diff
changeset
|
19 wireprotov1server, |
36079
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
20 ) |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
21 |
42415
c767e655ffda
narrow: use narrow_widen wireproto command to widen in case of ellipses
Pulkit Goyal <7895pulkit@gmail.com>
parents:
40344
diff
changeset
|
22 from . import narrowbundle2 |
c767e655ffda
narrow: use narrow_widen wireproto command to widen in case of ellipses
Pulkit Goyal <7895pulkit@gmail.com>
parents:
40344
diff
changeset
|
23 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
24 |
36079
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
25 def uisetup(): |
40070
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
26 wireprotov1peer.wirepeer.narrow_widen = peernarrowwiden |
39523
c90514043eaa
narrow: add narrow and ellipses as server capabilities
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
36351
diff
changeset
|
27 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
28 |
36079
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
29 def reposetup(repo): |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
30 def wirereposetup(ui, peer): |
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
31 def wrapped(orig, cmd, *args, **kwargs): |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
32 if cmd == b'unbundle': |
36102
b60c577b6e03
narrowwirepeer: add TODO about how we add wireproto args to unbundle :(
Augie Fackler <augie@google.com>
parents:
36101
diff
changeset
|
33 # TODO: don't blindly add include/exclude wireproto |
b60c577b6e03
narrowwirepeer: add TODO about how we add wireproto args to unbundle :(
Augie Fackler <augie@google.com>
parents:
36101
diff
changeset
|
34 # arguments to unbundle. |
36079
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
35 include, exclude = repo.narrowpats |
43503
313e3a279828
cleanup: remove pointless r-prefixes on double-quoted strings
Augie Fackler <augie@google.com>
parents:
43249
diff
changeset
|
36 kwargs["includepats"] = b','.join(include) |
313e3a279828
cleanup: remove pointless r-prefixes on double-quoted strings
Augie Fackler <augie@google.com>
parents:
43249
diff
changeset
|
37 kwargs["excludepats"] = b','.join(exclude) |
36079
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
38 return orig(cmd, *args, **kwargs) |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
39 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
40 extensions.wrapfunction(peer, b'_calltwowaystream', wrapped) |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
41 |
36079
a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
42 hg.wirepeersetupfuncs.append(wirereposetup) |
40070
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
43 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
44 |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
45 @wireprotov1server.wireprotocommand( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
46 b'narrow_widen', |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
47 b'oldincludes oldexcludes' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
48 b' newincludes newexcludes' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
49 b' commonheads cgversion' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
50 b' known ellipses', |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
51 permission=b'pull', |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
52 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
53 def narrow_widen( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
54 repo, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
55 proto, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
56 oldincludes, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
57 oldexcludes, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
58 newincludes, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
59 newexcludes, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
60 commonheads, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
61 cgversion, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
62 known, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
63 ellipses, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
64 ): |
40070
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
65 """wireprotocol command to send data when a narrow clone is widen. We will |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
66 be sending a changegroup here. |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
67 |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
68 The current set of arguments which are required: |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
69 oldincludes: the old includes of the narrow copy |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
70 oldexcludes: the old excludes of the narrow copy |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
71 newincludes: the new includes of the narrow copy |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
72 newexcludes: the new excludes of the narrow copy |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
73 commonheads: list of heads which are common between the server and client |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
74 cgversion(maybe): the changegroup version to produce |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
75 known: list of nodes which are known on the client (used in ellipses cases) |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
76 ellipses: whether to send ellipses data or not |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
77 """ |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
78 |
40148
74558635dad5
narrow: don't compress the bundle2 when sending 'error:abort'
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40075
diff
changeset
|
79 preferuncompressed = False |
40070
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
80 try: |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
81 |
42944
c2676b5a9f59
narrow: don't hexify paths and double-hexify known nodes on wire (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents:
42417
diff
changeset
|
82 def splitpaths(data): |
c2676b5a9f59
narrow: don't hexify paths and double-hexify known nodes on wire (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents:
42417
diff
changeset
|
83 # work around ''.split(',') => [''] |
c2676b5a9f59
narrow: don't hexify paths and double-hexify known nodes on wire (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents:
42417
diff
changeset
|
84 return data.split(b',') if data else [] |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
85 |
42944
c2676b5a9f59
narrow: don't hexify paths and double-hexify known nodes on wire (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents:
42417
diff
changeset
|
86 oldincludes = splitpaths(oldincludes) |
c2676b5a9f59
narrow: don't hexify paths and double-hexify known nodes on wire (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents:
42417
diff
changeset
|
87 newincludes = splitpaths(newincludes) |
c2676b5a9f59
narrow: don't hexify paths and double-hexify known nodes on wire (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents:
42417
diff
changeset
|
88 oldexcludes = splitpaths(oldexcludes) |
c2676b5a9f59
narrow: don't hexify paths and double-hexify known nodes on wire (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents:
42417
diff
changeset
|
89 newexcludes = splitpaths(newexcludes) |
40070
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
90 # validate the patterns |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
91 narrowspec.validatepatterns(set(oldincludes)) |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
92 narrowspec.validatepatterns(set(newincludes)) |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
93 narrowspec.validatepatterns(set(oldexcludes)) |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
94 narrowspec.validatepatterns(set(newexcludes)) |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
95 |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
96 common = wireprototypes.decodelist(commonheads) |
42415
c767e655ffda
narrow: use narrow_widen wireproto command to widen in case of ellipses
Pulkit Goyal <7895pulkit@gmail.com>
parents:
40344
diff
changeset
|
97 known = wireprototypes.decodelist(known) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
98 if ellipses == b'0': |
40070
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
99 ellipses = False |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
100 else: |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
101 ellipses = bool(ellipses) |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
102 cgversion = cgversion |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
103 |
42417
a97b12f726e4
narrow: pass the bundle to bundle2.widen_bundle() instead of generating there
Pulkit Goyal <7895pulkit@gmail.com>
parents:
42415
diff
changeset
|
104 bundler = bundle2.bundle20(repo.ui) |
43249
63d440bef72a
widening: pass in matchers instead of patterns
Martin von Zweigbergk <martinvonz@google.com>
parents:
43247
diff
changeset
|
105 newmatch = narrowspec.match( |
63d440bef72a
widening: pass in matchers instead of patterns
Martin von Zweigbergk <martinvonz@google.com>
parents:
43247
diff
changeset
|
106 repo.root, include=newincludes, exclude=newexcludes |
63d440bef72a
widening: pass in matchers instead of patterns
Martin von Zweigbergk <martinvonz@google.com>
parents:
43247
diff
changeset
|
107 ) |
63d440bef72a
widening: pass in matchers instead of patterns
Martin von Zweigbergk <martinvonz@google.com>
parents:
43247
diff
changeset
|
108 oldmatch = narrowspec.match( |
63d440bef72a
widening: pass in matchers instead of patterns
Martin von Zweigbergk <martinvonz@google.com>
parents:
43247
diff
changeset
|
109 repo.root, include=oldincludes, exclude=oldexcludes |
63d440bef72a
widening: pass in matchers instead of patterns
Martin von Zweigbergk <martinvonz@google.com>
parents:
43247
diff
changeset
|
110 ) |
42415
c767e655ffda
narrow: use narrow_widen wireproto command to widen in case of ellipses
Pulkit Goyal <7895pulkit@gmail.com>
parents:
40344
diff
changeset
|
111 if not ellipses: |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
112 bundle2.widen_bundle( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
113 bundler, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
114 repo, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
115 oldmatch, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
116 newmatch, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
117 common, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
118 known, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
119 cgversion, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
120 ellipses, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
121 ) |
42415
c767e655ffda
narrow: use narrow_widen wireproto command to widen in case of ellipses
Pulkit Goyal <7895pulkit@gmail.com>
parents:
40344
diff
changeset
|
122 else: |
43242
561f9bc4b4c5
widening: duplicate generateellipsesbundle2() for widening
Martin von Zweigbergk <martinvonz@google.com>
parents:
43077
diff
changeset
|
123 narrowbundle2.generate_ellipses_bundle2_for_widening( |
43249
63d440bef72a
widening: pass in matchers instead of patterns
Martin von Zweigbergk <martinvonz@google.com>
parents:
43247
diff
changeset
|
124 bundler, repo, oldmatch, newmatch, cgversion, common, known, |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
125 ) |
40070
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
126 except error.Abort as exc: |
40071
e8132a8897da
narrow: start returning bundle2 from widen_bundle()
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40070
diff
changeset
|
127 bundler = bundle2.bundle20(repo.ui) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
128 manargs = [(b'message', pycompat.bytestr(exc))] |
40070
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
129 advargs = [] |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
130 if exc.hint is not None: |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
131 advargs.append((b'hint', exc.hint)) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
132 bundler.addpart(bundle2.bundlepart(b'error:abort', manargs, advargs)) |
40148
74558635dad5
narrow: don't compress the bundle2 when sending 'error:abort'
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40075
diff
changeset
|
133 preferuncompressed = True |
40070
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
134 |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
135 chunks = bundler.getchunks() |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
136 return wireprototypes.streamres( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
137 gen=chunks, prefer_uncompressed=preferuncompressed |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
138 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42944
diff
changeset
|
139 |
40070
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
140 |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
141 def peernarrowwiden(remote, **kwargs): |
43506
9f70512ae2cf
cleanup: remove pointless r-prefixes on single-quoted strings
Augie Fackler <augie@google.com>
parents:
43503
diff
changeset
|
142 for ch in ('commonheads', 'known'): |
40070
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
143 kwargs[ch] = wireprototypes.encodelist(kwargs[ch]) |
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
144 |
43506
9f70512ae2cf
cleanup: remove pointless r-prefixes on single-quoted strings
Augie Fackler <augie@google.com>
parents:
43503
diff
changeset
|
145 for ch in ('oldincludes', 'newincludes', 'oldexcludes', 'newexcludes'): |
42944
c2676b5a9f59
narrow: don't hexify paths and double-hexify known nodes on wire (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents:
42417
diff
changeset
|
146 kwargs[ch] = b','.join(kwargs[ch]) |
c2676b5a9f59
narrow: don't hexify paths and double-hexify known nodes on wire (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents:
42417
diff
changeset
|
147 |
43506
9f70512ae2cf
cleanup: remove pointless r-prefixes on single-quoted strings
Augie Fackler <augie@google.com>
parents:
43503
diff
changeset
|
148 kwargs['ellipses'] = b'%i' % bool(kwargs['ellipses']) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
149 f = remote._callcompressable(b'narrow_widen', **kwargs) |
40070
8feae5b989bc
narrow: the first version of narrow_widen wireprotocol command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39934
diff
changeset
|
150 return bundle2.getunbundler(remote.ui, f) |