52 |
52 |
53 yield self.close() |
53 yield self.close() |
54 |
54 |
55 class shallowcg1packer(changegroup.cgpacker): |
55 class shallowcg1packer(changegroup.cgpacker): |
56 def generate(self, commonrevs, clnodes, fastpathlinkrev, source): |
56 def generate(self, commonrevs, clnodes, fastpathlinkrev, source): |
57 if constants.SHALLOWREPO_REQUIREMENT in self._repo.requirements: |
57 if shallowutil.isenabled(self._repo): |
58 fastpathlinkrev = False |
58 fastpathlinkrev = False |
59 |
59 |
60 return super(shallowcg1packer, self).generate(commonrevs, clnodes, |
60 return super(shallowcg1packer, self).generate(commonrevs, clnodes, |
61 fastpathlinkrev, source) |
61 fastpathlinkrev, source) |
62 |
62 |
67 def generatefiles(self, changedfiles, *args): |
67 def generatefiles(self, changedfiles, *args): |
68 try: |
68 try: |
69 linknodes, commonrevs, source = args |
69 linknodes, commonrevs, source = args |
70 except ValueError: |
70 except ValueError: |
71 commonrevs, source, mfdicts, fastpathlinkrev, fnodes, clrevs = args |
71 commonrevs, source, mfdicts, fastpathlinkrev, fnodes, clrevs = args |
72 if constants.SHALLOWREPO_REQUIREMENT in self._repo.requirements: |
72 if shallowutil.isenabled(self._repo): |
73 repo = self._repo |
73 repo = self._repo |
74 if isinstance(repo, bundlerepo.bundlerepository): |
74 if isinstance(repo, bundlerepo.bundlerepository): |
75 # If the bundle contains filelogs, we can't pull from it, since |
75 # If the bundle contains filelogs, we can't pull from it, since |
76 # bundlerepo is heavily tied to revlogs. Instead require that |
76 # bundlerepo is heavily tied to revlogs. Instead require that |
77 # the user use unbundle instead. |
77 # the user use unbundle instead. |
89 return super(shallowcg1packer, self).generatefiles( |
89 return super(shallowcg1packer, self).generatefiles( |
90 changedfiles, *args) |
90 changedfiles, *args) |
91 |
91 |
92 def shouldaddfilegroups(self, source): |
92 def shouldaddfilegroups(self, source): |
93 repo = self._repo |
93 repo = self._repo |
94 if not constants.SHALLOWREPO_REQUIREMENT in repo.requirements: |
94 if not shallowutil.isenabled(repo): |
95 return AllFiles |
95 return AllFiles |
96 |
96 |
97 if source == "push" or source == "bundle": |
97 if source == "push" or source == "bundle": |
98 return AllFiles |
98 return AllFiles |
99 |
99 |
137 yield changegroup.chunkheader(l) |
137 yield changegroup.chunkheader(l) |
138 yield meta |
138 yield meta |
139 yield delta |
139 yield delta |
140 |
140 |
141 def makechangegroup(orig, repo, outgoing, version, source, *args, **kwargs): |
141 def makechangegroup(orig, repo, outgoing, version, source, *args, **kwargs): |
142 if not constants.SHALLOWREPO_REQUIREMENT in repo.requirements: |
142 if not shallowutil.isenabled(repo): |
143 return orig(repo, outgoing, version, source, *args, **kwargs) |
143 return orig(repo, outgoing, version, source, *args, **kwargs) |
144 |
144 |
145 original = repo.shallowmatch |
145 original = repo.shallowmatch |
146 try: |
146 try: |
147 # if serving, only send files the clients has patterns for |
147 # if serving, only send files the clients has patterns for |
166 return orig(repo, outgoing, version, source, *args, **kwargs) |
166 return orig(repo, outgoing, version, source, *args, **kwargs) |
167 finally: |
167 finally: |
168 repo.shallowmatch = original |
168 repo.shallowmatch = original |
169 |
169 |
170 def addchangegroupfiles(orig, repo, source, revmap, trp, expectedfiles, *args): |
170 def addchangegroupfiles(orig, repo, source, revmap, trp, expectedfiles, *args): |
171 if not constants.SHALLOWREPO_REQUIREMENT in repo.requirements: |
171 if not shallowutil.isenabled(repo): |
172 return orig(repo, source, revmap, trp, expectedfiles, *args) |
172 return orig(repo, source, revmap, trp, expectedfiles, *args) |
173 |
173 |
174 files = 0 |
174 files = 0 |
175 newfiles = 0 |
175 newfiles = 0 |
176 visited = set() |
176 visited = set() |