Mercurial > hg-stable
annotate hgext/remotefilelog/__init__.py @ 42852:2c74337e6483
remotefilelog: reduce probability of race-condition in remotefilelog tests
ca1014ad3de4 introduced a new parameter `ensurestart` to speed up
remotefilelog background processes start. Unfortunately it seems to have
increased the possibility of race-conditions in remotefilelog tests testing
those background processes.
With `ensurestart=False`, it seems that it's more probable to enter in a race
condition with `debugwaitonprefetch` and `debugwaitonrepack` in remotefilelog
background tests. Our CI seems to have a high probability of triggering this
race condition so make it configurable to ensure tests are stable.
Differential Revision: https://phab.mercurial-scm.org/D6772
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Wed, 28 Aug 2019 16:01:16 +0200 |
parents | 9f2189b6bf2a |
children | 2372284d9457 |
rev | line source |
---|---|
40545
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 |
40562
b35a096b9bff
remotefilelog: add some docstring
Augie Fackler <augie@google.com>
parents:
40560
diff
changeset
|
9 This extension is HIGHLY EXPERIMENTAL. There are NO BACKWARDS COMPATIBILITY |
b35a096b9bff
remotefilelog: add some docstring
Augie Fackler <augie@google.com>
parents:
40560
diff
changeset
|
10 GUARANTEES. This means that repositories created with this extension may |
b35a096b9bff
remotefilelog: add some docstring
Augie Fackler <augie@google.com>
parents:
40560
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:
40560
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:
40560
diff
changeset
|
13 corruption. |
b35a096b9bff
remotefilelog: add some docstring
Augie Fackler <augie@google.com>
parents:
40560
diff
changeset
|
14 |
b35a096b9bff
remotefilelog: add some docstring
Augie Fackler <augie@google.com>
parents:
40560
diff
changeset
|
15 remotefilelog works by fetching file contents lazily and storing them |
b35a096b9bff
remotefilelog: add some docstring
Augie Fackler <augie@google.com>
parents:
40560
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:
40560
diff
changeset
|
17 histories to be transferred only partially, making them easier to |
b35a096b9bff
remotefilelog: add some docstring
Augie Fackler <augie@google.com>
parents:
40560
diff
changeset
|
18 operate on. |
b35a096b9bff
remotefilelog: add some docstring
Augie Fackler <augie@google.com>
parents:
40560
diff
changeset
|
19 |
40545
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 |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
23 |
40545
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 |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
25 |
40545
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) |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
28 |
40545
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 |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
30 |
40545
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. |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
33 |
40545
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 |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
35 |
40545
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 |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
38 |
40545
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 |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
40 |
40545
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. |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
43 |
40545
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 |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
46 |
40545
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. |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
50 |
40545
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). |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
55 |
40545
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. |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
58 |
40545
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. |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
61 |
40545
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. |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
64 |
40545
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. |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
68 |
40545
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 |
40771
32a23c3f56d4
remotefilelog: fix typo in docstring
Augie Fackler <augie@google.com>
parents:
40657
diff
changeset
|
70 each generation of the history pack files. For example, list [ |
40545
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). |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
73 |
40545
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. |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
76 |
40545
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. |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
79 |
40545
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. |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
82 |
40545
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 |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
85 |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
86 ``remotefilelog.cachepath`` path to cache |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
87 |
40545
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 |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
90 |
40545
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 |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
92 |
40545
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 |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
94 |
40545
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 |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
96 |
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
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:
40564
diff
changeset
|
98 |
40545
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 |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
101 |
40545
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 |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
103 |
40545
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 |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
106 |
40545
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 |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
109 |
40545
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. |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
112 |
40545
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 |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
114 |
40545
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 |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
116 |
40545
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 |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
119 |
40545
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 |
40595
040447dc3c62
remotefilelog: fix various whitespace issues in docstring
Augie Fackler <augie@google.com>
parents:
40564
diff
changeset
|
122 |
40545
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 from __future__ import absolute_import |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
128 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
129 import os |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
130 import time |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
131 import traceback |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
132 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
133 from mercurial.node import hex |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
134 from mercurial.i18n import _ |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
135 from mercurial import ( |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
136 changegroup, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
137 changelog, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
138 cmdutil, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
139 commands, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
140 configitems, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
141 context, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
142 copies, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
143 debugcommands as hgdebugcommands, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
144 dispatch, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
145 error, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
146 exchange, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
147 extensions, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
148 hg, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
149 localrepo, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
150 match, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
151 merge, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
152 node as nodemod, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
153 patch, |
40657
13d4ad8d7801
py3: fix keyword arguments handling in hgext/remotefilelog/
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40624
diff
changeset
|
154 pycompat, |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
155 registrar, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
156 repair, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
157 repoview, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
158 revset, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
159 scmutil, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
160 smartset, |
40563
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40562
diff
changeset
|
161 streamclone, |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
162 util, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
163 ) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
164 from . import ( |
40558
354acd0dc637
remotefilelog: rename capability for legacy ssh file fetching method
Augie Fackler <augie@google.com>
parents:
40552
diff
changeset
|
165 constants, |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
166 debugcommands, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
167 fileserverclient, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
168 remotefilectx, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
169 remotefilelog, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
170 remotefilelogserver, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
171 repack as repackmod, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
172 shallowbundle, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
173 shallowrepo, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
174 shallowstore, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
175 shallowutil, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
176 shallowverifier, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
177 ) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
178 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
179 # ensures debug commands are registered |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
180 hgdebugcommands.command |
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 cmdtable = {} |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
183 command = registrar.command(cmdtable) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
184 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
185 configtable = {} |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
186 configitem = registrar.configitem(configtable) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
187 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
188 configitem('remotefilelog', 'debug', default=False) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
189 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
190 configitem('remotefilelog', 'reponame', default='') |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
191 configitem('remotefilelog', 'cachepath', default=None) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
192 configitem('remotefilelog', 'cachegroup', default=None) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
193 configitem('remotefilelog', 'cacheprocess', default=None) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
194 configitem('remotefilelog', 'cacheprocess.includepath', default=None) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
195 configitem("remotefilelog", "cachelimit", default="1000 GB") |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
196 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
197 configitem('remotefilelog', 'fallbackpath', default=configitems.dynamicdefault, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
198 alias=[('remotefilelog', 'fallbackrepo')]) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
199 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
200 configitem('remotefilelog', 'validatecachelog', default=None) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
201 configitem('remotefilelog', 'validatecache', default='on') |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
202 configitem('remotefilelog', 'server', default=None) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
203 configitem('remotefilelog', 'servercachepath', default=None) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
204 configitem("remotefilelog", "serverexpiration", default=30) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
205 configitem('remotefilelog', 'backgroundrepack', default=False) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
206 configitem('remotefilelog', 'bgprefetchrevs', default=None) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
207 configitem('remotefilelog', 'pullprefetch', default=None) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
208 configitem('remotefilelog', 'backgroundprefetch', default=False) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
209 configitem('remotefilelog', 'prefetchdelay', default=120) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
210 configitem('remotefilelog', 'prefetchdays', default=14) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
211 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
212 configitem('remotefilelog', 'getfilesstep', default=10000) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
213 configitem('remotefilelog', 'getfilestype', default='optimistic') |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
214 configitem('remotefilelog', 'batchsize', configitems.dynamicdefault) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
215 configitem('remotefilelog', 'fetchwarning', default='') |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
216 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
217 configitem('remotefilelog', 'includepattern', default=None) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
218 configitem('remotefilelog', 'excludepattern', default=None) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
219 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
220 configitem('remotefilelog', 'gcrepack', default=False) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
221 configitem('remotefilelog', 'repackonhggc', default=False) |
42776
9f2189b6bf2a
config: add experimental argument to the config registrar
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
42515
diff
changeset
|
222 configitem('repack', 'chainorphansbysize', default=True, experimental=True) |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
223 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
224 configitem('packs', 'maxpacksize', default=0) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
225 configitem('packs', 'maxchainlen', default=1000) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
226 |
42852
2c74337e6483
remotefilelog: reduce probability of race-condition in remotefilelog tests
Boris Feld <boris.feld@octobus.net>
parents:
42776
diff
changeset
|
227 configitem('devel', 'remotefilelog.ensurestart', default=False) |
2c74337e6483
remotefilelog: reduce probability of race-condition in remotefilelog tests
Boris Feld <boris.feld@octobus.net>
parents:
42776
diff
changeset
|
228 |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
229 # default TTL limit is 30 days |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
230 _defaultlimit = 60 * 60 * 24 * 30 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
231 configitem('remotefilelog', 'nodettl', default=_defaultlimit) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
232 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
233 configitem('remotefilelog', 'data.gencountlimit', default=2), |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
234 configitem('remotefilelog', 'data.generations', |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
235 default=['1GB', '100MB', '1MB']) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
236 configitem('remotefilelog', 'data.maxrepackpacks', default=50) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
237 configitem('remotefilelog', 'data.repackmaxpacksize', default='4GB') |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
238 configitem('remotefilelog', 'data.repacksizelimit', default='100MB') |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
239 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
240 configitem('remotefilelog', 'history.gencountlimit', default=2), |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
241 configitem('remotefilelog', 'history.generations', default=['100MB']) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
242 configitem('remotefilelog', 'history.maxrepackpacks', default=50) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
243 configitem('remotefilelog', 'history.repackmaxpacksize', default='400MB') |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
244 configitem('remotefilelog', 'history.repacksizelimit', default='100MB') |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
245 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
246 # 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
|
247 # 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
|
248 # 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
|
249 # leave the attribute unspecified. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
250 testedwith = 'ships-with-hg-core' |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
251 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
252 repoclass = localrepo.localrepository |
40560
fc2766860796
remotefilelog: consolidate and rename on-disk store requirement
Augie Fackler <augie@google.com>
parents:
40559
diff
changeset
|
253 repoclass._basesupported.add(constants.SHALLOWREPO_REQUIREMENT) |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
254 |
40564
6f0b6905ef6f
shallowutil: introduce a helper function isenabled()
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40563
diff
changeset
|
255 isenabled = shallowutil.isenabled |
6f0b6905ef6f
shallowutil: introduce a helper function isenabled()
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40563
diff
changeset
|
256 |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
257 def uisetup(ui): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
258 """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
|
259 versions. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
260 """ |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
261 hg.wirepeersetupfuncs.append(fileserverclient.peersetup) |
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 entry = extensions.wrapcommand(commands.table, 'clone', cloneshallow) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
264 entry[1].append(('', 'shallow', None, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
265 _("create a shallow clone which uses remote file " |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
266 "history"))) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
267 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
268 extensions.wrapcommand(commands.table, 'debugindex', |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
269 debugcommands.debugindex) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
270 extensions.wrapcommand(commands.table, 'debugindexdot', |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
271 debugcommands.debugindexdot) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
272 extensions.wrapcommand(commands.table, 'log', log) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
273 extensions.wrapcommand(commands.table, 'pull', pull) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
274 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
275 # Prevent 'hg manifest --all' |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
276 def _manifest(orig, ui, repo, *args, **opts): |
40657
13d4ad8d7801
py3: fix keyword arguments handling in hgext/remotefilelog/
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40624
diff
changeset
|
277 if (isenabled(repo) and opts.get(r'all')): |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
278 raise error.Abort(_("--all is not supported in a shallow repo")) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
279 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
280 return orig(ui, repo, *args, **opts) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
281 extensions.wrapcommand(commands.table, "manifest", _manifest) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
282 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
283 # Wrap remotefilelog with lfs code |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
284 def _lfsloaded(loaded=False): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
285 lfsmod = None |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
286 try: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
287 lfsmod = extensions.find('lfs') |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
288 except KeyError: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
289 pass |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
290 if lfsmod: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
291 lfsmod.wrapfilelog(remotefilelog.remotefilelog) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
292 fileserverclient._lfsmod = lfsmod |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
293 extensions.afterloaded('lfs', _lfsloaded) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
294 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
295 # debugdata needs remotefilelog.len to work |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
296 extensions.wrapcommand(commands.table, 'debugdata', debugdatashallow) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
297 |
42301
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42300
diff
changeset
|
298 changegroup.cgpacker = shallowbundle.shallowcg1packer |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42300
diff
changeset
|
299 |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42300
diff
changeset
|
300 extensions.wrapfunction(changegroup, '_addchangegroupfiles', |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42300
diff
changeset
|
301 shallowbundle.addchangegroupfiles) |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42300
diff
changeset
|
302 extensions.wrapfunction( |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42300
diff
changeset
|
303 changegroup, 'makechangegroup', shallowbundle.makechangegroup) |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42300
diff
changeset
|
304 extensions.wrapfunction(localrepo, 'makestore', storewrapper) |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42300
diff
changeset
|
305 extensions.wrapfunction(exchange, 'pull', exchangepull) |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42300
diff
changeset
|
306 extensions.wrapfunction(merge, 'applyupdates', applyupdates) |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42300
diff
changeset
|
307 extensions.wrapfunction(merge, '_checkunknownfiles', checkunknownfiles) |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42300
diff
changeset
|
308 extensions.wrapfunction(context.workingctx, '_checklookup', checklookup) |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42300
diff
changeset
|
309 extensions.wrapfunction(scmutil, '_findrenames', findrenames) |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42300
diff
changeset
|
310 extensions.wrapfunction(copies, '_computeforwardmissing', |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42300
diff
changeset
|
311 computeforwardmissing) |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42300
diff
changeset
|
312 extensions.wrapfunction(dispatch, 'runcommand', runcommand) |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42300
diff
changeset
|
313 extensions.wrapfunction(repair, '_collectbrokencsets', _collectbrokencsets) |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42300
diff
changeset
|
314 extensions.wrapfunction(context.changectx, 'filectx', filectx) |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42300
diff
changeset
|
315 extensions.wrapfunction(context.workingctx, 'filectx', workingfilectx) |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42300
diff
changeset
|
316 extensions.wrapfunction(patch, 'trydiff', trydiff) |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42300
diff
changeset
|
317 extensions.wrapfunction(hg, 'verify', _verify) |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42300
diff
changeset
|
318 scmutil.fileprefetchhooks.add('remotefilelog', _fileprefetchhook) |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42300
diff
changeset
|
319 |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42300
diff
changeset
|
320 # disappointing hacks below |
42514
f93762f251d2
remotefilelog: check if RFL is enabled in getrenamedfn() override
Martin von Zweigbergk <martinvonz@google.com>
parents:
42488
diff
changeset
|
321 extensions.wrapfunction(scmutil, 'getrenamedfn', getrenamedfn) |
42301
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42300
diff
changeset
|
322 extensions.wrapfunction(revset, 'filelog', filelogrevset) |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42300
diff
changeset
|
323 revset.symbols['filelog'] = revset.filelog |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42300
diff
changeset
|
324 extensions.wrapfunction(cmdutil, 'walkfilerevs', walkfilerevs) |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42300
diff
changeset
|
325 |
8a0e03f7baf4
remotefilelog: move most setup from onetimesetup() to uisetup()
Martin von Zweigbergk <martinvonz@google.com>
parents:
42300
diff
changeset
|
326 |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
327 def cloneshallow(orig, ui, repo, *args, **opts): |
40657
13d4ad8d7801
py3: fix keyword arguments handling in hgext/remotefilelog/
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40624
diff
changeset
|
328 if opts.get(r'shallow'): |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
329 repos = [] |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
330 def pull_shallow(orig, self, *args, **kwargs): |
40564
6f0b6905ef6f
shallowutil: introduce a helper function isenabled()
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40563
diff
changeset
|
331 if not isenabled(self): |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
332 repos.append(self.unfiltered()) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
333 # 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
|
334 setupclient(self.ui, self.unfiltered()) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
335 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
336 # 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
|
337 # 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
|
338 if isinstance(self, repoview.repoview): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
339 self.__class__.__bases__ = (self.__class__.__bases__[0], |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
340 self.unfiltered().__class__) |
40560
fc2766860796
remotefilelog: consolidate and rename on-disk store requirement
Augie Fackler <augie@google.com>
parents:
40559
diff
changeset
|
341 self.requirements.add(constants.SHALLOWREPO_REQUIREMENT) |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
342 self._writerequirements() |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
343 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
344 # 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
|
345 # 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
|
346 return exchangepull(orig, self, *args, **kwargs) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
347 else: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
348 return orig(self, *args, **kwargs) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
349 extensions.wrapfunction(exchange, 'pull', pull_shallow) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
350 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
351 # 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
|
352 # patterns around. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
353 def setup_streamout(repo, remote): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
354 # 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
|
355 # patterns. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
356 def stream_out_shallow(orig): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
357 caps = remote.capabilities() |
40558
354acd0dc637
remotefilelog: rename capability for legacy ssh file fetching method
Augie Fackler <augie@google.com>
parents:
40552
diff
changeset
|
358 if constants.NETWORK_CAP_LEGACY_SSH_GETFILES in caps: |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
359 opts = {} |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
360 if repo.includepattern: |
40657
13d4ad8d7801
py3: fix keyword arguments handling in hgext/remotefilelog/
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40624
diff
changeset
|
361 opts[r'includepattern'] = '\0'.join(repo.includepattern) |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
362 if repo.excludepattern: |
40657
13d4ad8d7801
py3: fix keyword arguments handling in hgext/remotefilelog/
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40624
diff
changeset
|
363 opts[r'excludepattern'] = '\0'.join(repo.excludepattern) |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
364 return remote._callstream('stream_out_shallow', **opts) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
365 else: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
366 return orig() |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
367 extensions.wrapfunction(remote, 'stream_out', stream_out_shallow) |
40563
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40562
diff
changeset
|
368 def stream_wrap(orig, op): |
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40562
diff
changeset
|
369 setup_streamout(op.repo, op.remote) |
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40562
diff
changeset
|
370 return orig(op) |
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40562
diff
changeset
|
371 extensions.wrapfunction( |
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40562
diff
changeset
|
372 streamclone, 'maybeperformlegacystreamclone', stream_wrap) |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
373 |
40563
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40562
diff
changeset
|
374 def canperformstreamclone(orig, pullop, bundle2=False): |
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40562
diff
changeset
|
375 # remotefilelog is currently incompatible with the |
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40562
diff
changeset
|
376 # 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:
40562
diff
changeset
|
377 # v1 instead. |
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40562
diff
changeset
|
378 if 'v2' in pullop.remotebundle2caps.get('stream', []): |
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40562
diff
changeset
|
379 pullop.remotebundle2caps['stream'] = [ |
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40562
diff
changeset
|
380 c for c in pullop.remotebundle2caps['stream'] |
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40562
diff
changeset
|
381 if c != 'v2'] |
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40562
diff
changeset
|
382 if bundle2: |
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40562
diff
changeset
|
383 return False, None |
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40562
diff
changeset
|
384 supported, requirements = orig(pullop, bundle2=bundle2) |
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40562
diff
changeset
|
385 if requirements is not None: |
40560
fc2766860796
remotefilelog: consolidate and rename on-disk store requirement
Augie Fackler <augie@google.com>
parents:
40559
diff
changeset
|
386 requirements.add(constants.SHALLOWREPO_REQUIREMENT) |
40563
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40562
diff
changeset
|
387 return supported, requirements |
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40562
diff
changeset
|
388 extensions.wrapfunction( |
525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40562
diff
changeset
|
389 streamclone, 'canperformstreamclone', canperformstreamclone) |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
390 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
391 try: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
392 orig(ui, repo, *args, **opts) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
393 finally: |
40657
13d4ad8d7801
py3: fix keyword arguments handling in hgext/remotefilelog/
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40624
diff
changeset
|
394 if opts.get(r'shallow'): |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
395 for r in repos: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
396 if util.safehasattr(r, 'fileservice'): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
397 r.fileservice.close() |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
398 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
399 def debugdatashallow(orig, *args, **kwds): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
400 oldlen = remotefilelog.remotefilelog.__len__ |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
401 try: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
402 remotefilelog.remotefilelog.__len__ = lambda x: 1 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
403 return orig(*args, **kwds) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
404 finally: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
405 remotefilelog.remotefilelog.__len__ = oldlen |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
406 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
407 def reposetup(ui, repo): |
41061
c61b8dfb07c8
remotefilelog: use repo.local() instead of isinstance()
Matt Harbison <matt_harbison@yahoo.com>
parents:
40858
diff
changeset
|
408 if not repo.local(): |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
409 return |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
410 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
411 # put here intentionally bc doesnt work in uisetup |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
412 ui.setconfig('hooks', 'update.prefetch', wcpprefetch) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
413 ui.setconfig('hooks', 'commit.prefetch', wcpprefetch) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
414 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
415 isserverenabled = ui.configbool('remotefilelog', 'server') |
40564
6f0b6905ef6f
shallowutil: introduce a helper function isenabled()
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40563
diff
changeset
|
416 isshallowclient = isenabled(repo) |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
417 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
418 if isserverenabled and isshallowclient: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
419 raise RuntimeError("Cannot be both a server and shallow client.") |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
420 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
421 if isshallowclient: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
422 setupclient(ui, repo) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
423 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
424 if isserverenabled: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
425 remotefilelogserver.setupserver(ui, repo) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
426 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
427 def setupclient(ui, repo): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
428 if not isinstance(repo, localrepo.localrepository): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
429 return |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
430 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
431 # 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
|
432 # wireprotocol endpoints registered. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
433 remotefilelogserver.onetimesetup(ui) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
434 onetimeclientsetup(ui) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
435 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
436 shallowrepo.wraprepo(repo) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
437 repo.store = shallowstore.wrapstore(repo.store) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
438 |
42300
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
439 def storewrapper(orig, requirements, path, vfstype): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
440 s = orig(requirements, path, vfstype) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
441 if constants.SHALLOWREPO_REQUIREMENT in requirements: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
442 s = shallowstore.wrapstore(s) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
443 |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
444 return s |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
445 |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
446 # prefetch files before update |
42472
87a34c767384
merge: fix race that could cause wrong size in dirstate
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
42301
diff
changeset
|
447 def applyupdates(orig, repo, actions, wctx, mctx, overwrite, wantfiledata, |
87a34c767384
merge: fix race that could cause wrong size in dirstate
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
42301
diff
changeset
|
448 labels=None): |
42300
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
449 if isenabled(repo): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
450 manifest = mctx.manifest() |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
451 files = [] |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
452 for f, args, msg in actions['g']: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
453 files.append((f, hex(manifest[f]))) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
454 # 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:
42253
diff
changeset
|
455 repo.fileservice.prefetch(files) |
42472
87a34c767384
merge: fix race that could cause wrong size in dirstate
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
42301
diff
changeset
|
456 return orig(repo, actions, wctx, mctx, overwrite, wantfiledata, |
87a34c767384
merge: fix race that could cause wrong size in dirstate
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
42301
diff
changeset
|
457 labels=labels) |
42300
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
458 |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
459 # Prefetch merge checkunknownfiles |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
460 def checkunknownfiles(orig, repo, wctx, mctx, force, actions, |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
461 *args, **kwargs): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
462 if isenabled(repo): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
463 files = [] |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
464 sparsematch = repo.maybesparsematch(mctx.rev()) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
465 for f, (m, actionargs, msg) in actions.iteritems(): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
466 if sparsematch and not sparsematch(f): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
467 continue |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
468 if m in ('c', 'dc', 'cm'): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
469 files.append((f, hex(mctx.filenode(f)))) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
470 elif m == 'dg': |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
471 f2 = actionargs[0] |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
472 files.append((f2, hex(mctx.filenode(f2)))) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
473 # 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:
42253
diff
changeset
|
474 repo.fileservice.prefetch(files) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
475 return orig(repo, wctx, mctx, force, actions, *args, **kwargs) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
476 |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
477 # Prefetch files before status attempts to look at their size and contents |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
478 def checklookup(orig, self, files): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
479 repo = self._repo |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
480 if isenabled(repo): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
481 prefetchfiles = [] |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
482 for parent in self._parents: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
483 for f in files: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
484 if f in parent: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
485 prefetchfiles.append((f, hex(parent.filenode(f)))) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
486 # 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:
42253
diff
changeset
|
487 repo.fileservice.prefetch(prefetchfiles) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
488 return orig(self, files) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
489 |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
490 # 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:
42253
diff
changeset
|
491 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:
42253
diff
changeset
|
492 if isenabled(repo): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
493 files = [] |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
494 pmf = repo['.'].manifest() |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
495 for f in removed: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
496 if f in pmf: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
497 files.append((f, hex(pmf[f]))) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
498 # 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:
42253
diff
changeset
|
499 repo.fileservice.prefetch(files) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
500 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:
42253
diff
changeset
|
501 |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
502 # prefetch files before pathcopies check |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
503 def computeforwardmissing(orig, a, b, match=None): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
504 missing = orig(a, b, match=match) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
505 repo = a._repo |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
506 if isenabled(repo): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
507 mb = b.manifest() |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
508 |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
509 files = [] |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
510 sparsematch = repo.maybesparsematch(b.rev()) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
511 if sparsematch: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
512 sparsemissing = set() |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
513 for f in missing: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
514 if sparsematch(f): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
515 files.append((f, hex(mb[f]))) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
516 sparsemissing.add(f) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
517 missing = sparsemissing |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
518 |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
519 # 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:
42253
diff
changeset
|
520 repo.fileservice.prefetch(files) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
521 return missing |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
522 |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
523 # 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:
42253
diff
changeset
|
524 def runcommand(orig, lui, repo, *args, **kwargs): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
525 fileservice = None |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
526 # 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:
42253
diff
changeset
|
527 # - 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:
42253
diff
changeset
|
528 # - a norepo command like "help" is called |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
529 if repo and isenabled(repo): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
530 fileservice = repo.fileservice |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
531 try: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
532 return orig(lui, repo, *args, **kwargs) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
533 finally: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
534 if fileservice: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
535 fileservice.close() |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
536 |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
537 # prevent strip from stripping remotefilelogs |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
538 def _collectbrokencsets(orig, repo, files, striprev): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
539 if isenabled(repo): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
540 files = list([f for f in files if not repo.shallowmatch(f)]) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
541 return orig(repo, files, striprev) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
542 |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
543 # changectx wrappers |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
544 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:
42253
diff
changeset
|
545 if fileid is None: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
546 fileid = self.filenode(path) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
547 if (isenabled(self._repo) and self._repo.shallowmatch(path)): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
548 return remotefilectx.remotefilectx(self._repo, path, fileid=fileid, |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
549 changectx=self, filelog=filelog) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
550 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:
42253
diff
changeset
|
551 |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
552 def workingfilectx(orig, self, path, filelog=None): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
553 if (isenabled(self._repo) and self._repo.shallowmatch(path)): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
554 return remotefilectx.remoteworkingfilectx(self._repo, path, |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
555 workingctx=self, |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
556 filelog=filelog) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
557 return orig(self, path, filelog=filelog) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
558 |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
559 # prefetch required revisions before a diff |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
560 def trydiff(orig, repo, revs, ctx1, ctx2, modified, added, removed, |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
561 copy, getfilectx, *args, **kwargs): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
562 if isenabled(repo): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
563 prefetch = [] |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
564 mf1 = ctx1.manifest() |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
565 for fname in modified + added + removed: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
566 if fname in mf1: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
567 fnode = getfilectx(fname, ctx1).filenode() |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
568 # 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:
42253
diff
changeset
|
569 if fnode: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
570 prefetch.append((fname, hex(fnode))) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
571 if fname not in removed: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
572 fnode = getfilectx(fname, ctx2).filenode() |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
573 if fnode: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
574 prefetch.append((fname, hex(fnode))) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
575 |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
576 repo.fileservice.prefetch(prefetch) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
577 |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
578 return orig(repo, revs, ctx1, ctx2, modified, added, removed, copy, |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
579 getfilectx, *args, **kwargs) |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
580 |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
581 # Prevent verify from processing files |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
582 # a stub for mercurial.hg.verify() |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
583 def _verify(orig, repo, level=None): |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
584 lock = repo.lock() |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
585 try: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
586 return shallowverifier.shallowverifier(repo).verify() |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
587 finally: |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
588 lock.release() |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
589 |
651f325e4fdd
remotefilelog: move most functions in onetimeclientsetup() to top level
Martin von Zweigbergk <martinvonz@google.com>
parents:
42253
diff
changeset
|
590 |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
591 clientonetime = False |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
592 def onetimeclientsetup(ui): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
593 global clientonetime |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
594 if clientonetime: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
595 return |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
596 clientonetime = True |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
597 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
598 # 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
|
599 # is present in the filelog blob. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
600 # 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
|
601 # 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
|
602 pendingfilecommits = [] |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
603 def addrawrevision(orig, self, rawtext, transaction, link, p1, p2, node, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
604 flags, cachedelta=None, _metatuple=None): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
605 if isinstance(link, int): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
606 pendingfilecommits.append( |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
607 (self, rawtext, transaction, link, p1, p2, node, flags, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
608 cachedelta, _metatuple)) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
609 return node |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
610 else: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
611 return orig(self, rawtext, transaction, link, p1, p2, node, flags, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
612 cachedelta, _metatuple=_metatuple) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
613 extensions.wrapfunction( |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
614 remotefilelog.remotefilelog, 'addrawrevision', addrawrevision) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
615 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
616 def changelogadd(orig, self, *args): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
617 oldlen = len(self) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
618 node = orig(self, *args) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
619 newlen = len(self) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
620 if oldlen != newlen: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
621 for oldargs in pendingfilecommits: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
622 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
|
623 linknode = self.node(link) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
624 if linknode == node: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
625 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
|
626 else: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
627 raise error.ProgrammingError( |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
628 'pending multiple integer revisions are not supported') |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
629 else: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
630 # "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
|
631 # 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
|
632 # but still do a sanity check about pending multiple revisions |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
633 if len(set(x[3] for x in pendingfilecommits)) > 1: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
634 raise error.ProgrammingError( |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
635 'pending multiple integer revisions are not supported') |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
636 del pendingfilecommits[:] |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
637 return node |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
638 extensions.wrapfunction(changelog.changelog, 'add', changelogadd) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
639 |
42514
f93762f251d2
remotefilelog: check if RFL is enabled in getrenamedfn() override
Martin von Zweigbergk <martinvonz@google.com>
parents:
42488
diff
changeset
|
640 def getrenamedfn(orig, repo, endrev=None): |
42515
e387cb22f6c0
remotefilelog: handle copies in changesets in getrenamedfn() override
Martin von Zweigbergk <martinvonz@google.com>
parents:
42514
diff
changeset
|
641 if not isenabled(repo) or copies.usechangesetcentricalgo(repo): |
42514
f93762f251d2
remotefilelog: check if RFL is enabled in getrenamedfn() override
Martin von Zweigbergk <martinvonz@google.com>
parents:
42488
diff
changeset
|
642 return orig(repo, endrev) |
f93762f251d2
remotefilelog: check if RFL is enabled in getrenamedfn() override
Martin von Zweigbergk <martinvonz@google.com>
parents:
42488
diff
changeset
|
643 |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
644 rcache = {} |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
645 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
646 def getrenamed(fn, rev): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
647 '''looks up all renames for a file (up to endrev) the first |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
648 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
|
649 parses the manifest if linkrev != changerev. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
650 Returns rename info for fn at changerev rev.''' |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
651 if rev in rcache.setdefault(fn, {}): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
652 return rcache[fn][rev] |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
653 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
654 try: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
655 fctx = repo[rev].filectx(fn) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
656 for ancestor in fctx.ancestors(): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
657 if ancestor.path() == fn: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
658 renamed = ancestor.renamed() |
41192
2338eab5f8b7
remotefilelog: fix {file_copies} template keyword
Martin von Zweigbergk <martinvonz@google.com>
parents:
41061
diff
changeset
|
659 rcache[fn][ancestor.rev()] = renamed and renamed[0] |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
660 |
41192
2338eab5f8b7
remotefilelog: fix {file_copies} template keyword
Martin von Zweigbergk <martinvonz@google.com>
parents:
41061
diff
changeset
|
661 renamed = fctx.renamed() |
2338eab5f8b7
remotefilelog: fix {file_copies} template keyword
Martin von Zweigbergk <martinvonz@google.com>
parents:
41061
diff
changeset
|
662 return renamed and renamed[0] |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
663 except error.LookupError: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
664 return None |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
665 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
666 return getrenamed |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
667 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
668 def walkfilerevs(orig, repo, match, follow, revs, fncache): |
40564
6f0b6905ef6f
shallowutil: introduce a helper function isenabled()
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40563
diff
changeset
|
669 if not isenabled(repo): |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
670 return orig(repo, match, follow, revs, fncache) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
671 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
672 # remotefilelog's can't be walked in rev order, so throw. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
673 # The caller will see the exception and walk the commit tree instead. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
674 if not follow: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
675 raise cmdutil.FileWalkError("Cannot walk via filelog") |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
676 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
677 wanted = set() |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
678 minrev, maxrev = min(revs), max(revs) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
679 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
680 pctx = repo['.'] |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
681 for filename in match.files(): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
682 if filename not in pctx: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
683 raise error.Abort(_('cannot follow file not in parent ' |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
684 'revision: "%s"') % filename) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
685 fctx = pctx[filename] |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
686 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
687 linkrev = fctx.linkrev() |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
688 if linkrev >= minrev and linkrev <= maxrev: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
689 fncache.setdefault(linkrev, []).append(filename) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
690 wanted.add(linkrev) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
691 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
692 for ancestor in fctx.ancestors(): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
693 linkrev = ancestor.linkrev() |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
694 if linkrev >= minrev and linkrev <= maxrev: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
695 fncache.setdefault(linkrev, []).append(ancestor.path()) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
696 wanted.add(linkrev) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
697 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
698 return wanted |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
699 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
700 def filelogrevset(orig, repo, subset, x): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
701 """``filelog(pattern)`` |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
702 Changesets connected to the specified filelog. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
703 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
704 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
|
705 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
|
706 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
|
707 """ |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
708 |
40564
6f0b6905ef6f
shallowutil: introduce a helper function isenabled()
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40563
diff
changeset
|
709 if not isenabled(repo): |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
710 return orig(repo, subset, x) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
711 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
712 # i18n: "filelog" is a keyword |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
713 pat = revset.getstring(x, _("filelog requires a pattern")) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
714 m = match.match(repo.root, repo.getcwd(), [pat], default='relpath', |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
715 ctx=repo[None]) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
716 s = set() |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
717 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
718 if not match.patkind(pat): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
719 # slow |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
720 for r in subset: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
721 ctx = repo[r] |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
722 cfiles = ctx.files() |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
723 for f in m.files(): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
724 if f in cfiles: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
725 s.add(ctx.rev()) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
726 break |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
727 else: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
728 # partial |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
729 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
|
730 for f in files: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
731 fctx = repo[None].filectx(f) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
732 s.add(fctx.linkrev()) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
733 for actx in fctx.ancestors(): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
734 s.add(actx.linkrev()) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
735 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
736 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
|
737 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
738 @command('gc', [], _('hg gc [REPO...]'), norepo=True) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
739 def gc(ui, *args, **opts): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
740 '''garbage collect the client and server filelog caches |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
741 ''' |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
742 cachepaths = set() |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
743 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
744 # get the system client cache |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
745 systemcache = shallowutil.getcachepath(ui, allowempty=True) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
746 if systemcache: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
747 cachepaths.add(systemcache) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
748 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
749 # get repo client and server cache |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
750 repopaths = [] |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
751 pwd = ui.environ.get('PWD') |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
752 if pwd: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
753 repopaths.append(pwd) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
754 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
755 repopaths.extend(args) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
756 repos = [] |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
757 for repopath in repopaths: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
758 try: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
759 repo = hg.peer(ui, {}, repopath) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
760 repos.append(repo) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
761 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
762 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
|
763 if repocache: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
764 cachepaths.add(repocache) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
765 except error.RepoError: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
766 pass |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
767 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
768 # gc client cache |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
769 for cachepath in cachepaths: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
770 gcclient(ui, cachepath) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
771 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
772 # gc server cache |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
773 for repo in repos: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
774 remotefilelogserver.gcserver(ui, repo._repo) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
775 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
776 def gcclient(ui, cachepath): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
777 # get list of repos that use this cache |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
778 repospath = os.path.join(cachepath, 'repos') |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
779 if not os.path.exists(repospath): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
780 ui.warn(_("no known cache at %s\n") % cachepath) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
781 return |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
782 |
41248
312afd164009
remotefilelog: do file IO in terms of bytes
Augie Fackler <augie@google.com>
parents:
41192
diff
changeset
|
783 reposfile = open(repospath, 'rb') |
42057
566daffc607d
cleanup: use set literals where possible
Martin von Zweigbergk <martinvonz@google.com>
parents:
41790
diff
changeset
|
784 repos = {r[:-1] for r in reposfile.readlines()} |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
785 reposfile.close() |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
786 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
787 # build list of useful files |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
788 validrepos = [] |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
789 keepkeys = set() |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
790 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
791 sharedcache = None |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
792 filesrepacked = False |
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 count = 0 |
40858
05afb32e9380
remotefilelog: use progress helper when analyzing repos
Martin von Zweigbergk <martinvonz@google.com>
parents:
40771
diff
changeset
|
795 progress = ui.makeprogress(_("analyzing repositories"), unit="repos", |
05afb32e9380
remotefilelog: use progress helper when analyzing repos
Martin von Zweigbergk <martinvonz@google.com>
parents:
40771
diff
changeset
|
796 total=len(repos)) |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
797 for path in repos: |
40858
05afb32e9380
remotefilelog: use progress helper when analyzing repos
Martin von Zweigbergk <martinvonz@google.com>
parents:
40771
diff
changeset
|
798 progress.update(count) |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
799 count += 1 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
800 try: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
801 path = ui.expandpath(os.path.normpath(path)) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
802 except TypeError as e: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
803 ui.warn(_("warning: malformed path: %r:%s\n") % (path, e)) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
804 traceback.print_exc() |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
805 continue |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
806 try: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
807 peer = hg.peer(ui, {}, path) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
808 repo = peer._repo |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
809 except error.RepoError: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
810 continue |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
811 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
812 validrepos.append(path) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
813 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
814 # 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
|
815 # 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
|
816 # and too much be deleted, than the loop fail and nothing gets deleted. |
40564
6f0b6905ef6f
shallowutil: introduce a helper function isenabled()
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40563
diff
changeset
|
817 if not isenabled(repo): |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
818 continue |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
819 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
820 if not util.safehasattr(repo, 'name'): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
821 ui.warn(_("repo %s is a misconfigured remotefilelog repo\n") % path) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
822 continue |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
823 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
824 # 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
|
825 # 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
|
826 # Otherwise regular garbage collection is performed. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
827 repackonhggc = repo.ui.configbool('remotefilelog', 'repackonhggc') |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
828 gcrepack = repo.ui.configbool('remotefilelog', 'gcrepack') |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
829 if repackonhggc and gcrepack: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
830 try: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
831 repackmod.incrementalrepack(repo) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
832 filesrepacked = True |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
833 continue |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
834 except (IOError, repackmod.RepackAlreadyRunning): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
835 # 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
|
836 # 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
|
837 pass |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
838 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
839 reponame = repo.name |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
840 if not sharedcache: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
841 sharedcache = repo.sharedstore |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
842 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
843 # 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
|
844 def keyfn(fname, fnode): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
845 return fileserverclient.getcachekey(reponame, fname, hex(fnode)) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
846 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
|
847 |
40858
05afb32e9380
remotefilelog: use progress helper when analyzing repos
Martin von Zweigbergk <martinvonz@google.com>
parents:
40771
diff
changeset
|
848 progress.complete() |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
849 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
850 # write list of valid repos back |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
851 oldumask = os.umask(0o002) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
852 try: |
41248
312afd164009
remotefilelog: do file IO in terms of bytes
Augie Fackler <augie@google.com>
parents:
41192
diff
changeset
|
853 reposfile = open(repospath, 'wb') |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
854 reposfile.writelines([("%s\n" % r) for r in validrepos]) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
855 reposfile.close() |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
856 finally: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
857 os.umask(oldumask) |
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 # prune cache |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
860 if sharedcache is not None: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
861 sharedcache.gc(keepkeys) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
862 elif not filesrepacked: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
863 ui.warn(_("warning: no valid repos in repofile\n")) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
864 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
865 def log(orig, ui, repo, *pats, **opts): |
40564
6f0b6905ef6f
shallowutil: introduce a helper function isenabled()
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40563
diff
changeset
|
866 if not isenabled(repo): |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
867 return orig(ui, repo, *pats, **opts) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
868 |
40657
13d4ad8d7801
py3: fix keyword arguments handling in hgext/remotefilelog/
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40624
diff
changeset
|
869 follow = opts.get(r'follow') |
13d4ad8d7801
py3: fix keyword arguments handling in hgext/remotefilelog/
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40624
diff
changeset
|
870 revs = opts.get(r'rev') |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
871 if pats: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
872 # 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
|
873 # non-working-copy-parent revs. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
874 if not follow or revs: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
875 # This forces the slowpath |
40657
13d4ad8d7801
py3: fix keyword arguments handling in hgext/remotefilelog/
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40624
diff
changeset
|
876 opts[r'removed'] = True |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
877 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
878 # 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
|
879 # 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
|
880 if not follow and not revs: |
41645
62bf34f70fe8
remotefilelog: replace matchandpats() by match()
Martin von Zweigbergk <martinvonz@google.com>
parents:
41248
diff
changeset
|
881 match = scmutil.match(repo['.'], pats, pycompat.byteskwargs(opts)) |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
882 isfile = not match.anypats() |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
883 if isfile: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
884 for file in match.files(): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
885 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
|
886 isfile = False |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
887 break |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
888 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
889 if isfile: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
890 ui.warn(_("warning: file log can be slow on large repos - " + |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
891 "use -f to speed it up\n")) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
892 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
893 return orig(ui, repo, *pats, **opts) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
894 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
895 def revdatelimit(ui, revset): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
896 """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
|
897 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
|
898 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
|
899 """ |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
900 days = ui.configint('remotefilelog', 'prefetchdays') |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
901 if days > 0: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
902 revset = '(%s) & date(-%s)' % (revset, days) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
903 return revset |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
904 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
905 def readytofetch(repo): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
906 """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
|
907 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
|
908 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
|
909 """ |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
910 timeout = repo.ui.configint('remotefilelog', 'prefetchdelay') |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
911 fname = repo.vfs.join('lastprefetch') |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
912 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
913 ready = False |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
914 with open(fname, 'a'): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
915 # 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
|
916 modtime = os.path.getmtime(fname) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
917 if (time.time() - modtime) > timeout: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
918 os.utime(fname, None) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
919 ready = True |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
920 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
921 return ready |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
922 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
923 def wcpprefetch(ui, repo, **kwargs): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
924 """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
|
925 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
|
926 """ |
40564
6f0b6905ef6f
shallowutil: introduce a helper function isenabled()
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40563
diff
changeset
|
927 shallow = isenabled(repo) |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
928 bgprefetchrevs = ui.config('remotefilelog', 'bgprefetchrevs') |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
929 isready = readytofetch(repo) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
930 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
931 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
|
932 return |
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 bgrepack = repo.ui.configbool('remotefilelog', 'backgroundrepack') |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
935 # 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
|
936 bgprefetchrevs = revdatelimit(ui, bgprefetchrevs) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
937 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
938 def anon(): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
939 if util.safehasattr(repo, 'ranprefetch') and repo.ranprefetch: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
940 return |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
941 repo.ranprefetch = True |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
942 repo.backgroundprefetch(bgprefetchrevs, repack=bgrepack) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
943 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
944 repo._afterlock(anon) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
945 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
946 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
|
947 result = orig(ui, repo, *pats, **opts) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
948 |
40564
6f0b6905ef6f
shallowutil: introduce a helper function isenabled()
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40563
diff
changeset
|
949 if isenabled(repo): |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
950 # prefetch if it's configured |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
951 prefetchrevset = ui.config('remotefilelog', 'pullprefetch') |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
952 bgrepack = repo.ui.configbool('remotefilelog', 'backgroundrepack') |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
953 bgprefetch = repo.ui.configbool('remotefilelog', 'backgroundprefetch') |
42852
2c74337e6483
remotefilelog: reduce probability of race-condition in remotefilelog tests
Boris Feld <boris.feld@octobus.net>
parents:
42776
diff
changeset
|
954 ensurestart = repo.ui.configbool('devel', 'remotefilelog.ensurestart') |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
955 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
956 if prefetchrevset: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
957 ui.status(_("prefetching file contents\n")) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
958 revs = scmutil.revrange(repo, [prefetchrevset]) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
959 base = repo['.'].rev() |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
960 if bgprefetch: |
42852
2c74337e6483
remotefilelog: reduce probability of race-condition in remotefilelog tests
Boris Feld <boris.feld@octobus.net>
parents:
42776
diff
changeset
|
961 repo.backgroundprefetch(prefetchrevset, repack=bgrepack, |
2c74337e6483
remotefilelog: reduce probability of race-condition in remotefilelog tests
Boris Feld <boris.feld@octobus.net>
parents:
42776
diff
changeset
|
962 ensurestart=ensurestart) |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
963 else: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
964 repo.prefetch(revs, base=base) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
965 if bgrepack: |
42852
2c74337e6483
remotefilelog: reduce probability of race-condition in remotefilelog tests
Boris Feld <boris.feld@octobus.net>
parents:
42776
diff
changeset
|
966 repackmod.backgroundrepack(repo, incremental=True, |
2c74337e6483
remotefilelog: reduce probability of race-condition in remotefilelog tests
Boris Feld <boris.feld@octobus.net>
parents:
42776
diff
changeset
|
967 ensurestart=ensurestart) |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
968 elif bgrepack: |
42852
2c74337e6483
remotefilelog: reduce probability of race-condition in remotefilelog tests
Boris Feld <boris.feld@octobus.net>
parents:
42776
diff
changeset
|
969 repackmod.backgroundrepack(repo, incremental=True, |
2c74337e6483
remotefilelog: reduce probability of race-condition in remotefilelog tests
Boris Feld <boris.feld@octobus.net>
parents:
42776
diff
changeset
|
970 ensurestart=ensurestart) |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
971 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
972 return result |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
973 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
974 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
|
975 # 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
|
976 # during a pull. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
977 def localgetbundle(orig, source, heads=None, common=None, bundlecaps=None, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
978 **kwargs): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
979 if not bundlecaps: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
980 bundlecaps = set() |
40559
ed19958dbf5d
remotefilelog: consolidate and rename bundle2 capability
Augie Fackler <augie@google.com>
parents:
40558
diff
changeset
|
981 bundlecaps.add(constants.BUNDLE2_CAPABLITY) |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
982 return orig(source, heads=heads, common=common, bundlecaps=bundlecaps, |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
983 **kwargs) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
984 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
985 if util.safehasattr(remote, '_callstream'): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
986 remote._localrepo = repo |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
987 elif util.safehasattr(remote, 'getbundle'): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
988 extensions.wrapfunction(remote, 'getbundle', localgetbundle) |
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(repo, remote, *args, **kwargs) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
991 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
992 def _fileprefetchhook(repo, revs, match): |
40564
6f0b6905ef6f
shallowutil: introduce a helper function isenabled()
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40563
diff
changeset
|
993 if isenabled(repo): |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
994 allfiles = [] |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
995 for rev in revs: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
996 if rev == nodemod.wdirrev or rev is None: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
997 continue |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
998 ctx = repo[rev] |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
999 mf = ctx.manifest() |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1000 sparsematch = repo.maybesparsematch(ctx.rev()) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1001 for path in ctx.walk(match): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1002 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
|
1003 allfiles.append((path, hex(mf[path]))) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1004 repo.fileservice.prefetch(allfiles) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1005 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1006 @command('debugremotefilelog', [ |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1007 ('d', 'decompress', None, _('decompress the filelog first')), |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1008 ], _('hg debugremotefilelog <path>'), norepo=True) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1009 def debugremotefilelog(ui, path, **opts): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1010 return debugcommands.debugremotefilelog(ui, path, **opts) |
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 @command('verifyremotefilelog', [ |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1013 ('d', 'decompress', None, _('decompress the filelogs first')), |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1014 ], _('hg verifyremotefilelogs <directory>'), norepo=True) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1015 def verifyremotefilelog(ui, path, **opts): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1016 return debugcommands.verifyremotefilelog(ui, path, **opts) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1017 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1018 @command('debugdatapack', [ |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1019 ('', 'long', None, _('print the long hashes')), |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1020 ('', 'node', '', _('dump the contents of node'), 'NODE'), |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1021 ], _('hg debugdatapack <paths>'), norepo=True) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1022 def debugdatapack(ui, *paths, **opts): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1023 return debugcommands.debugdatapack(ui, *paths, **opts) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1024 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1025 @command('debughistorypack', [ |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1026 ], _('hg debughistorypack <path>'), norepo=True) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1027 def debughistorypack(ui, path, **opts): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1028 return debugcommands.debughistorypack(ui, path) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1029 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1030 @command('debugkeepset', [ |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1031 ], _('hg debugkeepset')) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1032 def debugkeepset(ui, repo, **opts): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1033 # 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
|
1034 def keyfn(fname, fnode): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1035 return fileserverclient.getcachekey(repo.name, fname, hex(fnode)) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1036 repackmod.keepset(repo, keyfn) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1037 return |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1038 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1039 @command('debugwaitonrepack', [ |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1040 ], _('hg debugwaitonrepack')) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1041 def debugwaitonrepack(ui, repo, **opts): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1042 return debugcommands.debugwaitonrepack(repo) |
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 @command('debugwaitonprefetch', [ |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1045 ], _('hg debugwaitonprefetch')) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1046 def debugwaitonprefetch(ui, repo, **opts): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1047 return debugcommands.debugwaitonprefetch(repo) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1048 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1049 def resolveprefetchopts(ui, opts): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1050 if not opts.get('rev'): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1051 revset = ['.', 'draft()'] |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1052 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1053 prefetchrevset = ui.config('remotefilelog', 'pullprefetch', None) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1054 if prefetchrevset: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1055 revset.append('(%s)' % prefetchrevset) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1056 bgprefetchrevs = ui.config('remotefilelog', 'bgprefetchrevs', None) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1057 if bgprefetchrevs: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1058 revset.append('(%s)' % bgprefetchrevs) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1059 revset = '+'.join(revset) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1060 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1061 # 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
|
1062 revset = revdatelimit(ui, revset) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1063 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1064 opts['rev'] = [revset] |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1065 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1066 if not opts.get('base'): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1067 opts['base'] = None |
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 opts |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1070 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1071 @command('prefetch', [ |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1072 ('r', 'rev', [], _('prefetch the specified revisions'), _('REV')), |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1073 ('', 'repack', False, _('run repack after prefetch')), |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1074 ('b', 'base', '', _("rev that is assumed to already be local")), |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1075 ] + commands.walkopts, _('hg prefetch [OPTIONS] [FILE...]')) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1076 def prefetch(ui, repo, *pats, **opts): |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1077 """prefetch file revisions from the server |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1078 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1079 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
|
1080 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
|
1081 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
|
1082 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
|
1083 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1084 Return 0 on success. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1085 """ |
40657
13d4ad8d7801
py3: fix keyword arguments handling in hgext/remotefilelog/
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40624
diff
changeset
|
1086 opts = pycompat.byteskwargs(opts) |
40564
6f0b6905ef6f
shallowutil: introduce a helper function isenabled()
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40563
diff
changeset
|
1087 if not isenabled(repo): |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1088 raise error.Abort(_("repo is not shallow")) |
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 opts = resolveprefetchopts(ui, opts) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1091 revs = scmutil.revrange(repo, opts.get('rev')) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1092 repo.prefetch(revs, opts.get('base'), pats, opts) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1093 |
42852
2c74337e6483
remotefilelog: reduce probability of race-condition in remotefilelog tests
Boris Feld <boris.feld@octobus.net>
parents:
42776
diff
changeset
|
1094 ensurestart = repo.ui.configbool('devel', 'remotefilelog.ensurestart') |
2c74337e6483
remotefilelog: reduce probability of race-condition in remotefilelog tests
Boris Feld <boris.feld@octobus.net>
parents:
42776
diff
changeset
|
1095 |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1096 # Run repack in background |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1097 if opts.get('repack'): |
42852
2c74337e6483
remotefilelog: reduce probability of race-condition in remotefilelog tests
Boris Feld <boris.feld@octobus.net>
parents:
42776
diff
changeset
|
1098 repackmod.backgroundrepack(repo, incremental=True, |
2c74337e6483
remotefilelog: reduce probability of race-condition in remotefilelog tests
Boris Feld <boris.feld@octobus.net>
parents:
42776
diff
changeset
|
1099 ensurestart=ensurestart) |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1100 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1101 @command('repack', [ |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1102 ('', 'background', None, _('run in a background process'), None), |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1103 ('', 'incremental', None, _('do an incremental repack'), None), |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1104 ('', 'packsonly', None, _('only repack packs (skip loose objects)'), None), |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1105 ], _('hg repack [OPTIONS]')) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1106 def repack_(ui, repo, *pats, **opts): |
40657
13d4ad8d7801
py3: fix keyword arguments handling in hgext/remotefilelog/
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40624
diff
changeset
|
1107 if opts.get(r'background'): |
42852
2c74337e6483
remotefilelog: reduce probability of race-condition in remotefilelog tests
Boris Feld <boris.feld@octobus.net>
parents:
42776
diff
changeset
|
1108 ensurestart = repo.ui.configbool('devel', 'remotefilelog.ensurestart') |
40657
13d4ad8d7801
py3: fix keyword arguments handling in hgext/remotefilelog/
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40624
diff
changeset
|
1109 repackmod.backgroundrepack(repo, incremental=opts.get(r'incremental'), |
42852
2c74337e6483
remotefilelog: reduce probability of race-condition in remotefilelog tests
Boris Feld <boris.feld@octobus.net>
parents:
42776
diff
changeset
|
1110 packsonly=opts.get(r'packsonly', False), |
2c74337e6483
remotefilelog: reduce probability of race-condition in remotefilelog tests
Boris Feld <boris.feld@octobus.net>
parents:
42776
diff
changeset
|
1111 ensurestart=ensurestart) |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1112 return |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1113 |
40657
13d4ad8d7801
py3: fix keyword arguments handling in hgext/remotefilelog/
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40624
diff
changeset
|
1114 options = {'packsonly': opts.get(r'packsonly')} |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1115 |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1116 try: |
40657
13d4ad8d7801
py3: fix keyword arguments handling in hgext/remotefilelog/
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
40624
diff
changeset
|
1117 if opts.get(r'incremental'): |
40545
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1118 repackmod.incrementalrepack(repo, options=options) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1119 else: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1120 repackmod.fullrepack(repo, options=options) |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1121 except repackmod.RepackAlreadyRunning as ex: |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1122 # 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
|
1123 # progress, since we want the command to exit 0. |
3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1124 repo.ui.warn('%s\n' % ex) |