equal
deleted
inserted
replaced
5 # This software may be used and distributed according to the terms of the |
5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. |
6 # GNU General Public License version 2 or any later version. |
7 |
7 |
8 from __future__ import absolute_import |
8 from __future__ import absolute_import |
9 |
9 |
10 import collections |
|
11 import os |
10 import os |
12 import struct |
11 import struct |
13 import weakref |
12 import weakref |
14 |
13 |
15 from .i18n import _ |
14 from .i18n import _ |
299 requirements.REVLOGV2_REQUIREMENT in repo.requirements |
298 requirements.REVLOGV2_REQUIREMENT in repo.requirements |
300 and self.version == b'04' |
299 and self.version == b'04' |
301 and srctype == b'pull' |
300 and srctype == b'pull' |
302 ) |
301 ) |
303 if adding_sidedata: |
302 if adding_sidedata: |
304 sidedata_helpers = get_sidedata_helpers( |
303 sidedata_helpers = sidedatamod.get_sidedata_helpers( |
305 repo, |
304 repo, |
306 sidedata_categories or set(), |
305 sidedata_categories or set(), |
307 pull=True, |
306 pull=True, |
308 ) |
307 ) |
309 else: |
308 else: |
1071 if source == b'strip': |
1070 if source == b'strip': |
1072 # We're our own remote when stripping, get the no-op helpers |
1071 # We're our own remote when stripping, get the no-op helpers |
1073 # TODO a better approach would be for the strip bundle to |
1072 # TODO a better approach would be for the strip bundle to |
1074 # correctly advertise its sidedata categories directly. |
1073 # correctly advertise its sidedata categories directly. |
1075 remote_sidedata = repo._wanted_sidedata |
1074 remote_sidedata = repo._wanted_sidedata |
1076 sidedata_helpers = get_sidedata_helpers(repo, remote_sidedata) |
1075 sidedata_helpers = sidedatamod.get_sidedata_helpers( |
|
1076 repo, remote_sidedata |
|
1077 ) |
1077 |
1078 |
1078 clstate, deltas = self._generatechangelog( |
1079 clstate, deltas = self._generatechangelog( |
1079 cl, |
1080 cl, |
1080 clnodes, |
1081 clnodes, |
1081 generate=changelog, |
1082 generate=changelog, |
1938 _(b'missing file data for %s:%s - run hg verify') |
1939 _(b'missing file data for %s:%s - run hg verify') |
1939 % (f, hex(n)) |
1940 % (f, hex(n)) |
1940 ) |
1941 ) |
1941 |
1942 |
1942 return revisions, files |
1943 return revisions, files |
1943 |
|
1944 |
|
1945 def get_sidedata_helpers(repo, remote_sd_categories, pull=False): |
|
1946 # Computers for computing sidedata on-the-fly |
|
1947 sd_computers = collections.defaultdict(list) |
|
1948 # Computers for categories to remove from sidedata |
|
1949 sd_removers = collections.defaultdict(list) |
|
1950 to_generate = remote_sd_categories - repo._wanted_sidedata |
|
1951 to_remove = repo._wanted_sidedata - remote_sd_categories |
|
1952 if pull: |
|
1953 to_generate, to_remove = to_remove, to_generate |
|
1954 |
|
1955 for revlog_kind, computers in repo._sidedata_computers.items(): |
|
1956 for category, computer in computers.items(): |
|
1957 if category in to_generate: |
|
1958 sd_computers[revlog_kind].append(computer) |
|
1959 if category in to_remove: |
|
1960 sd_removers[revlog_kind].append(computer) |
|
1961 |
|
1962 sidedata_helpers = (repo, sd_computers, sd_removers) |
|
1963 return sidedata_helpers |
|