Show More
@@ -209,7 +209,7 b" configitem('remotefilelog', 'history.rep" | |||||
209 | testedwith = 'ships-with-hg-core' |
|
209 | testedwith = 'ships-with-hg-core' | |
210 |
|
210 | |||
211 | repoclass = localrepo.localrepository |
|
211 | repoclass = localrepo.localrepository | |
212 | repoclass._basesupported.add(shallowrepo.requirement) |
|
212 | repoclass._basesupported.add(constants.SHALLOWREPO_REQUIREMENT) | |
213 |
|
213 | |||
214 | def uisetup(ui): |
|
214 | def uisetup(ui): | |
215 | """Wraps user facing Mercurial commands to swap them out with shallow |
|
215 | """Wraps user facing Mercurial commands to swap them out with shallow | |
@@ -231,7 +231,8 b' def uisetup(ui):' | |||||
231 |
|
231 | |||
232 | # Prevent 'hg manifest --all' |
|
232 | # Prevent 'hg manifest --all' | |
233 | def _manifest(orig, ui, repo, *args, **opts): |
|
233 | def _manifest(orig, ui, repo, *args, **opts): | |
234 | if shallowrepo.requirement in repo.requirements and opts.get('all'): |
|
234 | if (constants.SHALLOWREPO_REQUIREMENT in repo.requirements | |
|
235 | and opts.get('all')): | |||
235 | raise error.Abort(_("--all is not supported in a shallow repo")) |
|
236 | raise error.Abort(_("--all is not supported in a shallow repo")) | |
236 |
|
237 | |||
237 | return orig(ui, repo, *args, **opts) |
|
238 | return orig(ui, repo, *args, **opts) | |
@@ -256,7 +257,7 b' def cloneshallow(orig, ui, repo, *args, ' | |||||
256 | if opts.get('shallow'): |
|
257 | if opts.get('shallow'): | |
257 | repos = [] |
|
258 | repos = [] | |
258 | def pull_shallow(orig, self, *args, **kwargs): |
|
259 | def pull_shallow(orig, self, *args, **kwargs): | |
259 |
if |
|
260 | if constants.SHALLOWREPO_REQUIREMENT not in self.requirements: | |
260 | repos.append(self.unfiltered()) |
|
261 | repos.append(self.unfiltered()) | |
261 | # set up the client hooks so the post-clone update works |
|
262 | # set up the client hooks so the post-clone update works | |
262 | setupclient(self.ui, self.unfiltered()) |
|
263 | setupclient(self.ui, self.unfiltered()) | |
@@ -266,7 +267,7 b' def cloneshallow(orig, ui, repo, *args, ' | |||||
266 | if isinstance(self, repoview.repoview): |
|
267 | if isinstance(self, repoview.repoview): | |
267 | self.__class__.__bases__ = (self.__class__.__bases__[0], |
|
268 | self.__class__.__bases__ = (self.__class__.__bases__[0], | |
268 | self.unfiltered().__class__) |
|
269 | self.unfiltered().__class__) | |
269 |
self.requirements.add( |
|
270 | self.requirements.add(constants.SHALLOWREPO_REQUIREMENT) | |
270 | self._writerequirements() |
|
271 | self._writerequirements() | |
271 |
|
272 | |||
272 | # Since setupclient hadn't been called, exchange.pull was not |
|
273 | # Since setupclient hadn't been called, exchange.pull was not | |
@@ -312,14 +313,14 b' def cloneshallow(orig, ui, repo, *args, ' | |||||
312 | return False, None |
|
313 | return False, None | |
313 | supported, requirements = orig(pullop, bundle2=bundle2) |
|
314 | supported, requirements = orig(pullop, bundle2=bundle2) | |
314 | if requirements is not None: |
|
315 | if requirements is not None: | |
315 |
requirements.add( |
|
316 | requirements.add(constants.SHALLOWREPO_REQUIREMENT) | |
316 | return supported, requirements |
|
317 | return supported, requirements | |
317 | extensions.wrapfunction( |
|
318 | extensions.wrapfunction( | |
318 | streamclone, 'canperformstreamclone', canperformstreamclone) |
|
319 | streamclone, 'canperformstreamclone', canperformstreamclone) | |
319 | else: |
|
320 | else: | |
320 | def stream_in_shallow(orig, repo, remote, requirements): |
|
321 | def stream_in_shallow(orig, repo, remote, requirements): | |
321 | setup_streamout(repo, remote) |
|
322 | setup_streamout(repo, remote) | |
322 |
requirements.add( |
|
323 | requirements.add(constants.SHALLOWREPO_REQUIREMENT) | |
323 | return orig(repo, remote, requirements) |
|
324 | return orig(repo, remote, requirements) | |
324 | extensions.wrapfunction( |
|
325 | extensions.wrapfunction( | |
325 | localrepo.localrepository, 'stream_in', stream_in_shallow) |
|
326 | localrepo.localrepository, 'stream_in', stream_in_shallow) | |
@@ -349,7 +350,7 b' def reposetup(ui, repo):' | |||||
349 | ui.setconfig('hooks', 'commit.prefetch', wcpprefetch) |
|
350 | ui.setconfig('hooks', 'commit.prefetch', wcpprefetch) | |
350 |
|
351 | |||
351 | isserverenabled = ui.configbool('remotefilelog', 'server') |
|
352 | isserverenabled = ui.configbool('remotefilelog', 'server') | |
352 |
isshallowclient = |
|
353 | isshallowclient = constants.SHALLOWREPO_REQUIREMENT in repo.requirements | |
353 |
|
354 | |||
354 | if isserverenabled and isshallowclient: |
|
355 | if isserverenabled and isshallowclient: | |
355 | raise RuntimeError("Cannot be both a server and shallow client.") |
|
356 | raise RuntimeError("Cannot be both a server and shallow client.") | |
@@ -388,7 +389,7 b' def onetimeclientsetup(ui):' | |||||
388 |
|
389 | |||
389 | def storewrapper(orig, requirements, path, vfstype): |
|
390 | def storewrapper(orig, requirements, path, vfstype): | |
390 | s = orig(requirements, path, vfstype) |
|
391 | s = orig(requirements, path, vfstype) | |
391 | if shallowrepo.requirement in requirements: |
|
392 | if constants.SHALLOWREPO_REQUIREMENT in requirements: | |
392 | s = shallowstore.wrapstore(s) |
|
393 | s = shallowstore.wrapstore(s) | |
393 |
|
394 | |||
394 | return s |
|
395 | return s | |
@@ -398,7 +399,7 b' def onetimeclientsetup(ui):' | |||||
398 |
|
399 | |||
399 | # prefetch files before update |
|
400 | # prefetch files before update | |
400 | def applyupdates(orig, repo, actions, wctx, mctx, overwrite, labels=None): |
|
401 | def applyupdates(orig, repo, actions, wctx, mctx, overwrite, labels=None): | |
401 |
if |
|
402 | if constants.SHALLOWREPO_REQUIREMENT in repo.requirements: | |
402 | manifest = mctx.manifest() |
|
403 | manifest = mctx.manifest() | |
403 | files = [] |
|
404 | files = [] | |
404 | for f, args, msg in actions['g']: |
|
405 | for f, args, msg in actions['g']: | |
@@ -411,7 +412,7 b' def onetimeclientsetup(ui):' | |||||
411 | # Prefetch merge checkunknownfiles |
|
412 | # Prefetch merge checkunknownfiles | |
412 | def checkunknownfiles(orig, repo, wctx, mctx, force, actions, |
|
413 | def checkunknownfiles(orig, repo, wctx, mctx, force, actions, | |
413 | *args, **kwargs): |
|
414 | *args, **kwargs): | |
414 |
if |
|
415 | if constants.SHALLOWREPO_REQUIREMENT in repo.requirements: | |
415 | files = [] |
|
416 | files = [] | |
416 | sparsematch = repo.maybesparsematch(mctx.rev()) |
|
417 | sparsematch = repo.maybesparsematch(mctx.rev()) | |
417 | for f, (m, actionargs, msg) in actions.iteritems(): |
|
418 | for f, (m, actionargs, msg) in actions.iteritems(): | |
@@ -430,7 +431,7 b' def onetimeclientsetup(ui):' | |||||
430 | # Prefetch files before status attempts to look at their size and contents |
|
431 | # Prefetch files before status attempts to look at their size and contents | |
431 | def checklookup(orig, self, files): |
|
432 | def checklookup(orig, self, files): | |
432 | repo = self._repo |
|
433 | repo = self._repo | |
433 |
if |
|
434 | if constants.SHALLOWREPO_REQUIREMENT in repo.requirements: | |
434 | prefetchfiles = [] |
|
435 | prefetchfiles = [] | |
435 | for parent in self._parents: |
|
436 | for parent in self._parents: | |
436 | for f in files: |
|
437 | for f in files: | |
@@ -443,7 +444,7 b' def onetimeclientsetup(ui):' | |||||
443 |
|
444 | |||
444 | # Prefetch the logic that compares added and removed files for renames |
|
445 | # Prefetch the logic that compares added and removed files for renames | |
445 | def findrenames(orig, repo, matcher, added, removed, *args, **kwargs): |
|
446 | def findrenames(orig, repo, matcher, added, removed, *args, **kwargs): | |
446 |
if |
|
447 | if constants.SHALLOWREPO_REQUIREMENT in repo.requirements: | |
447 | files = [] |
|
448 | files = [] | |
448 | parentctx = repo['.'] |
|
449 | parentctx = repo['.'] | |
449 | for f in removed: |
|
450 | for f in removed: | |
@@ -456,7 +457,7 b' def onetimeclientsetup(ui):' | |||||
456 | # prefetch files before mergecopies check |
|
457 | # prefetch files before mergecopies check | |
457 | def computenonoverlap(orig, repo, c1, c2, *args, **kwargs): |
|
458 | def computenonoverlap(orig, repo, c1, c2, *args, **kwargs): | |
458 | u1, u2 = orig(repo, c1, c2, *args, **kwargs) |
|
459 | u1, u2 = orig(repo, c1, c2, *args, **kwargs) | |
459 |
if |
|
460 | if constants.SHALLOWREPO_REQUIREMENT in repo.requirements: | |
460 | m1 = c1.manifest() |
|
461 | m1 = c1.manifest() | |
461 | m2 = c2.manifest() |
|
462 | m2 = c2.manifest() | |
462 | files = [] |
|
463 | files = [] | |
@@ -488,7 +489,7 b' def onetimeclientsetup(ui):' | |||||
488 | def computeforwardmissing(orig, a, b, match=None): |
|
489 | def computeforwardmissing(orig, a, b, match=None): | |
489 | missing = list(orig(a, b, match=match)) |
|
490 | missing = list(orig(a, b, match=match)) | |
490 | repo = a._repo |
|
491 | repo = a._repo | |
491 |
if |
|
492 | if constants.SHALLOWREPO_REQUIREMENT in repo.requirements: | |
492 | mb = b.manifest() |
|
493 | mb = b.manifest() | |
493 |
|
494 | |||
494 | files = [] |
|
495 | files = [] | |
@@ -515,7 +516,7 b' def onetimeclientsetup(ui):' | |||||
515 | # repo can be None when running in chg: |
|
516 | # repo can be None when running in chg: | |
516 | # - at startup, reposetup was called because serve is not norepo |
|
517 | # - at startup, reposetup was called because serve is not norepo | |
517 | # - a norepo command like "help" is called |
|
518 | # - a norepo command like "help" is called | |
518 |
if repo and |
|
519 | if repo and constants.SHALLOWREPO_REQUIREMENT in repo.requirements: | |
519 | repo.fileservice.close() |
|
520 | repo.fileservice.close() | |
520 | extensions.wrapfunction(dispatch, 'runcommand', runcommand) |
|
521 | extensions.wrapfunction(dispatch, 'runcommand', runcommand) | |
521 |
|
522 | |||
@@ -527,7 +528,7 b' def onetimeclientsetup(ui):' | |||||
527 |
|
528 | |||
528 | # prevent strip from stripping remotefilelogs |
|
529 | # prevent strip from stripping remotefilelogs | |
529 | def _collectbrokencsets(orig, repo, files, striprev): |
|
530 | def _collectbrokencsets(orig, repo, files, striprev): | |
530 |
if |
|
531 | if constants.SHALLOWREPO_REQUIREMENT in repo.requirements: | |
531 | files = list([f for f in files if not repo.shallowmatch(f)]) |
|
532 | files = list([f for f in files if not repo.shallowmatch(f)]) | |
532 | return orig(repo, files, striprev) |
|
533 | return orig(repo, files, striprev) | |
533 | extensions.wrapfunction(repair, '_collectbrokencsets', _collectbrokencsets) |
|
534 | extensions.wrapfunction(repair, '_collectbrokencsets', _collectbrokencsets) | |
@@ -578,7 +579,7 b' def onetimeclientsetup(ui):' | |||||
578 | def filectx(orig, self, path, fileid=None, filelog=None): |
|
579 | def filectx(orig, self, path, fileid=None, filelog=None): | |
579 | if fileid is None: |
|
580 | if fileid is None: | |
580 | fileid = self.filenode(path) |
|
581 | fileid = self.filenode(path) | |
581 |
if ( |
|
582 | if (constants.SHALLOWREPO_REQUIREMENT in self._repo.requirements and | |
582 | self._repo.shallowmatch(path)): |
|
583 | self._repo.shallowmatch(path)): | |
583 | return remotefilectx.remotefilectx(self._repo, path, |
|
584 | return remotefilectx.remotefilectx(self._repo, path, | |
584 | fileid=fileid, changectx=self, filelog=filelog) |
|
585 | fileid=fileid, changectx=self, filelog=filelog) | |
@@ -586,7 +587,7 b' def onetimeclientsetup(ui):' | |||||
586 | extensions.wrapfunction(context.changectx, 'filectx', filectx) |
|
587 | extensions.wrapfunction(context.changectx, 'filectx', filectx) | |
587 |
|
588 | |||
588 | def workingfilectx(orig, self, path, filelog=None): |
|
589 | def workingfilectx(orig, self, path, filelog=None): | |
589 |
if ( |
|
590 | if (constants.SHALLOWREPO_REQUIREMENT in self._repo.requirements and | |
590 | self._repo.shallowmatch(path)): |
|
591 | self._repo.shallowmatch(path)): | |
591 | return remotefilectx.remoteworkingfilectx(self._repo, |
|
592 | return remotefilectx.remoteworkingfilectx(self._repo, | |
592 | path, workingctx=self, filelog=filelog) |
|
593 | path, workingctx=self, filelog=filelog) | |
@@ -596,7 +597,7 b' def onetimeclientsetup(ui):' | |||||
596 | # prefetch required revisions before a diff |
|
597 | # prefetch required revisions before a diff | |
597 | def trydiff(orig, repo, revs, ctx1, ctx2, modified, added, removed, |
|
598 | def trydiff(orig, repo, revs, ctx1, ctx2, modified, added, removed, | |
598 | copy, getfilectx, *args, **kwargs): |
|
599 | copy, getfilectx, *args, **kwargs): | |
599 |
if |
|
600 | if constants.SHALLOWREPO_REQUIREMENT in repo.requirements: | |
600 | prefetch = [] |
|
601 | prefetch = [] | |
601 | mf1 = ctx1.manifest() |
|
602 | mf1 = ctx1.manifest() | |
602 | for fname in modified + added + removed: |
|
603 | for fname in modified + added + removed: | |
@@ -654,7 +655,7 b' def getrenamedfn(repo, endrev=None):' | |||||
654 | return getrenamed |
|
655 | return getrenamed | |
655 |
|
656 | |||
656 | def walkfilerevs(orig, repo, match, follow, revs, fncache): |
|
657 | def walkfilerevs(orig, repo, match, follow, revs, fncache): | |
657 |
if not |
|
658 | if not constants.SHALLOWREPO_REQUIREMENT in repo.requirements: | |
658 | return orig(repo, match, follow, revs, fncache) |
|
659 | return orig(repo, match, follow, revs, fncache) | |
659 |
|
660 | |||
660 | # remotefilelog's can't be walked in rev order, so throw. |
|
661 | # remotefilelog's can't be walked in rev order, so throw. | |
@@ -694,7 +695,7 b' def filelogrevset(orig, repo, subset, x)' | |||||
694 | a slower, more accurate result, use ``file()``. |
|
695 | a slower, more accurate result, use ``file()``. | |
695 | """ |
|
696 | """ | |
696 |
|
697 | |||
697 |
if not |
|
698 | if not constants.SHALLOWREPO_REQUIREMENT in repo.requirements: | |
698 | return orig(repo, subset, x) |
|
699 | return orig(repo, subset, x) | |
699 |
|
700 | |||
700 | # i18n: "filelog" is a keyword |
|
701 | # i18n: "filelog" is a keyword | |
@@ -802,7 +803,7 b' def gcclient(ui, cachepath):' | |||||
802 | # Protect against any repo or config changes that have happened since |
|
803 | # Protect against any repo or config changes that have happened since | |
803 | # this repo was added to the repos file. We'd rather this loop succeed |
|
804 | # this repo was added to the repos file. We'd rather this loop succeed | |
804 | # and too much be deleted, than the loop fail and nothing gets deleted. |
|
805 | # and too much be deleted, than the loop fail and nothing gets deleted. | |
805 |
if |
|
806 | if constants.SHALLOWREPO_REQUIREMENT not in repo.requirements: | |
806 | continue |
|
807 | continue | |
807 |
|
808 | |||
808 | if not util.safehasattr(repo, 'name'): |
|
809 | if not util.safehasattr(repo, 'name'): | |
@@ -851,7 +852,7 b' def gcclient(ui, cachepath):' | |||||
851 | ui.warn(_("warning: no valid repos in repofile\n")) |
|
852 | ui.warn(_("warning: no valid repos in repofile\n")) | |
852 |
|
853 | |||
853 | def log(orig, ui, repo, *pats, **opts): |
|
854 | def log(orig, ui, repo, *pats, **opts): | |
854 |
if |
|
855 | if constants.SHALLOWREPO_REQUIREMENT not in repo.requirements: | |
855 | return orig(ui, repo, *pats, **opts) |
|
856 | return orig(ui, repo, *pats, **opts) | |
856 |
|
857 | |||
857 | follow = opts.get('follow') |
|
858 | follow = opts.get('follow') | |
@@ -912,7 +913,7 b' def wcpprefetch(ui, repo, **kwargs):' | |||||
912 | """Prefetches in background revisions specified by bgprefetchrevs revset. |
|
913 | """Prefetches in background revisions specified by bgprefetchrevs revset. | |
913 | Does background repack if backgroundrepack flag is set in config. |
|
914 | Does background repack if backgroundrepack flag is set in config. | |
914 | """ |
|
915 | """ | |
915 |
shallow = |
|
916 | shallow = constants.SHALLOWREPO_REQUIREMENT in repo.requirements | |
916 | bgprefetchrevs = ui.config('remotefilelog', 'bgprefetchrevs') |
|
917 | bgprefetchrevs = ui.config('remotefilelog', 'bgprefetchrevs') | |
917 | isready = readytofetch(repo) |
|
918 | isready = readytofetch(repo) | |
918 |
|
919 | |||
@@ -934,7 +935,7 b' def wcpprefetch(ui, repo, **kwargs):' | |||||
934 | def pull(orig, ui, repo, *pats, **opts): |
|
935 | def pull(orig, ui, repo, *pats, **opts): | |
935 | result = orig(ui, repo, *pats, **opts) |
|
936 | result = orig(ui, repo, *pats, **opts) | |
936 |
|
937 | |||
937 | if shallowrepo.requirement in repo.requirements: |
|
938 | if constants.SHALLOWREPO_REQUIREMENT in repo.requirements: | |
938 | # prefetch if it's configured |
|
939 | # prefetch if it's configured | |
939 | prefetchrevset = ui.config('remotefilelog', 'pullprefetch') |
|
940 | prefetchrevset = ui.config('remotefilelog', 'pullprefetch') | |
940 | bgrepack = repo.ui.configbool('remotefilelog', 'backgroundrepack') |
|
941 | bgrepack = repo.ui.configbool('remotefilelog', 'backgroundrepack') | |
@@ -974,7 +975,7 b' def exchangepull(orig, repo, remote, *ar' | |||||
974 | return orig(repo, remote, *args, **kwargs) |
|
975 | return orig(repo, remote, *args, **kwargs) | |
975 |
|
976 | |||
976 | def _fileprefetchhook(repo, revs, match): |
|
977 | def _fileprefetchhook(repo, revs, match): | |
977 | if shallowrepo.requirement in repo.requirements: |
|
978 | if constants.SHALLOWREPO_REQUIREMENT in repo.requirements: | |
978 | allfiles = [] |
|
979 | allfiles = [] | |
979 | for rev in revs: |
|
980 | for rev in revs: | |
980 | if rev == nodemod.wdirrev or rev is None: |
|
981 | if rev == nodemod.wdirrev or rev is None: | |
@@ -1070,7 +1071,7 b' def prefetch(ui, repo, *pats, **opts):' | |||||
1070 |
|
1071 | |||
1071 | Return 0 on success. |
|
1072 | Return 0 on success. | |
1072 | """ |
|
1073 | """ | |
1073 |
if not |
|
1074 | if not constants.SHALLOWREPO_REQUIREMENT in repo.requirements: | |
1074 | raise error.Abort(_("repo is not shallow")) |
|
1075 | raise error.Abort(_("repo is not shallow")) | |
1075 |
|
1076 | |||
1076 | opts = resolveprefetchopts(ui, opts) |
|
1077 | opts = resolveprefetchopts(ui, opts) |
@@ -4,9 +4,9 b' import struct' | |||||
4 |
|
4 | |||
5 | from mercurial.i18n import _ |
|
5 | from mercurial.i18n import _ | |
6 |
|
6 | |||
7 | REQUIREMENT = "remotefilelog" |
|
7 | NETWORK_CAP_LEGACY_SSH_GETFILES = 'exp-remotefilelog-ssh-getfiles-1' | |
8 |
|
8 | |||
9 | NETWORK_CAP_LEGACY_SSH_GETFILES = 'exp-remotefilelog-ssh-getfiles-1' |
|
9 | SHALLOWREPO_REQUIREMENT = "exp-remotefilelog-repo-req-1" | |
10 |
|
10 | |||
11 | BUNDLE2_CAPABLITY = "exp-remotefilelog-b2cap-1" |
|
11 | BUNDLE2_CAPABLITY = "exp-remotefilelog-b2cap-1" | |
12 |
|
12 |
@@ -24,7 +24,6 b' from . import (' | |||||
24 | fileserverclient, |
|
24 | fileserverclient, | |
25 | historypack, |
|
25 | historypack, | |
26 | repack, |
|
26 | repack, | |
27 | shallowrepo, |
|
|||
28 | shallowutil, |
|
27 | shallowutil, | |
29 | ) |
|
28 | ) | |
30 |
|
29 | |||
@@ -93,7 +92,7 b' def debugindex(orig, ui, repo, file_=Non' | |||||
93 | if (opts.get('changelog') or |
|
92 | if (opts.get('changelog') or | |
94 | opts.get('manifest') or |
|
93 | opts.get('manifest') or | |
95 | opts.get('dir') or |
|
94 | opts.get('dir') or | |
96 |
not |
|
95 | not constants.SHALLOWREPO_REQUIREMENT in repo.requirements or | |
97 | not repo.shallowmatch(file_)): |
|
96 | not repo.shallowmatch(file_)): | |
98 | return orig(ui, repo, file_, **opts) |
|
97 | return orig(ui, repo, file_, **opts) | |
99 |
|
98 | |||
@@ -140,7 +139,7 b' def debugindex(orig, ui, repo, file_=Non' | |||||
140 |
|
139 | |||
141 | def debugindexdot(orig, ui, repo, file_): |
|
140 | def debugindexdot(orig, ui, repo, file_): | |
142 | """dump an index DAG as a graphviz dot file""" |
|
141 | """dump an index DAG as a graphviz dot file""" | |
143 |
if not |
|
142 | if not constants.SHALLOWREPO_REQUIREMENT in repo.requirements: | |
144 | return orig(ui, repo, file_) |
|
143 | return orig(ui, repo, file_) | |
145 |
|
144 | |||
146 | r = buildtemprevlog(repo, os.path.basename(file_)[:-2]) |
|
145 | r = buildtemprevlog(repo, os.path.basename(file_)[:-2]) |
@@ -83,7 +83,8 b' def peersetup(ui, peer):' | |||||
83 | return |
|
83 | return | |
84 | if not util.safehasattr(self, '_localrepo'): |
|
84 | if not util.safehasattr(self, '_localrepo'): | |
85 | return |
|
85 | return | |
86 | if constants.REQUIREMENT not in self._localrepo.requirements: |
|
86 | if (constants.SHALLOWREPO_REQUIREMENT | |
|
87 | not in self._localrepo.requirements): | |||
87 | return |
|
88 | return | |
88 |
|
89 | |||
89 | bundlecaps = opts.get('bundlecaps') |
|
90 | bundlecaps = opts.get('bundlecaps') |
@@ -30,7 +30,6 b' from mercurial import (' | |||||
30 | ) |
|
30 | ) | |
31 | from . import ( |
|
31 | from . import ( | |
32 | constants, |
|
32 | constants, | |
33 | shallowrepo, |
|
|||
34 | shallowutil, |
|
33 | shallowutil, | |
35 | ) |
|
34 | ) | |
36 |
|
35 | |||
@@ -133,7 +132,7 b' def onetimesetup(ui):' | |||||
133 | def _walkstreamfiles(orig, repo): |
|
132 | def _walkstreamfiles(orig, repo): | |
134 | if state.shallowremote: |
|
133 | if state.shallowremote: | |
135 | # if we are shallow ourselves, stream our local commits |
|
134 | # if we are shallow ourselves, stream our local commits | |
136 |
if |
|
135 | if constants.SHALLOWREPO_REQUIREMENT in repo.requirements: | |
137 | striplen = len(repo.store.path) + 1 |
|
136 | striplen = len(repo.store.path) + 1 | |
138 | readdir = repo.store.rawvfs.readdir |
|
137 | readdir = repo.store.rawvfs.readdir | |
139 | visit = [os.path.join(repo.store.path, 'data')] |
|
138 | visit = [os.path.join(repo.store.path, 'data')] | |
@@ -167,7 +166,7 b' def onetimesetup(ui):' | |||||
167 | continue |
|
166 | continue | |
168 | yield x |
|
167 | yield x | |
169 |
|
168 | |||
170 |
elif |
|
169 | elif constants.SHALLOWREPO_REQUIREMENT in repo.requirements: | |
171 | # don't allow cloning from a shallow repo to a full repo |
|
170 | # don't allow cloning from a shallow repo to a full repo | |
172 | # since it would require fetching every version of every |
|
171 | # since it would require fetching every version of every | |
173 | # file in order to create the revlogs. |
|
172 | # file in order to create the revlogs. | |
@@ -194,7 +193,7 b' def onetimesetup(ui):' | |||||
194 | # expose remotefilelog capabilities |
|
193 | # expose remotefilelog capabilities | |
195 | def _capabilities(orig, repo, proto): |
|
194 | def _capabilities(orig, repo, proto): | |
196 | caps = orig(repo, proto) |
|
195 | caps = orig(repo, proto) | |
197 |
if (( |
|
196 | if ((constants.SHALLOWREPO_REQUIREMENT in repo.requirements or | |
198 | ui.configbool('remotefilelog', 'server'))): |
|
197 | ui.configbool('remotefilelog', 'server'))): | |
199 | if isinstance(proto, _sshv1server): |
|
198 | if isinstance(proto, _sshv1server): | |
200 | # legacy getfiles method which only works over ssh |
|
199 | # legacy getfiles method which only works over ssh | |
@@ -279,7 +278,7 b' def getfile(repo, proto, file, node):' | |||||
279 | data is a compressed blob with revlog flag and ancestors information. See |
|
278 | data is a compressed blob with revlog flag and ancestors information. See | |
280 | createfileblob for its content. |
|
279 | createfileblob for its content. | |
281 | """ |
|
280 | """ | |
282 | if shallowrepo.requirement in repo.requirements: |
|
281 | if constants.SHALLOWREPO_REQUIREMENT in repo.requirements: | |
283 | return '1\0' + _('cannot fetch remote files from shallow repo') |
|
282 | return '1\0' + _('cannot fetch remote files from shallow repo') | |
284 | cachepath = repo.ui.config("remotefilelog", "servercachepath") |
|
283 | cachepath = repo.ui.config("remotefilelog", "servercachepath") | |
285 | if not cachepath: |
|
284 | if not cachepath: | |
@@ -292,7 +291,7 b' def getfile(repo, proto, file, node):' | |||||
292 | def getfiles(repo, proto): |
|
291 | def getfiles(repo, proto): | |
293 | """A server api for requesting particular versions of particular files. |
|
292 | """A server api for requesting particular versions of particular files. | |
294 | """ |
|
293 | """ | |
295 | if shallowrepo.requirement in repo.requirements: |
|
294 | if constants.SHALLOWREPO_REQUIREMENT in repo.requirements: | |
296 | raise error.Abort(_('cannot fetch remote files from shallow repo')) |
|
295 | raise error.Abort(_('cannot fetch remote files from shallow repo')) | |
297 | if not isinstance(proto, _sshv1server): |
|
296 | if not isinstance(proto, _sshv1server): | |
298 | raise error.Abort(_('cannot fetch remote files over non-ssh protocol')) |
|
297 | raise error.Abort(_('cannot fetch remote files over non-ssh protocol')) |
@@ -26,8 +26,6 b' NoFiles = 0' | |||||
26 | LocalFiles = 1 |
|
26 | LocalFiles = 1 | |
27 | AllFiles = 2 |
|
27 | AllFiles = 2 | |
28 |
|
28 | |||
29 | requirement = "remotefilelog" |
|
|||
30 |
|
||||
31 | def shallowgroup(cls, self, nodelist, rlog, lookup, units=None, reorder=None): |
|
29 | def shallowgroup(cls, self, nodelist, rlog, lookup, units=None, reorder=None): | |
32 | if not isinstance(rlog, remotefilelog.remotefilelog): |
|
30 | if not isinstance(rlog, remotefilelog.remotefilelog): | |
33 | for c in super(cls, self).group(nodelist, rlog, lookup, |
|
31 | for c in super(cls, self).group(nodelist, rlog, lookup, | |
@@ -56,7 +54,7 b' def shallowgroup(cls, self, nodelist, rl' | |||||
56 |
|
54 | |||
57 | class shallowcg1packer(changegroup.cgpacker): |
|
55 | class shallowcg1packer(changegroup.cgpacker): | |
58 | def generate(self, commonrevs, clnodes, fastpathlinkrev, source): |
|
56 | def generate(self, commonrevs, clnodes, fastpathlinkrev, source): | |
59 |
if |
|
57 | if constants.SHALLOWREPO_REQUIREMENT in self._repo.requirements: | |
60 | fastpathlinkrev = False |
|
58 | fastpathlinkrev = False | |
61 |
|
59 | |||
62 | return super(shallowcg1packer, self).generate(commonrevs, clnodes, |
|
60 | return super(shallowcg1packer, self).generate(commonrevs, clnodes, | |
@@ -71,7 +69,7 b' class shallowcg1packer(changegroup.cgpac' | |||||
71 | linknodes, commonrevs, source = args |
|
69 | linknodes, commonrevs, source = args | |
72 | except ValueError: |
|
70 | except ValueError: | |
73 | commonrevs, source, mfdicts, fastpathlinkrev, fnodes, clrevs = args |
|
71 | commonrevs, source, mfdicts, fastpathlinkrev, fnodes, clrevs = args | |
74 |
if |
|
72 | if constants.SHALLOWREPO_REQUIREMENT in self._repo.requirements: | |
75 | repo = self._repo |
|
73 | repo = self._repo | |
76 | if isinstance(repo, bundlerepo.bundlerepository): |
|
74 | if isinstance(repo, bundlerepo.bundlerepository): | |
77 | # 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 | |
@@ -93,7 +91,7 b' class shallowcg1packer(changegroup.cgpac' | |||||
93 |
|
91 | |||
94 | def shouldaddfilegroups(self, source): |
|
92 | def shouldaddfilegroups(self, source): | |
95 | repo = self._repo |
|
93 | repo = self._repo | |
96 |
if not |
|
94 | if not constants.SHALLOWREPO_REQUIREMENT in repo.requirements: | |
97 | return AllFiles |
|
95 | return AllFiles | |
98 |
|
96 | |||
99 | if source == "push" or source == "bundle": |
|
97 | if source == "push" or source == "bundle": | |
@@ -141,7 +139,7 b' class shallowcg1packer(changegroup.cgpac' | |||||
141 | yield delta |
|
139 | yield delta | |
142 |
|
140 | |||
143 | def makechangegroup(orig, repo, outgoing, version, source, *args, **kwargs): |
|
141 | def makechangegroup(orig, repo, outgoing, version, source, *args, **kwargs): | |
144 |
if not |
|
142 | if not constants.SHALLOWREPO_REQUIREMENT in repo.requirements: | |
145 | return orig(repo, outgoing, version, source, *args, **kwargs) |
|
143 | return orig(repo, outgoing, version, source, *args, **kwargs) | |
146 |
|
144 | |||
147 | original = repo.shallowmatch |
|
145 | original = repo.shallowmatch | |
@@ -170,7 +168,7 b' def makechangegroup(orig, repo, outgoing' | |||||
170 | repo.shallowmatch = original |
|
168 | repo.shallowmatch = original | |
171 |
|
169 | |||
172 | def addchangegroupfiles(orig, repo, source, revmap, trp, expectedfiles, *args): |
|
170 | def addchangegroupfiles(orig, repo, source, revmap, trp, expectedfiles, *args): | |
173 |
if not |
|
171 | if not constants.SHALLOWREPO_REQUIREMENT in repo.requirements: | |
174 | return orig(repo, source, revmap, trp, expectedfiles, *args) |
|
172 | return orig(repo, source, revmap, trp, expectedfiles, *args) | |
175 |
|
173 | |||
176 | files = 0 |
|
174 | files = 0 |
@@ -40,7 +40,6 b' else:' | |||||
40 | from mercurial.utils import procutil |
|
40 | from mercurial.utils import procutil | |
41 | _hgexecutable = procutil.hgexecutable |
|
41 | _hgexecutable = procutil.hgexecutable | |
42 |
|
42 | |||
43 | requirement = "remotefilelog" |
|
|||
44 | _prefetching = _('prefetching') |
|
43 | _prefetching = _('prefetching') | |
45 |
|
44 | |||
46 | # These make*stores functions are global so that other extensions can replace |
|
45 | # These make*stores functions are global so that other extensions can replace |
@@ -28,9 +28,9 b'' | |||||
28 | $ cd shallow |
|
28 | $ cd shallow | |
29 | $ cat .hg/requires |
|
29 | $ cat .hg/requires | |
30 | dotencode |
|
30 | dotencode | |
|
31 | exp-remotefilelog-repo-req-1 | |||
31 | fncache |
|
32 | fncache | |
32 | generaldelta |
|
33 | generaldelta | |
33 | remotefilelog |
|
|||
34 | revlogv1 |
|
34 | revlogv1 | |
35 | store |
|
35 | store | |
36 | treemanifest |
|
36 | treemanifest | |
@@ -68,9 +68,9 b'' | |||||
68 | $ cd shallow2 |
|
68 | $ cd shallow2 | |
69 | $ cat .hg/requires |
|
69 | $ cat .hg/requires | |
70 | dotencode |
|
70 | dotencode | |
|
71 | exp-remotefilelog-repo-req-1 | |||
71 | fncache |
|
72 | fncache | |
72 | generaldelta |
|
73 | generaldelta | |
73 | remotefilelog |
|
|||
74 | revlogv1 |
|
74 | revlogv1 | |
75 | store |
|
75 | store | |
76 | treemanifest |
|
76 | treemanifest | |
@@ -109,9 +109,9 b'' | |||||
109 | $ ls shallow3/.hg/store/data |
|
109 | $ ls shallow3/.hg/store/data | |
110 | $ cat shallow3/.hg/requires |
|
110 | $ cat shallow3/.hg/requires | |
111 | dotencode |
|
111 | dotencode | |
|
112 | exp-remotefilelog-repo-req-1 | |||
112 | fncache |
|
113 | fncache | |
113 | generaldelta |
|
114 | generaldelta | |
114 | remotefilelog |
|
|||
115 | revlogv1 |
|
115 | revlogv1 | |
116 | store |
|
116 | store | |
117 | treemanifest |
|
117 | treemanifest |
@@ -25,9 +25,9 b'' | |||||
25 | $ cd shallow |
|
25 | $ cd shallow | |
26 | $ cat .hg/requires |
|
26 | $ cat .hg/requires | |
27 | dotencode |
|
27 | dotencode | |
|
28 | exp-remotefilelog-repo-req-1 | |||
28 | fncache |
|
29 | fncache | |
29 | generaldelta |
|
30 | generaldelta | |
30 | remotefilelog |
|
|||
31 | revlogv1 |
|
31 | revlogv1 | |
32 | store |
|
32 | store | |
33 |
|
33 | |||
@@ -58,9 +58,9 b'' | |||||
58 | $ cd shallow2 |
|
58 | $ cd shallow2 | |
59 | $ cat .hg/requires |
|
59 | $ cat .hg/requires | |
60 | dotencode |
|
60 | dotencode | |
|
61 | exp-remotefilelog-repo-req-1 | |||
61 | fncache |
|
62 | fncache | |
62 | generaldelta |
|
63 | generaldelta | |
63 | remotefilelog |
|
|||
64 | revlogv1 |
|
64 | revlogv1 | |
65 | store |
|
65 | store | |
66 | $ ls .hg/store/data |
|
66 | $ ls .hg/store/data | |
@@ -106,8 +106,8 b' check its contents separately.' | |||||
106 | $ ls shallow3/.hg/store/data |
|
106 | $ ls shallow3/.hg/store/data | |
107 | $ cat shallow3/.hg/requires |
|
107 | $ cat shallow3/.hg/requires | |
108 | dotencode |
|
108 | dotencode | |
|
109 | exp-remotefilelog-repo-req-1 | |||
109 | fncache |
|
110 | fncache | |
110 | generaldelta |
|
111 | generaldelta | |
111 | remotefilelog |
|
|||
112 | revlogv1 |
|
112 | revlogv1 | |
113 | store |
|
113 | store |
General Comments 0
You need to be logged in to leave comments.
Login now