Mercurial > hg
annotate hgext/remotefilelog/__init__.py @ 52152:de4b9ea2fa34 default tip
branching: merge stable into default
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Tue, 29 Oct 2024 09:38:48 +0100 |
parents | f4733654f144 |
children |
rev | line source |
---|---|
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1 # __init__.py - remotefilelog extension |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
2 # |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
3 # Copyright 2013 Facebook, Inc. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
4 # |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
5 # This software may be used and distributed according to the terms of the |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
6 # GNU General Public License version 2 or any later version. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
7 """remotefilelog causes Mercurial to lazilly fetch file contents (EXPERIMENTAL) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
8 |
40512
b35a096b9bff
remotefilelog: add some docstring
Augie Fackler <augie@google.com>
parents:
40510
diff
changeset
|
9 This extension is HIGHLY EXPERIMENTAL. There are NO BACKWARDS COMPATIBILITY |
b35a096b9bff
remotefilelog: add some docstring
Augie Fackler <augie@google.com>
parents:
40510
diff
changeset
|
10 GUARANTEES. This means that repositories created with this extension may |
b35a096b9bff
remotefilelog: add some docstring
Augie Fackler <augie@google.com>
parents:
40510
diff
changeset
|
11 only be usable with the exact version of this extension/Mercurial that was |
b35a096b9bff
remotefilelog: add some docstring
Augie Fackler <augie@google.com>
parents:
40510
diff
changeset
|
12 used. The extension attempts to enforce this in order to prevent repository |
b35a096b9bff
remotefilelog: add some docstring
Augie Fackler <augie@google.com>
parents:
40510
diff
changeset
|
13 corruption. |
b35a096b9bff
remotefilelog: add some docstring
Augie Fackler <augie@google.com>
parents:
40510
diff
changeset
|
14 |
b35a096b9bff
remotefilelog: add some docstring
Augie Fackler <augie@google.com>
parents:
40510
diff
changeset
|
15 remotefilelog works by fetching file contents lazily and storing them |
b35a096b9bff
remotefilelog: add some docstring
Augie Fackler <augie@google.com>
parents:
40510
diff
changeset
|
16 in a cache on the client rather than in revlogs. This allows enormous |
b35a096b9bff
remotefilelog: add some docstring
Augie Fackler <augie@google.com>
parents:
40510
diff
changeset
|
17 histories to be transferred only partially, making them easier to |
b35a096b9bff
remotefilelog: add some docstring
Augie Fackler <augie@google.com>
parents:
40510
diff
changeset
|
18 operate on. |
b35a096b9bff
remotefilelog: add some docstring
Augie Fackler <augie@google.com>
parents:
40510
diff
changeset
|
19 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
20 Configs: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
21 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
22 ``packs.maxchainlen`` specifies the maximum delta chain length in pack files |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
23 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
24 ``packs.maxpacksize`` specifies the maximum pack file size |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
25 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
26 ``packs.maxpackfilecount`` specifies the maximum number of packs in the |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
27 shared cache (trees only for now) |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
28 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
29 ``remotefilelog.backgroundprefetch`` runs prefetch in background when True |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
30 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
31 ``remotefilelog.bgprefetchrevs`` specifies revisions to fetch on commit and |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
32 update, and on other commands that use them. Different from pullprefetch. |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
33 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
34 ``remotefilelog.gcrepack`` does garbage collection during repack when True |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
35 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
36 ``remotefilelog.nodettl`` specifies maximum TTL of a node in seconds before |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
37 it is garbage collected |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
38 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
39 ``remotefilelog.repackonhggc`` runs repack on hg gc when True |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
40 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
41 ``remotefilelog.prefetchdays`` specifies the maximum age of a commit in |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
42 days after which it is no longer prefetched. |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
43 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
44 ``remotefilelog.prefetchdelay`` specifies delay between background |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
45 prefetches in seconds after operations that change the working copy parent |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
46 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
47 ``remotefilelog.data.gencountlimit`` constraints the minimum number of data |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
48 pack files required to be considered part of a generation. In particular, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
49 minimum number of packs files > gencountlimit. |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
50 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
51 ``remotefilelog.data.generations`` list for specifying the lower bound of |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
52 each generation of the data pack files. For example, list ['100MB','1MB'] |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
53 or ['1MB', '100MB'] will lead to three generations: [0, 1MB), [ |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
54 1MB, 100MB) and [100MB, infinity). |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
55 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
56 ``remotefilelog.data.maxrepackpacks`` the maximum number of pack files to |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
57 include in an incremental data repack. |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
58 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
59 ``remotefilelog.data.repackmaxpacksize`` the maximum size of a pack file for |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
60 it to be considered for an incremental data repack. |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
61 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
62 ``remotefilelog.data.repacksizelimit`` the maximum total size of pack files |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
63 to include in an incremental data repack. |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
64 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
65 ``remotefilelog.history.gencountlimit`` constraints the minimum number of |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
66 history pack files required to be considered part of a generation. In |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
67 particular, minimum number of packs files > gencountlimit. |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
68 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
69 ``remotefilelog.history.generations`` list for specifying the lower bound of |
40737
32a23c3f56d4
remotefilelog: fix typo in docstring
Augie Fackler <augie@google.com>
parents:
40610
diff
changeset
|
70 each generation of the history pack files. For example, list [ |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
71 '100MB', '1MB'] or ['1MB', '100MB'] will lead to three generations: [ |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
72 0, 1MB), [1MB, 100MB) and [100MB, infinity). |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
73 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
74 ``remotefilelog.history.maxrepackpacks`` the maximum number of pack files to |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
75 include in an incremental history repack. |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
76 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
77 ``remotefilelog.history.repackmaxpacksize`` the maximum size of a pack file |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
78 for it to be considered for an incremental history repack. |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
79 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
80 ``remotefilelog.history.repacksizelimit`` the maximum total size of pack |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
81 files to include in an incremental history repack. |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
82 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
83 ``remotefilelog.backgroundrepack`` automatically consolidate packs in the |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
84 background |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
85 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
86 ``remotefilelog.cachepath`` path to cache |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
87 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
88 ``remotefilelog.cachegroup`` if set, make cache directory sgid to this |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
89 group |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
90 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
91 ``remotefilelog.cacheprocess`` binary to invoke for fetching file data |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
92 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
93 ``remotefilelog.debug`` turn on remotefilelog-specific debug output |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
94 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
95 ``remotefilelog.excludepattern`` pattern of files to exclude from pulls |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
96 |
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
97 ``remotefilelog.includepattern`` pattern of files to include in pulls |
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
98 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
99 ``remotefilelog.fetchwarning``: message to print when too many |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
100 single-file fetches occur |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
101 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
102 ``remotefilelog.getfilesstep`` number of files to request in a single RPC |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
103 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
104 ``remotefilelog.getfilestype`` if set to 'threaded' use threads to fetch |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
105 files, otherwise use optimistic fetching |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
106 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
107 ``remotefilelog.pullprefetch`` revset for selecting files that should be |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
108 eagerly downloaded rather than lazily |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
109 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
110 ``remotefilelog.reponame`` name of the repo. If set, used to partition |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
111 data from other repos in a shared store. |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
112 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
113 ``remotefilelog.server`` if true, enable server-side functionality |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
114 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
115 ``remotefilelog.servercachepath`` path for caching blobs on the server |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
116 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
117 ``remotefilelog.serverexpiration`` number of days to keep cached server |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
118 blobs |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
119 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
120 ``remotefilelog.validatecache`` if set, check cache entries for corruption |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
121 before returning blobs |
40548
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40514
diff
changeset
|
122 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
123 ``remotefilelog.validatecachelog`` if set, check cache entries for |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
124 corruption before returning metadata |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
125 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
126 """ |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
127 |
51863
f4733654f144
typing: add `from __future__ import annotations` to most files
Matt Harbison <matt_harbison@yahoo.com>
parents:
51862
diff
changeset
|
128 from __future__ import annotations |
f4733654f144
typing: add `from __future__ import annotations` to most files
Matt Harbison <matt_harbison@yahoo.com>
parents:
51862
diff
changeset
|
129 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
130 import os |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
131 import time |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
132 import traceback |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
133 |
46113
59fa3890d40a
node: import symbols explicitly
Joerg Sonnenberger <joerg@bec.de>
parents:
45942
diff
changeset
|
134 from mercurial.node import ( |
59fa3890d40a
node: import symbols explicitly
Joerg Sonnenberger <joerg@bec.de>
parents:
45942
diff
changeset
|
135 hex, |
59fa3890d40a
node: import symbols explicitly
Joerg Sonnenberger <joerg@bec.de>
parents:
45942
diff
changeset
|
136 wdirrev, |
59fa3890d40a
node: import symbols explicitly
Joerg Sonnenberger <joerg@bec.de>
parents:
45942
diff
changeset
|
137 ) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
138 from mercurial.i18n import _ |
43085
eef9a2d67051
py3: manually import pycompat.open into files that need it
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43077
diff
changeset
|
139 from mercurial.pycompat import open |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
140 from mercurial import ( |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
141 changegroup, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
142 changelog, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
143 commands, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
144 configitems, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
145 context, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
146 copies, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
147 debugcommands as hgdebugcommands, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
148 dispatch, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
149 error, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
150 exchange, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
151 extensions, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
152 hg, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
153 localrepo, |
45072
a56ba57c837d
scmutil: allowing different files to be prefetched per revision
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
44452
diff
changeset
|
154 match as matchmod, |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
155 merge, |
45294
30f3e278c5d7
mergeactions: use action constants instead of string values
Pulkit Goyal <7895pulkit@gmail.com>
parents:
45287
diff
changeset
|
156 mergestate as mergestatemod, |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
157 patch, |
40610
13d4ad8d7801
py3: fix keyword arguments handling in hgext/remotefilelog/
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40577
diff
changeset
|
158 pycompat, |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
159 registrar, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
160 repair, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
161 repoview, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
162 revset, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
163 scmutil, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
164 smartset, |
40513
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40512
diff
changeset
|
165 streamclone, |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
166 util, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
167 ) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
168 from . import ( |
40508
354acd0dc637
remotefilelog: rename capability for legacy ssh file fetching method
Augie Fackler <augie@google.com>
parents:
40502
diff
changeset
|
169 constants, |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
170 debugcommands, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
171 fileserverclient, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
172 remotefilectx, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
173 remotefilelog, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
174 remotefilelogserver, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
175 repack as repackmod, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
176 shallowbundle, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
177 shallowrepo, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
178 shallowstore, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
179 shallowutil, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
180 shallowverifier, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
181 ) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
182 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
183 # ensures debug commands are registered |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
184 hgdebugcommands.command |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
185 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
186 cmdtable = {} |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
187 command = registrar.command(cmdtable) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
188 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
189 configtable = {} |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
190 configitem = registrar.configitem(configtable) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
191 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
192 configitem(b'remotefilelog', b'debug', default=False) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
193 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
194 configitem(b'remotefilelog', b'reponame', default=b'') |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
195 configitem(b'remotefilelog', b'cachepath', default=None) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
196 configitem(b'remotefilelog', b'cachegroup', default=None) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
197 configitem(b'remotefilelog', b'cacheprocess', default=None) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
198 configitem(b'remotefilelog', b'cacheprocess.includepath', default=None) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
199 configitem(b"remotefilelog", b"cachelimit", default=b"1000 GB") |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
200 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
201 configitem( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
202 b'remotefilelog', |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
203 b'fallbackpath', |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
204 default=configitems.dynamicdefault, |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
205 alias=[(b'remotefilelog', b'fallbackrepo')], |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
206 ) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
207 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
208 configitem(b'remotefilelog', b'validatecachelog', default=None) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
209 configitem(b'remotefilelog', b'validatecache', default=b'on') |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
210 configitem(b'remotefilelog', b'server', default=None) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
211 configitem(b'remotefilelog', b'servercachepath', default=None) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
212 configitem(b"remotefilelog", b"serverexpiration", default=30) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
213 configitem(b'remotefilelog', b'backgroundrepack', default=False) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
214 configitem(b'remotefilelog', b'bgprefetchrevs', default=None) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
215 configitem(b'remotefilelog', b'pullprefetch', default=None) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
216 configitem(b'remotefilelog', b'backgroundprefetch', default=False) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
217 configitem(b'remotefilelog', b'prefetchdelay', default=120) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
218 configitem(b'remotefilelog', b'prefetchdays', default=14) |
46847
47a9527731c3
remotefilelog: include file contents in bundles produced during strip
Kyle Lippincott <spectral@google.com>
parents:
46113
diff
changeset
|
219 # Other values include 'local' or 'none'. Any unrecognized value is 'all'. |
47a9527731c3
remotefilelog: include file contents in bundles produced during strip
Kyle Lippincott <spectral@google.com>
parents:
46113
diff
changeset
|
220 configitem(b'remotefilelog', b'strip.includefiles', default='all') |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
221 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
222 configitem(b'remotefilelog', b'getfilesstep', default=10000) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
223 configitem(b'remotefilelog', b'getfilestype', default=b'optimistic') |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
224 configitem(b'remotefilelog', b'batchsize', configitems.dynamicdefault) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
225 configitem(b'remotefilelog', b'fetchwarning', default=b'') |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
226 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
227 configitem(b'remotefilelog', b'includepattern', default=None) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
228 configitem(b'remotefilelog', b'excludepattern', default=None) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
229 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
230 configitem(b'remotefilelog', b'gcrepack', default=False) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
231 configitem(b'remotefilelog', b'repackonhggc', default=False) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
232 configitem(b'repack', b'chainorphansbysize', default=True, experimental=True) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
233 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
234 configitem(b'packs', b'maxpacksize', default=0) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
235 configitem(b'packs', b'maxchainlen', default=1000) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
236 |
43849
63bb6dc62f24
remotefilelog: add a developer option to wait for background processes
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43181
diff
changeset
|
237 configitem(b'devel', b'remotefilelog.bg-wait', default=False) |
42842
2c74337e6483
remotefilelog: reduce probability of race-condition in remotefilelog tests
Boris Feld <boris.feld@octobus.net>
parents:
42760
diff
changeset
|
238 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
239 # default TTL limit is 30 days |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
240 _defaultlimit = 60 * 60 * 24 * 30 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
241 configitem(b'remotefilelog', b'nodettl', default=_defaultlimit) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
242 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
243 configitem(b'remotefilelog', b'data.gencountlimit', default=2), |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
244 configitem( |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
245 b'remotefilelog', b'data.generations', default=[b'1GB', b'100MB', b'1MB'] |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
246 ) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
247 configitem(b'remotefilelog', b'data.maxrepackpacks', default=50) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
248 configitem(b'remotefilelog', b'data.repackmaxpacksize', default=b'4GB') |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
249 configitem(b'remotefilelog', b'data.repacksizelimit', default=b'100MB') |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
250 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
251 configitem(b'remotefilelog', b'history.gencountlimit', default=2), |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
252 configitem(b'remotefilelog', b'history.generations', default=[b'100MB']) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
253 configitem(b'remotefilelog', b'history.maxrepackpacks', default=50) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
254 configitem(b'remotefilelog', b'history.repackmaxpacksize', default=b'400MB') |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
255 configitem(b'remotefilelog', b'history.repacksizelimit', default=b'100MB') |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
256 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
257 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
258 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
259 # be specifying the version(s) of Mercurial they are tested with, or |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
260 # leave the attribute unspecified. |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
261 testedwith = b'ships-with-hg-core' |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
262 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
263 repoclass = localrepo.localrepository |
40510
fc2766860796
remotefilelog: consolidate and rename on-disk store requirement
Augie Fackler <augie@google.com>
parents:
40509
diff
changeset
|
264 repoclass._basesupported.add(constants.SHALLOWREPO_REQUIREMENT) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
265 |
40514
6f0b6905ef6f
shallowutil: introduce a helper function isenabled()
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40513
diff
changeset
|
266 isenabled = shallowutil.isenabled |
6f0b6905ef6f
shallowutil: introduce a helper function isenabled()
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40513
diff
changeset
|
267 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
268 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
269 def uisetup(ui): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
270 """Wraps user facing Mercurial commands to swap them out with shallow |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
271 versions. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
272 """ |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
273 hg.wirepeersetupfuncs.append(fileserverclient.peersetup) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
274 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
275 entry = extensions.wrapcommand(commands.table, b'clone', cloneshallow) |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
276 entry[1].append( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
277 ( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
278 b'', |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
279 b'shallow', |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
280 None, |
43117
8ff1ecfadcd1
cleanup: join string literals that are already on one line
Martin von Zweigbergk <martinvonz@google.com>
parents:
43105
diff
changeset
|
281 _(b"create a shallow clone which uses remote file history"), |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
282 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
283 ) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
284 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
285 extensions.wrapcommand( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
286 commands.table, b'debugindex', debugcommands.debugindex |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
287 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
288 extensions.wrapcommand( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
289 commands.table, b'debugindexdot', debugcommands.debugindexdot |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
290 ) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
291 extensions.wrapcommand(commands.table, b'log', log) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
292 extensions.wrapcommand(commands.table, b'pull', pull) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
293 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
294 # Prevent 'hg manifest --all' |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
295 def _manifest(orig, ui, repo, *args, **opts): |
43506
9f70512ae2cf
cleanup: remove pointless r-prefixes on single-quoted strings
Augie Fackler <augie@google.com>
parents:
43181
diff
changeset
|
296 if isenabled(repo) and opts.get('all'): |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
297 raise error.Abort(_(b"--all is not supported in a shallow repo")) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
298 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
299 return orig(ui, repo, *args, **opts) |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
300 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
301 extensions.wrapcommand(commands.table, b"manifest", _manifest) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
302 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
303 # Wrap remotefilelog with lfs code |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
304 def _lfsloaded(loaded=False): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
305 lfsmod = None |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
306 try: |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
307 lfsmod = extensions.find(b'lfs') |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
308 except KeyError: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
309 pass |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
310 if lfsmod: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
311 lfsmod.wrapfilelog(remotefilelog.remotefilelog) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
312 fileserverclient._lfsmod = lfsmod |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
313 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
314 extensions.afterloaded(b'lfs', _lfsloaded) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
315 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
316 # debugdata needs remotefilelog.len to work |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
317 extensions.wrapcommand(commands.table, b'debugdata', debugdatashallow) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
318 |
42274
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42273
diff
changeset
|
319 changegroup.cgpacker = shallowbundle.shallowcg1packer |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42273
diff
changeset
|
320 |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42273
diff
changeset
|
321 extensions.wrapfunction( |
50789
cbd1da102417
wrapfunction: use sysstr instead of bytes as argument in "remotefilelog"
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50524
diff
changeset
|
322 changegroup, '_addchangegroupfiles', shallowbundle.addchangegroupfiles |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
323 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
324 extensions.wrapfunction( |
50789
cbd1da102417
wrapfunction: use sysstr instead of bytes as argument in "remotefilelog"
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50524
diff
changeset
|
325 changegroup, 'makechangegroup', shallowbundle.makechangegroup |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
326 ) |
50789
cbd1da102417
wrapfunction: use sysstr instead of bytes as argument in "remotefilelog"
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50524
diff
changeset
|
327 extensions.wrapfunction(localrepo, 'makestore', storewrapper) |
cbd1da102417
wrapfunction: use sysstr instead of bytes as argument in "remotefilelog"
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50524
diff
changeset
|
328 extensions.wrapfunction(exchange, 'pull', exchangepull) |
cbd1da102417
wrapfunction: use sysstr instead of bytes as argument in "remotefilelog"
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50524
diff
changeset
|
329 extensions.wrapfunction(merge, 'applyupdates', applyupdates) |
cbd1da102417
wrapfunction: use sysstr instead of bytes as argument in "remotefilelog"
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50524
diff
changeset
|
330 extensions.wrapfunction(merge, '_checkunknownfiles', checkunknownfiles) |
cbd1da102417
wrapfunction: use sysstr instead of bytes as argument in "remotefilelog"
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50524
diff
changeset
|
331 extensions.wrapfunction(context.workingctx, '_checklookup', checklookup) |
cbd1da102417
wrapfunction: use sysstr instead of bytes as argument in "remotefilelog"
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50524
diff
changeset
|
332 extensions.wrapfunction(scmutil, '_findrenames', findrenames) |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
333 extensions.wrapfunction( |
50789
cbd1da102417
wrapfunction: use sysstr instead of bytes as argument in "remotefilelog"
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50524
diff
changeset
|
334 copies, '_computeforwardmissing', computeforwardmissing |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
335 ) |
50789
cbd1da102417
wrapfunction: use sysstr instead of bytes as argument in "remotefilelog"
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50524
diff
changeset
|
336 extensions.wrapfunction(dispatch, 'runcommand', runcommand) |
cbd1da102417
wrapfunction: use sysstr instead of bytes as argument in "remotefilelog"
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50524
diff
changeset
|
337 extensions.wrapfunction(repair, '_collectbrokencsets', _collectbrokencsets) |
cbd1da102417
wrapfunction: use sysstr instead of bytes as argument in "remotefilelog"
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50524
diff
changeset
|
338 extensions.wrapfunction(context.changectx, 'filectx', filectx) |
cbd1da102417
wrapfunction: use sysstr instead of bytes as argument in "remotefilelog"
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50524
diff
changeset
|
339 extensions.wrapfunction(context.workingctx, 'filectx', workingfilectx) |
cbd1da102417
wrapfunction: use sysstr instead of bytes as argument in "remotefilelog"
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50524
diff
changeset
|
340 extensions.wrapfunction(patch, 'trydiff', trydiff) |
cbd1da102417
wrapfunction: use sysstr instead of bytes as argument in "remotefilelog"
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50524
diff
changeset
|
341 extensions.wrapfunction(hg, 'verify', _verify) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
342 scmutil.fileprefetchhooks.add(b'remotefilelog', _fileprefetchhook) |
42274
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42273
diff
changeset
|
343 |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42273
diff
changeset
|
344 # disappointing hacks below |
50789
cbd1da102417
wrapfunction: use sysstr instead of bytes as argument in "remotefilelog"
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50524
diff
changeset
|
345 extensions.wrapfunction(scmutil, 'getrenamedfn', getrenamedfn) |
cbd1da102417
wrapfunction: use sysstr instead of bytes as argument in "remotefilelog"
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50524
diff
changeset
|
346 extensions.wrapfunction(revset, 'filelog', filelogrevset) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
347 revset.symbols[b'filelog'] = revset.filelog |
42274
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42273
diff
changeset
|
348 |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42273
diff
changeset
|
349 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
350 def cloneshallow(orig, ui, repo, *args, **opts): |
43506
9f70512ae2cf
cleanup: remove pointless r-prefixes on single-quoted strings
Augie Fackler <augie@google.com>
parents:
43181
diff
changeset
|
351 if opts.get('shallow'): |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
352 repos = [] |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
353 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
354 def pull_shallow(orig, self, *args, **kwargs): |
40514
6f0b6905ef6f
shallowutil: introduce a helper function isenabled()
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40513
diff
changeset
|
355 if not isenabled(self): |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
356 repos.append(self.unfiltered()) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
357 # set up the client hooks so the post-clone update works |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
358 setupclient(self.ui, self.unfiltered()) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
359 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
360 # setupclient fixed the class on the repo itself |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
361 # but we also need to fix it on the repoview |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
362 if isinstance(self, repoview.repoview): |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
363 self.__class__.__bases__ = ( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
364 self.__class__.__bases__[0], |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
365 self.unfiltered().__class__, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
366 ) |
40510
fc2766860796
remotefilelog: consolidate and rename on-disk store requirement
Augie Fackler <augie@google.com>
parents:
40509
diff
changeset
|
367 self.requirements.add(constants.SHALLOWREPO_REQUIREMENT) |
45481
bddc4f2ef317
remotefilelog: acquire lock before writing requirements on clone
Pulkit Goyal <7895pulkit@gmail.com>
parents:
45346
diff
changeset
|
368 with self.lock(): |
bddc4f2ef317
remotefilelog: acquire lock before writing requirements on clone
Pulkit Goyal <7895pulkit@gmail.com>
parents:
45346
diff
changeset
|
369 # acquire store lock before writing requirements as some |
bddc4f2ef317
remotefilelog: acquire lock before writing requirements on clone
Pulkit Goyal <7895pulkit@gmail.com>
parents:
45346
diff
changeset
|
370 # requirements might be written to .hg/store/requires |
bddc4f2ef317
remotefilelog: acquire lock before writing requirements on clone
Pulkit Goyal <7895pulkit@gmail.com>
parents:
45346
diff
changeset
|
371 scmutil.writereporequirements(self) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
372 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
373 # Since setupclient hadn't been called, exchange.pull was not |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
374 # wrapped. So we need to manually invoke our version of it. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
375 return exchangepull(orig, self, *args, **kwargs) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
376 else: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
377 return orig(self, *args, **kwargs) |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
378 |
50789
cbd1da102417
wrapfunction: use sysstr instead of bytes as argument in "remotefilelog"
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50524
diff
changeset
|
379 extensions.wrapfunction(exchange, 'pull', pull_shallow) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
380 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
381 # Wrap the stream logic to add requirements and to pass include/exclude |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
382 # patterns around. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
383 def setup_streamout(repo, remote): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
384 # Replace remote.stream_out with a version that sends file |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
385 # patterns. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
386 def stream_out_shallow(orig): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
387 caps = remote.capabilities() |
40508
354acd0dc637
remotefilelog: rename capability for legacy ssh file fetching method
Augie Fackler <augie@google.com>
parents:
40502
diff
changeset
|
388 if constants.NETWORK_CAP_LEGACY_SSH_GETFILES in caps: |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
389 opts = {} |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
390 if repo.includepattern: |
43506
9f70512ae2cf
cleanup: remove pointless r-prefixes on single-quoted strings
Augie Fackler <augie@google.com>
parents:
43181
diff
changeset
|
391 opts['includepattern'] = b'\0'.join(repo.includepattern) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
392 if repo.excludepattern: |
43506
9f70512ae2cf
cleanup: remove pointless r-prefixes on single-quoted strings
Augie Fackler <augie@google.com>
parents:
43181
diff
changeset
|
393 opts['excludepattern'] = b'\0'.join(repo.excludepattern) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
394 return remote._callstream(b'stream_out_shallow', **opts) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
395 else: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
396 return orig() |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
397 |
50789
cbd1da102417
wrapfunction: use sysstr instead of bytes as argument in "remotefilelog"
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50524
diff
changeset
|
398 extensions.wrapfunction(remote, 'stream_out', stream_out_shallow) |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
399 |
40513
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40512
diff
changeset
|
400 def stream_wrap(orig, op): |
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40512
diff
changeset
|
401 setup_streamout(op.repo, op.remote) |
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40512
diff
changeset
|
402 return orig(op) |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
403 |
40513
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40512
diff
changeset
|
404 extensions.wrapfunction( |
50789
cbd1da102417
wrapfunction: use sysstr instead of bytes as argument in "remotefilelog"
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50524
diff
changeset
|
405 streamclone, 'maybeperformlegacystreamclone', stream_wrap |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
406 ) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
407 |
40513
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40512
diff
changeset
|
408 def canperformstreamclone(orig, pullop, bundle2=False): |
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40512
diff
changeset
|
409 # remotefilelog is currently incompatible with the |
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40512
diff
changeset
|
410 # bundle2 flavor of streamclones, so force us to use |
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40512
diff
changeset
|
411 # v1 instead. |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
412 if b'v2' in pullop.remotebundle2caps.get(b'stream', []): |
50524
58adcabc295f
stream-clone: introduce the notion of an experimental "v3" version
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
48875
diff
changeset
|
413 pullop.remotebundle2caps[b'stream'] = [] |
40513
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40512
diff
changeset
|
414 if bundle2: |
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40512
diff
changeset
|
415 return False, None |
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40512
diff
changeset
|
416 supported, requirements = orig(pullop, bundle2=bundle2) |
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40512
diff
changeset
|
417 if requirements is not None: |
40510
fc2766860796
remotefilelog: consolidate and rename on-disk store requirement
Augie Fackler <augie@google.com>
parents:
40509
diff
changeset
|
418 requirements.add(constants.SHALLOWREPO_REQUIREMENT) |
40513
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40512
diff
changeset
|
419 return supported, requirements |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
420 |
40513
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40512
diff
changeset
|
421 extensions.wrapfunction( |
50789
cbd1da102417
wrapfunction: use sysstr instead of bytes as argument in "remotefilelog"
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50524
diff
changeset
|
422 streamclone, 'canperformstreamclone', canperformstreamclone |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
423 ) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
424 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
425 try: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
426 orig(ui, repo, *args, **opts) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
427 finally: |
43506
9f70512ae2cf
cleanup: remove pointless r-prefixes on single-quoted strings
Augie Fackler <augie@google.com>
parents:
43181
diff
changeset
|
428 if opts.get('shallow'): |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
429 for r in repos: |
50928
d718eddf01d9
safehasattr: drop usage in favor of hasattr
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50895
diff
changeset
|
430 if hasattr(r, 'fileservice'): |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
431 r.fileservice.close() |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
432 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
433 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
434 def debugdatashallow(orig, *args, **kwds): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
435 oldlen = remotefilelog.remotefilelog.__len__ |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
436 try: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
437 remotefilelog.remotefilelog.__len__ = lambda x: 1 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
438 return orig(*args, **kwds) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
439 finally: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
440 remotefilelog.remotefilelog.__len__ = oldlen |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
441 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
442 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
443 def reposetup(ui, repo): |
41058
c61b8dfb07c8
remotefilelog: use repo.local() instead of isinstance()
Matt Harbison <matt_harbison@yahoo.com>
parents:
40840
diff
changeset
|
444 if not repo.local(): |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
445 return |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
446 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
447 # put here intentionally bc doesnt work in uisetup |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
448 ui.setconfig(b'hooks', b'update.prefetch', wcpprefetch) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
449 ui.setconfig(b'hooks', b'commit.prefetch', wcpprefetch) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
450 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
451 isserverenabled = ui.configbool(b'remotefilelog', b'server') |
40514
6f0b6905ef6f
shallowutil: introduce a helper function isenabled()
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40513
diff
changeset
|
452 isshallowclient = isenabled(repo) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
453 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
454 if isserverenabled and isshallowclient: |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
455 raise RuntimeError(b"Cannot be both a server and shallow client.") |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
456 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
457 if isshallowclient: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
458 setupclient(ui, repo) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
459 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
460 if isserverenabled: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
461 remotefilelogserver.setupserver(ui, repo) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
462 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
463 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
464 def setupclient(ui, repo): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
465 if not isinstance(repo, localrepo.localrepository): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
466 return |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
467 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
468 # Even clients get the server setup since they need to have the |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
469 # wireprotocol endpoints registered. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
470 remotefilelogserver.onetimesetup(ui) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
471 onetimeclientsetup(ui) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
472 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
473 shallowrepo.wraprepo(repo) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
474 repo.store = shallowstore.wrapstore(repo.store) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
475 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
476 |
42273
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
477 def storewrapper(orig, requirements, path, vfstype): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
478 s = orig(requirements, path, vfstype) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
479 if constants.SHALLOWREPO_REQUIREMENT in requirements: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
480 s = shallowstore.wrapstore(s) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
481 |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
482 return s |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
483 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
484 |
42273
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
485 # prefetch files before update |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
486 def applyupdates( |
45334
b9b055f15035
merge: pass mergeresult obj instead of actions in applyupdates() (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents:
45294
diff
changeset
|
487 orig, repo, mresult, wctx, mctx, overwrite, wantfiledata, **opts |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
488 ): |
42273
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
489 if isenabled(repo): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
490 manifest = mctx.manifest() |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
491 files = [] |
45334
b9b055f15035
merge: pass mergeresult obj instead of actions in applyupdates() (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents:
45294
diff
changeset
|
492 for f, args, msg in mresult.getactions([mergestatemod.ACTION_GET]): |
42273
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
493 files.append((f, hex(manifest[f]))) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
494 # batch fetch the needed files from the server |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
495 repo.fileservice.prefetch(files) |
45334
b9b055f15035
merge: pass mergeresult obj instead of actions in applyupdates() (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents:
45294
diff
changeset
|
496 return orig(repo, mresult, wctx, mctx, overwrite, wantfiledata, **opts) |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
497 |
42273
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
498 |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
499 # Prefetch merge checkunknownfiles |
45287
4ad6c4e9e35f
merge: pass mergeresult instead of actions in _checkunknownfiles() (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents:
45276
diff
changeset
|
500 def checkunknownfiles(orig, repo, wctx, mctx, force, mresult, *args, **kwargs): |
42273
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
501 if isenabled(repo): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
502 files = [] |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
503 sparsematch = repo.maybesparsematch(mctx.rev()) |
45346
3c783ff08d40
mergeresult: introduce filemap() which yields filename based mapping
Pulkit Goyal <7895pulkit@gmail.com>
parents:
45334
diff
changeset
|
504 for f, (m, actionargs, msg) in mresult.filemap(): |
42273
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
505 if sparsematch and not sparsematch(f): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
506 continue |
45294
30f3e278c5d7
mergeactions: use action constants instead of string values
Pulkit Goyal <7895pulkit@gmail.com>
parents:
45287
diff
changeset
|
507 if m in ( |
30f3e278c5d7
mergeactions: use action constants instead of string values
Pulkit Goyal <7895pulkit@gmail.com>
parents:
45287
diff
changeset
|
508 mergestatemod.ACTION_CREATED, |
30f3e278c5d7
mergeactions: use action constants instead of string values
Pulkit Goyal <7895pulkit@gmail.com>
parents:
45287
diff
changeset
|
509 mergestatemod.ACTION_DELETED_CHANGED, |
30f3e278c5d7
mergeactions: use action constants instead of string values
Pulkit Goyal <7895pulkit@gmail.com>
parents:
45287
diff
changeset
|
510 mergestatemod.ACTION_CREATED_MERGE, |
30f3e278c5d7
mergeactions: use action constants instead of string values
Pulkit Goyal <7895pulkit@gmail.com>
parents:
45287
diff
changeset
|
511 ): |
42273
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
512 files.append((f, hex(mctx.filenode(f)))) |
45294
30f3e278c5d7
mergeactions: use action constants instead of string values
Pulkit Goyal <7895pulkit@gmail.com>
parents:
45287
diff
changeset
|
513 elif m == mergestatemod.ACTION_LOCAL_DIR_RENAME_GET: |
42273
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
514 f2 = actionargs[0] |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
515 files.append((f2, hex(mctx.filenode(f2)))) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
516 # batch fetch the needed files from the server |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
517 repo.fileservice.prefetch(files) |
45287
4ad6c4e9e35f
merge: pass mergeresult instead of actions in _checkunknownfiles() (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents:
45276
diff
changeset
|
518 return orig(repo, wctx, mctx, force, mresult, *args, **kwargs) |
42273
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
519 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
520 |
42273
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
521 # Prefetch files before status attempts to look at their size and contents |
48390
322525db4c98
status: use filesystem time boundary to invalidate racy mtime
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
46945
diff
changeset
|
522 def checklookup(orig, self, files, mtime_boundary): |
42273
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
523 repo = self._repo |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
524 if isenabled(repo): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
525 prefetchfiles = [] |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
526 for parent in self._parents: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
527 for f in files: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
528 if f in parent: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
529 prefetchfiles.append((f, hex(parent.filenode(f)))) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
530 # batch fetch the needed files from the server |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
531 repo.fileservice.prefetch(prefetchfiles) |
48390
322525db4c98
status: use filesystem time boundary to invalidate racy mtime
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
46945
diff
changeset
|
532 return orig(self, files, mtime_boundary) |
42273
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
533 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
534 |
42273
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
535 # Prefetch the logic that compares added and removed files for renames |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
536 def findrenames(orig, repo, matcher, added, removed, *args, **kwargs): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
537 if isenabled(repo): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
538 files = [] |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
539 pmf = repo[b'.'].manifest() |
42273
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
540 for f in removed: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
541 if f in pmf: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
542 files.append((f, hex(pmf[f]))) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
543 # batch fetch the needed files from the server |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
544 repo.fileservice.prefetch(files) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
545 return orig(repo, matcher, added, removed, *args, **kwargs) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
546 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
547 |
42273
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
548 # prefetch files before pathcopies check |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
549 def computeforwardmissing(orig, a, b, match=None): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
550 missing = orig(a, b, match=match) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
551 repo = a._repo |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
552 if isenabled(repo): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
553 mb = b.manifest() |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
554 |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
555 files = [] |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
556 sparsematch = repo.maybesparsematch(b.rev()) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
557 if sparsematch: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
558 sparsemissing = set() |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
559 for f in missing: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
560 if sparsematch(f): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
561 files.append((f, hex(mb[f]))) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
562 sparsemissing.add(f) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
563 missing = sparsemissing |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
564 |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
565 # batch fetch the needed files from the server |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
566 repo.fileservice.prefetch(files) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
567 return missing |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
568 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
569 |
42273
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
570 # close cache miss server connection after the command has finished |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
571 def runcommand(orig, lui, repo, *args, **kwargs): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
572 fileservice = None |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
573 # repo can be None when running in chg: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
574 # - at startup, reposetup was called because serve is not norepo |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
575 # - a norepo command like "help" is called |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
576 if repo and isenabled(repo): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
577 fileservice = repo.fileservice |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
578 try: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
579 return orig(lui, repo, *args, **kwargs) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
580 finally: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
581 if fileservice: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
582 fileservice.close() |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
583 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
584 |
42273
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
585 # prevent strip from stripping remotefilelogs |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
586 def _collectbrokencsets(orig, repo, files, striprev): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
587 if isenabled(repo): |
51370
0d414fb8336f
cleanup: remove unnecessary list constructor calls around list comprehensions
Manuel Jacob <me@manueljacob.de>
parents:
50928
diff
changeset
|
588 files = [f for f in files if not repo.shallowmatch(f)] |
42273
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
589 return orig(repo, files, striprev) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
590 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
591 |
42273
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
592 # changectx wrappers |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
593 def filectx(orig, self, path, fileid=None, filelog=None): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
594 if fileid is None: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
595 fileid = self.filenode(path) |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
596 if isenabled(self._repo) and self._repo.shallowmatch(path): |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
597 return remotefilectx.remotefilectx( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
598 self._repo, path, fileid=fileid, changectx=self, filelog=filelog |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
599 ) |
42273
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
600 return orig(self, path, fileid=fileid, filelog=filelog) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
601 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
602 |
42273
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
603 def workingfilectx(orig, self, path, filelog=None): |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
604 if isenabled(self._repo) and self._repo.shallowmatch(path): |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
605 return remotefilectx.remoteworkingfilectx( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
606 self._repo, path, workingctx=self, filelog=filelog |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
607 ) |
42273
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
608 return orig(self, path, filelog=filelog) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
609 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
610 |
42273
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
611 # prefetch required revisions before a diff |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
612 def trydiff( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
613 orig, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
614 repo, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
615 revs, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
616 ctx1, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
617 ctx2, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
618 modified, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
619 added, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
620 removed, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
621 copy, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
622 getfilectx, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
623 *args, |
51862
607e94e01851
format: add many "missing" comma
Matt Harbison <matt_harbison@yahoo.com>
parents:
51370
diff
changeset
|
624 **kwargs, |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
625 ): |
42273
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
626 if isenabled(repo): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
627 prefetch = [] |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
628 mf1 = ctx1.manifest() |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
629 for fname in modified + added + removed: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
630 if fname in mf1: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
631 fnode = getfilectx(fname, ctx1).filenode() |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
632 # fnode can be None if it's a edited working ctx file |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
633 if fnode: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
634 prefetch.append((fname, hex(fnode))) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
635 if fname not in removed: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
636 fnode = getfilectx(fname, ctx2).filenode() |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
637 if fnode: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
638 prefetch.append((fname, hex(fnode))) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
639 |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
640 repo.fileservice.prefetch(prefetch) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
641 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
642 return orig( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
643 repo, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
644 revs, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
645 ctx1, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
646 ctx2, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
647 modified, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
648 added, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
649 removed, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
650 copy, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
651 getfilectx, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
652 *args, |
51862
607e94e01851
format: add many "missing" comma
Matt Harbison <matt_harbison@yahoo.com>
parents:
51370
diff
changeset
|
653 **kwargs, |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
654 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
655 |
42273
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
656 |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
657 # Prevent verify from processing files |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
658 # a stub for mercurial.hg.verify() |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
659 def _verify(orig, repo, level=None): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
660 lock = repo.lock() |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
661 try: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
662 return shallowverifier.shallowverifier(repo).verify() |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
663 finally: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
664 lock.release() |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
665 |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42223
diff
changeset
|
666 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
667 clientonetime = False |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
668 |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
669 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
670 def onetimeclientsetup(ui): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
671 global clientonetime |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
672 if clientonetime: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
673 return |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
674 clientonetime = True |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
675 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
676 # Don't commit filelogs until we know the commit hash, since the hash |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
677 # is present in the filelog blob. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
678 # This violates Mercurial's filelog->manifest->changelog write order, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
679 # but is generally fine for client repos. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
680 pendingfilecommits = [] |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
681 |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
682 def addrawrevision( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
683 orig, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
684 self, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
685 rawtext, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
686 transaction, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
687 link, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
688 p1, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
689 p2, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
690 node, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
691 flags, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
692 cachedelta=None, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
693 _metatuple=None, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
694 ): |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
695 if isinstance(link, int): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
696 pendingfilecommits.append( |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
697 ( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
698 self, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
699 rawtext, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
700 transaction, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
701 link, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
702 p1, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
703 p2, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
704 node, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
705 flags, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
706 cachedelta, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
707 _metatuple, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
708 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
709 ) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
710 return node |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
711 else: |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
712 return orig( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
713 self, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
714 rawtext, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
715 transaction, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
716 link, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
717 p1, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
718 p2, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
719 node, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
720 flags, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
721 cachedelta, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
722 _metatuple=_metatuple, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
723 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
724 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
725 extensions.wrapfunction( |
50789
cbd1da102417
wrapfunction: use sysstr instead of bytes as argument in "remotefilelog"
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50524
diff
changeset
|
726 remotefilelog.remotefilelog, 'addrawrevision', addrawrevision |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
727 ) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
728 |
43618
c5f6f58f6c71
remotefilelog: handle **kwargs correctly when overriding changelog.add()
Daniel Ploch <dploch@google.com>
parents:
43506
diff
changeset
|
729 def changelogadd(orig, self, *args, **kwargs): |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
730 oldlen = len(self) |
43618
c5f6f58f6c71
remotefilelog: handle **kwargs correctly when overriding changelog.add()
Daniel Ploch <dploch@google.com>
parents:
43506
diff
changeset
|
731 node = orig(self, *args, **kwargs) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
732 newlen = len(self) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
733 if oldlen != newlen: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
734 for oldargs in pendingfilecommits: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
735 log, rt, tr, link, p1, p2, n, fl, c, m = oldargs |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
736 linknode = self.node(link) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
737 if linknode == node: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
738 log.addrawrevision(rt, tr, linknode, p1, p2, n, fl, c, m) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
739 else: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
740 raise error.ProgrammingError( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
741 b'pending multiple integer revisions are not supported' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
742 ) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
743 else: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
744 # "link" is actually wrong here (it is set to len(changelog)) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
745 # if changelog remains unchanged, skip writing file revisions |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
746 # but still do a sanity check about pending multiple revisions |
44452
9d2b2df2c2ba
cleanup: run pyupgrade on our source tree to clean up varying things
Augie Fackler <augie@google.com>
parents:
43862
diff
changeset
|
747 if len({x[3] for x in pendingfilecommits}) > 1: |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
748 raise error.ProgrammingError( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
749 b'pending multiple integer revisions are not supported' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
750 ) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
751 del pendingfilecommits[:] |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
752 return node |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
753 |
50789
cbd1da102417
wrapfunction: use sysstr instead of bytes as argument in "remotefilelog"
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50524
diff
changeset
|
754 extensions.wrapfunction(changelog.changelog, 'add', changelogadd) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
755 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
756 |
42499
f93762f251d2
remotefilelog: check if RFL is enabled in getrenamedfn() override
Martin von Zweigbergk <martinvonz@google.com>
parents:
42472
diff
changeset
|
757 def getrenamedfn(orig, repo, endrev=None): |
42500
e387cb22f6c0
remotefilelog: handle copies in changesets in getrenamedfn() override
Martin von Zweigbergk <martinvonz@google.com>
parents:
42499
diff
changeset
|
758 if not isenabled(repo) or copies.usechangesetcentricalgo(repo): |
42499
f93762f251d2
remotefilelog: check if RFL is enabled in getrenamedfn() override
Martin von Zweigbergk <martinvonz@google.com>
parents:
42472
diff
changeset
|
759 return orig(repo, endrev) |
f93762f251d2
remotefilelog: check if RFL is enabled in getrenamedfn() override
Martin von Zweigbergk <martinvonz@google.com>
parents:
42472
diff
changeset
|
760 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
761 rcache = {} |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
762 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
763 def getrenamed(fn, rev): |
45942
89a2afe31e82
formating: upgrade to black 20.8b1
Augie Fackler <raf@durin42.com>
parents:
45651
diff
changeset
|
764 """looks up all renames for a file (up to endrev) the first |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
765 time the file is given. It indexes on the changerev and only |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
766 parses the manifest if linkrev != changerev. |
45942
89a2afe31e82
formating: upgrade to black 20.8b1
Augie Fackler <raf@durin42.com>
parents:
45651
diff
changeset
|
767 Returns rename info for fn at changerev rev.""" |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
768 if rev in rcache.setdefault(fn, {}): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
769 return rcache[fn][rev] |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
770 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
771 try: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
772 fctx = repo[rev].filectx(fn) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
773 for ancestor in fctx.ancestors(): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
774 if ancestor.path() == fn: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
775 renamed = ancestor.renamed() |
41192
2338eab5f8b7
remotefilelog: fix {file_copies} template keyword
Martin von Zweigbergk <martinvonz@google.com>
parents:
41058
diff
changeset
|
776 rcache[fn][ancestor.rev()] = renamed and renamed[0] |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
777 |
41192
2338eab5f8b7
remotefilelog: fix {file_copies} template keyword
Martin von Zweigbergk <martinvonz@google.com>
parents:
41058
diff
changeset
|
778 renamed = fctx.renamed() |
2338eab5f8b7
remotefilelog: fix {file_copies} template keyword
Martin von Zweigbergk <martinvonz@google.com>
parents:
41058
diff
changeset
|
779 return renamed and renamed[0] |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
780 except error.LookupError: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
781 return None |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
782 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
783 return getrenamed |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
784 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
785 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
786 def filelogrevset(orig, repo, subset, x): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
787 """``filelog(pattern)`` |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
788 Changesets connected to the specified filelog. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
789 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
790 For performance reasons, ``filelog()`` does not show every changeset |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
791 that affects the requested file(s). See :hg:`help log` for details. For |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
792 a slower, more accurate result, use ``file()``. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
793 """ |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
794 |
40514
6f0b6905ef6f
shallowutil: introduce a helper function isenabled()
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40513
diff
changeset
|
795 if not isenabled(repo): |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
796 return orig(repo, subset, x) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
797 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
798 # i18n: "filelog" is a keyword |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
799 pat = revset.getstring(x, _(b"filelog requires a pattern")) |
45072
a56ba57c837d
scmutil: allowing different files to be prefetched per revision
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
44452
diff
changeset
|
800 m = matchmod.match( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
801 repo.root, repo.getcwd(), [pat], default=b'relpath', ctx=repo[None] |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
802 ) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
803 s = set() |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
804 |
45072
a56ba57c837d
scmutil: allowing different files to be prefetched per revision
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
44452
diff
changeset
|
805 if not matchmod.patkind(pat): |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
806 # slow |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
807 for r in subset: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
808 ctx = repo[r] |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
809 cfiles = ctx.files() |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
810 for f in m.files(): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
811 if f in cfiles: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
812 s.add(ctx.rev()) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
813 break |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
814 else: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
815 # partial |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
816 files = (f for f in repo[None] if m(f)) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
817 for f in files: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
818 fctx = repo[None].filectx(f) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
819 s.add(fctx.linkrev()) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
820 for actx in fctx.ancestors(): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
821 s.add(actx.linkrev()) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
822 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
823 return smartset.baseset([r for r in subset if r in s]) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
824 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
825 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
826 @command(b'gc', [], _(b'hg gc [REPO...]'), norepo=True) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
827 def gc(ui, *args, **opts): |
45942
89a2afe31e82
formating: upgrade to black 20.8b1
Augie Fackler <raf@durin42.com>
parents:
45651
diff
changeset
|
828 """garbage collect the client and server filelog caches""" |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
829 cachepaths = set() |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
830 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
831 # get the system client cache |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
832 systemcache = shallowutil.getcachepath(ui, allowempty=True) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
833 if systemcache: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
834 cachepaths.add(systemcache) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
835 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
836 # get repo client and server cache |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
837 repopaths = [] |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
838 pwd = ui.environ.get(b'PWD') |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
839 if pwd: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
840 repopaths.append(pwd) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
841 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
842 repopaths.extend(args) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
843 repos = [] |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
844 for repopath in repopaths: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
845 try: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
846 repo = hg.peer(ui, {}, repopath) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
847 repos.append(repo) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
848 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
849 repocache = shallowutil.getcachepath(repo.ui, allowempty=True) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
850 if repocache: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
851 cachepaths.add(repocache) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
852 except error.RepoError: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
853 pass |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
854 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
855 # gc client cache |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
856 for cachepath in cachepaths: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
857 gcclient(ui, cachepath) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
858 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
859 # gc server cache |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
860 for repo in repos: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
861 remotefilelogserver.gcserver(ui, repo._repo) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
862 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
863 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
864 def gcclient(ui, cachepath): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
865 # get list of repos that use this cache |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
866 repospath = os.path.join(cachepath, b'repos') |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
867 if not os.path.exists(repospath): |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
868 ui.warn(_(b"no known cache at %s\n") % cachepath) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
869 return |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
870 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
871 reposfile = open(repospath, b'rb') |
42057
566daffc607d
cleanup: use set literals where possible
Martin von Zweigbergk <martinvonz@google.com>
parents:
41781
diff
changeset
|
872 repos = {r[:-1] for r in reposfile.readlines()} |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
873 reposfile.close() |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
874 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
875 # build list of useful files |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
876 validrepos = [] |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
877 keepkeys = set() |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
878 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
879 sharedcache = None |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
880 filesrepacked = False |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
881 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
882 count = 0 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
883 progress = ui.makeprogress( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
884 _(b"analyzing repositories"), unit=b"repos", total=len(repos) |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
885 ) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
886 for path in repos: |
40840
05afb32e9380
remotefilelog: use progress helper when analyzing repos
Martin von Zweigbergk <martinvonz@google.com>
parents:
40737
diff
changeset
|
887 progress.update(count) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
888 count += 1 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
889 try: |
46945
c1749dd31cdf
remotefilelog: use the right expandpath in to expand `~`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
46847
diff
changeset
|
890 path = util.expandpath(os.path.normpath(path)) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
891 except TypeError as e: |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
892 ui.warn(_(b"warning: malformed path: %r:%s\n") % (path, e)) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
893 traceback.print_exc() |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
894 continue |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
895 try: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
896 peer = hg.peer(ui, {}, path) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
897 repo = peer._repo |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
898 except error.RepoError: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
899 continue |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
900 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
901 validrepos.append(path) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
902 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
903 # Protect against any repo or config changes that have happened since |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
904 # this repo was added to the repos file. We'd rather this loop succeed |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
905 # and too much be deleted, than the loop fail and nothing gets deleted. |
40514
6f0b6905ef6f
shallowutil: introduce a helper function isenabled()
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40513
diff
changeset
|
906 if not isenabled(repo): |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
907 continue |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
908 |
50928
d718eddf01d9
safehasattr: drop usage in favor of hasattr
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50895
diff
changeset
|
909 if not hasattr(repo, 'name'): |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
910 ui.warn( |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
911 _(b"repo %s is a misconfigured remotefilelog repo\n") % path |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
912 ) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
913 continue |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
914 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
915 # If garbage collection on repack and repack on hg gc are enabled |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
916 # then loose files are repacked and garbage collected. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
917 # Otherwise regular garbage collection is performed. |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
918 repackonhggc = repo.ui.configbool(b'remotefilelog', b'repackonhggc') |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
919 gcrepack = repo.ui.configbool(b'remotefilelog', b'gcrepack') |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
920 if repackonhggc and gcrepack: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
921 try: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
922 repackmod.incrementalrepack(repo) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
923 filesrepacked = True |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
924 continue |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
925 except (IOError, repackmod.RepackAlreadyRunning): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
926 # If repack cannot be performed due to not enough disk space |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
927 # continue doing garbage collection of loose files w/o repack |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
928 pass |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
929 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
930 reponame = repo.name |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
931 if not sharedcache: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
932 sharedcache = repo.sharedstore |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
933 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
934 # Compute a keepset which is not garbage collected |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
935 def keyfn(fname, fnode): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
936 return fileserverclient.getcachekey(reponame, fname, hex(fnode)) |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
937 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
938 keepkeys = repackmod.keepset(repo, keyfn=keyfn, lastkeepkeys=keepkeys) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
939 |
40840
05afb32e9380
remotefilelog: use progress helper when analyzing repos
Martin von Zweigbergk <martinvonz@google.com>
parents:
40737
diff
changeset
|
940 progress.complete() |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
941 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
942 # write list of valid repos back |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
943 oldumask = os.umask(0o002) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
944 try: |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
945 reposfile = open(repospath, b'wb') |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
946 reposfile.writelines([(b"%s\n" % r) for r in validrepos]) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
947 reposfile.close() |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
948 finally: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
949 os.umask(oldumask) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
950 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
951 # prune cache |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
952 if sharedcache is not None: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
953 sharedcache.gc(keepkeys) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
954 elif not filesrepacked: |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
955 ui.warn(_(b"warning: no valid repos in repofile\n")) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
956 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
957 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
958 def log(orig, ui, repo, *pats, **opts): |
40514
6f0b6905ef6f
shallowutil: introduce a helper function isenabled()
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40513
diff
changeset
|
959 if not isenabled(repo): |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
960 return orig(ui, repo, *pats, **opts) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
961 |
43506
9f70512ae2cf
cleanup: remove pointless r-prefixes on single-quoted strings
Augie Fackler <augie@google.com>
parents:
43181
diff
changeset
|
962 follow = opts.get('follow') |
9f70512ae2cf
cleanup: remove pointless r-prefixes on single-quoted strings
Augie Fackler <augie@google.com>
parents:
43181
diff
changeset
|
963 revs = opts.get('rev') |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
964 if pats: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
965 # Force slowpath for non-follow patterns and follows that start from |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
966 # non-working-copy-parent revs. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
967 if not follow or revs: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
968 # This forces the slowpath |
43506
9f70512ae2cf
cleanup: remove pointless r-prefixes on single-quoted strings
Augie Fackler <augie@google.com>
parents:
43181
diff
changeset
|
969 opts['removed'] = True |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
970 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
971 # If this is a non-follow log without any revs specified, recommend that |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
972 # the user add -f to speed it up. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
973 if not follow and not revs: |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
974 match = scmutil.match(repo[b'.'], pats, pycompat.byteskwargs(opts)) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
975 isfile = not match.anypats() |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
976 if isfile: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
977 for file in match.files(): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
978 if not os.path.isfile(repo.wjoin(file)): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
979 isfile = False |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
980 break |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
981 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
982 if isfile: |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
983 ui.warn( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
984 _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
985 b"warning: file log can be slow on large repos - " |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
986 + b"use -f to speed it up\n" |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
987 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
988 ) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
989 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
990 return orig(ui, repo, *pats, **opts) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
991 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
992 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
993 def revdatelimit(ui, revset): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
994 """Update revset so that only changesets no older than 'prefetchdays' days |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
995 are included. The default value is set to 14 days. If 'prefetchdays' is set |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
996 to zero or negative value then date restriction is not applied. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
997 """ |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
998 days = ui.configint(b'remotefilelog', b'prefetchdays') |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
999 if days > 0: |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1000 revset = b'(%s) & date(-%s)' % (revset, days) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1001 return revset |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1002 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1003 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1004 def readytofetch(repo): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1005 """Check that enough time has passed since the last background prefetch. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1006 This only relates to prefetches after operations that change the working |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1007 copy parent. Default delay between background prefetches is 2 minutes. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1008 """ |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1009 timeout = repo.ui.configint(b'remotefilelog', b'prefetchdelay') |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1010 fname = repo.vfs.join(b'lastprefetch') |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1011 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1012 ready = False |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1013 with open(fname, b'a'): |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1014 # the with construct above is used to avoid race conditions |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1015 modtime = os.path.getmtime(fname) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1016 if (time.time() - modtime) > timeout: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1017 os.utime(fname, None) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1018 ready = True |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1019 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1020 return ready |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1021 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1022 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1023 def wcpprefetch(ui, repo, **kwargs): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1024 """Prefetches in background revisions specified by bgprefetchrevs revset. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1025 Does background repack if backgroundrepack flag is set in config. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1026 """ |
40514
6f0b6905ef6f
shallowutil: introduce a helper function isenabled()
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40513
diff
changeset
|
1027 shallow = isenabled(repo) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1028 bgprefetchrevs = ui.config(b'remotefilelog', b'bgprefetchrevs') |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1029 isready = readytofetch(repo) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1030 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1031 if not (shallow and bgprefetchrevs and isready): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1032 return |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1033 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1034 bgrepack = repo.ui.configbool(b'remotefilelog', b'backgroundrepack') |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1035 # update a revset with a date limit |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1036 bgprefetchrevs = revdatelimit(ui, bgprefetchrevs) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1037 |
43778
888bd39ed555
lock: pass "success" boolean to _afterlock callbacks
Kyle Lippincott <spectral@google.com>
parents:
43618
diff
changeset
|
1038 def anon(unused_success): |
50928
d718eddf01d9
safehasattr: drop usage in favor of hasattr
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50895
diff
changeset
|
1039 if hasattr(repo, 'ranprefetch') and repo.ranprefetch: |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1040 return |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1041 repo.ranprefetch = True |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1042 repo.backgroundprefetch(bgprefetchrevs, repack=bgrepack) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1043 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1044 repo._afterlock(anon) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1045 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1046 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1047 def pull(orig, ui, repo, *pats, **opts): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1048 result = orig(ui, repo, *pats, **opts) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1049 |
40514
6f0b6905ef6f
shallowutil: introduce a helper function isenabled()
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40513
diff
changeset
|
1050 if isenabled(repo): |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1051 # prefetch if it's configured |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1052 prefetchrevset = ui.config(b'remotefilelog', b'pullprefetch') |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1053 bgrepack = repo.ui.configbool(b'remotefilelog', b'backgroundrepack') |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1054 bgprefetch = repo.ui.configbool(b'remotefilelog', b'backgroundprefetch') |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1055 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1056 if prefetchrevset: |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1057 ui.status(_(b"prefetching file contents\n")) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1058 revs = scmutil.revrange(repo, [prefetchrevset]) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1059 base = repo[b'.'].rev() |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1060 if bgprefetch: |
43854
612b4b63fb22
remotefilelog: remove the `ensurestart` usage
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43849
diff
changeset
|
1061 repo.backgroundprefetch(prefetchrevset, repack=bgrepack) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1062 else: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1063 repo.prefetch(revs, base=base) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1064 if bgrepack: |
43854
612b4b63fb22
remotefilelog: remove the `ensurestart` usage
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43849
diff
changeset
|
1065 repackmod.backgroundrepack(repo, incremental=True) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1066 elif bgrepack: |
43854
612b4b63fb22
remotefilelog: remove the `ensurestart` usage
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43849
diff
changeset
|
1067 repackmod.backgroundrepack(repo, incremental=True) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1068 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1069 return result |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1070 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1071 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1072 def exchangepull(orig, repo, remote, *args, **kwargs): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1073 # Hook into the callstream/getbundle to insert bundle capabilities |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1074 # during a pull. |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1075 def localgetbundle( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1076 orig, source, heads=None, common=None, bundlecaps=None, **kwargs |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1077 ): |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1078 if not bundlecaps: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1079 bundlecaps = set() |
40509
ed19958dbf5d
remotefilelog: consolidate and rename bundle2 capability
Augie Fackler <augie@google.com>
parents:
40508
diff
changeset
|
1080 bundlecaps.add(constants.BUNDLE2_CAPABLITY) |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1081 return orig( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1082 source, heads=heads, common=common, bundlecaps=bundlecaps, **kwargs |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1083 ) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1084 |
50928
d718eddf01d9
safehasattr: drop usage in favor of hasattr
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50895
diff
changeset
|
1085 if hasattr(remote, '_callstream'): |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1086 remote._localrepo = repo |
50928
d718eddf01d9
safehasattr: drop usage in favor of hasattr
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50895
diff
changeset
|
1087 elif hasattr(remote, 'getbundle'): |
50789
cbd1da102417
wrapfunction: use sysstr instead of bytes as argument in "remotefilelog"
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50524
diff
changeset
|
1088 extensions.wrapfunction(remote, 'getbundle', localgetbundle) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1089 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1090 return orig(repo, remote, *args, **kwargs) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1091 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1092 |
45072
a56ba57c837d
scmutil: allowing different files to be prefetched per revision
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
44452
diff
changeset
|
1093 def _fileprefetchhook(repo, revmatches): |
40514
6f0b6905ef6f
shallowutil: introduce a helper function isenabled()
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40513
diff
changeset
|
1094 if isenabled(repo): |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1095 allfiles = [] |
45072
a56ba57c837d
scmutil: allowing different files to be prefetched per revision
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
44452
diff
changeset
|
1096 for rev, match in revmatches: |
46113
59fa3890d40a
node: import symbols explicitly
Joerg Sonnenberger <joerg@bec.de>
parents:
45942
diff
changeset
|
1097 if rev == wdirrev or rev is None: |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1098 continue |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1099 ctx = repo[rev] |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1100 mf = ctx.manifest() |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1101 sparsematch = repo.maybesparsematch(ctx.rev()) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1102 for path in ctx.walk(match): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1103 if (not sparsematch or sparsematch(path)) and path in mf: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1104 allfiles.append((path, hex(mf[path]))) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1105 repo.fileservice.prefetch(allfiles) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1106 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1107 |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1108 @command( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1109 b'debugremotefilelog', |
45942
89a2afe31e82
formating: upgrade to black 20.8b1
Augie Fackler <raf@durin42.com>
parents:
45651
diff
changeset
|
1110 [ |
89a2afe31e82
formating: upgrade to black 20.8b1
Augie Fackler <raf@durin42.com>
parents:
45651
diff
changeset
|
1111 (b'd', b'decompress', None, _(b'decompress the filelog first')), |
89a2afe31e82
formating: upgrade to black 20.8b1
Augie Fackler <raf@durin42.com>
parents:
45651
diff
changeset
|
1112 ], |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1113 _(b'hg debugremotefilelog <path>'), |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1114 norepo=True, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1115 ) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1116 def debugremotefilelog(ui, path, **opts): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1117 return debugcommands.debugremotefilelog(ui, path, **opts) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1118 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1119 |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1120 @command( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1121 b'verifyremotefilelog', |
45942
89a2afe31e82
formating: upgrade to black 20.8b1
Augie Fackler <raf@durin42.com>
parents:
45651
diff
changeset
|
1122 [ |
89a2afe31e82
formating: upgrade to black 20.8b1
Augie Fackler <raf@durin42.com>
parents:
45651
diff
changeset
|
1123 (b'd', b'decompress', None, _(b'decompress the filelogs first')), |
89a2afe31e82
formating: upgrade to black 20.8b1
Augie Fackler <raf@durin42.com>
parents:
45651
diff
changeset
|
1124 ], |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1125 _(b'hg verifyremotefilelogs <directory>'), |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1126 norepo=True, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1127 ) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1128 def verifyremotefilelog(ui, path, **opts): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1129 return debugcommands.verifyremotefilelog(ui, path, **opts) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1130 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1131 |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1132 @command( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1133 b'debugdatapack', |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1134 [ |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1135 (b'', b'long', None, _(b'print the long hashes')), |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1136 (b'', b'node', b'', _(b'dump the contents of node'), b'NODE'), |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1137 ], |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1138 _(b'hg debugdatapack <paths>'), |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1139 norepo=True, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1140 ) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1141 def debugdatapack(ui, *paths, **opts): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1142 return debugcommands.debugdatapack(ui, *paths, **opts) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1143 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1144 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1145 @command(b'debughistorypack', [], _(b'hg debughistorypack <path>'), norepo=True) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1146 def debughistorypack(ui, path, **opts): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1147 return debugcommands.debughistorypack(ui, path) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1148 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1149 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1150 @command(b'debugkeepset', [], _(b'hg debugkeepset')) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1151 def debugkeepset(ui, repo, **opts): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1152 # The command is used to measure keepset computation time |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1153 def keyfn(fname, fnode): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1154 return fileserverclient.getcachekey(repo.name, fname, hex(fnode)) |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1155 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1156 repackmod.keepset(repo, keyfn) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1157 return |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1158 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1159 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1160 @command(b'debugwaitonrepack', [], _(b'hg debugwaitonrepack')) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1161 def debugwaitonrepack(ui, repo, **opts): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1162 return debugcommands.debugwaitonrepack(repo) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1163 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1164 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1165 @command(b'debugwaitonprefetch', [], _(b'hg debugwaitonprefetch')) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1166 def debugwaitonprefetch(ui, repo, **opts): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1167 return debugcommands.debugwaitonprefetch(repo) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1168 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1169 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1170 def resolveprefetchopts(ui, opts): |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1171 if not opts.get(b'rev'): |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1172 revset = [b'.', b'draft()'] |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1173 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1174 prefetchrevset = ui.config(b'remotefilelog', b'pullprefetch', None) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1175 if prefetchrevset: |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1176 revset.append(b'(%s)' % prefetchrevset) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1177 bgprefetchrevs = ui.config(b'remotefilelog', b'bgprefetchrevs', None) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1178 if bgprefetchrevs: |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1179 revset.append(b'(%s)' % bgprefetchrevs) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1180 revset = b'+'.join(revset) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1181 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1182 # update a revset with a date limit |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1183 revset = revdatelimit(ui, revset) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1184 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1185 opts[b'rev'] = [revset] |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1186 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1187 if not opts.get(b'base'): |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1188 opts[b'base'] = None |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1189 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1190 return opts |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1191 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1192 |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1193 @command( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1194 b'prefetch', |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1195 [ |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1196 (b'r', b'rev', [], _(b'prefetch the specified revisions'), _(b'REV')), |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1197 (b'', b'repack', False, _(b'run repack after prefetch')), |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1198 (b'b', b'base', b'', _(b"rev that is assumed to already be local")), |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1199 ] |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1200 + commands.walkopts, |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1201 _(b'hg prefetch [OPTIONS] [FILE...]'), |
43181
5ff32fdf0b0b
help: adding a help category to narrow and remotefilelog commands
Rodrigo Damazio <rdamazio@google.com>
parents:
43117
diff
changeset
|
1202 helpcategory=command.CATEGORY_MAINTENANCE, |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1203 ) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1204 def prefetch(ui, repo, *pats, **opts): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1205 """prefetch file revisions from the server |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1206 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1207 Prefetchs file revisions for the specified revs and stores them in the |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1208 local remotefilelog cache. If no rev is specified, the default rev is |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1209 used which is the union of dot, draft, pullprefetch and bgprefetchrev. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1210 File names or patterns can be used to limit which files are downloaded. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1211 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1212 Return 0 on success. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1213 """ |
40610
13d4ad8d7801
py3: fix keyword arguments handling in hgext/remotefilelog/
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40577
diff
changeset
|
1214 opts = pycompat.byteskwargs(opts) |
40514
6f0b6905ef6f
shallowutil: introduce a helper function isenabled()
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40513
diff
changeset
|
1215 if not isenabled(repo): |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1216 raise error.Abort(_(b"repo is not shallow")) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1217 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1218 opts = resolveprefetchopts(ui, opts) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1219 revs = scmutil.revrange(repo, opts.get(b'rev')) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1220 repo.prefetch(revs, opts.get(b'base'), pats, opts) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1221 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1222 # Run repack in background |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1223 if opts.get(b'repack'): |
43854
612b4b63fb22
remotefilelog: remove the `ensurestart` usage
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43849
diff
changeset
|
1224 repackmod.backgroundrepack(repo, incremental=True) |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1225 |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1226 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1227 @command( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1228 b'repack', |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1229 [ |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1230 (b'', b'background', None, _(b'run in a background process'), None), |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1231 (b'', b'incremental', None, _(b'do an incremental repack'), None), |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1232 ( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1233 b'', |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1234 b'packsonly', |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1235 None, |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1236 _(b'only repack packs (skip loose objects)'), |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1237 None, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1238 ), |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1239 ], |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1240 _(b'hg repack [OPTIONS]'), |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1241 ) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1242 def repack_(ui, repo, *pats, **opts): |
43506
9f70512ae2cf
cleanup: remove pointless r-prefixes on single-quoted strings
Augie Fackler <augie@google.com>
parents:
43181
diff
changeset
|
1243 if opts.get('background'): |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1244 repackmod.backgroundrepack( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1245 repo, |
43506
9f70512ae2cf
cleanup: remove pointless r-prefixes on single-quoted strings
Augie Fackler <augie@google.com>
parents:
43181
diff
changeset
|
1246 incremental=opts.get('incremental'), |
9f70512ae2cf
cleanup: remove pointless r-prefixes on single-quoted strings
Augie Fackler <augie@google.com>
parents:
43181
diff
changeset
|
1247 packsonly=opts.get('packsonly', False), |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42842
diff
changeset
|
1248 ) |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1249 return |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1250 |
43506
9f70512ae2cf
cleanup: remove pointless r-prefixes on single-quoted strings
Augie Fackler <augie@google.com>
parents:
43181
diff
changeset
|
1251 options = {b'packsonly': opts.get('packsonly')} |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1252 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1253 try: |
43506
9f70512ae2cf
cleanup: remove pointless r-prefixes on single-quoted strings
Augie Fackler <augie@google.com>
parents:
43181
diff
changeset
|
1254 if opts.get('incremental'): |
40495
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1255 repackmod.incrementalrepack(repo, options=options) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1256 else: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1257 repackmod.fullrepack(repo, options=options) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1258 except repackmod.RepackAlreadyRunning as ex: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1259 # Don't propogate the exception if the repack is already in |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1260 # progress, since we want the command to exit 0. |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1261 repo.ui.warn(b'%s\n' % ex) |