Mercurial > public > mercurial-scm > hg
comparison mercurial/upgrade.py @ 42691:5535a2201ff1
upgrade: introduce a _copyrevlog method
This function copies a revlog from the old store to the new one, without
re-adding all deltas manually. This will eventually save a lot of time when some
revlog does not needs any conversions.
Code actually using this will be introduced in later changesets.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 30 Jul 2019 19:58:44 +0200 |
parents | 095dcdd0d55c |
children | 0812d9fb63fe |
comparison
equal
deleted
inserted
replaced
42690:095dcdd0d55c | 42691:5535a2201ff1 |
---|---|
530 mandir = path[:-len('00manifest.i')] | 530 mandir = path[:-len('00manifest.i')] |
531 return manifest.manifestrevlog(repo.svfs, tree=mandir) | 531 return manifest.manifestrevlog(repo.svfs, tree=mandir) |
532 else: | 532 else: |
533 #reverse of "/".join(("data", path + ".i")) | 533 #reverse of "/".join(("data", path + ".i")) |
534 return filelog.filelog(repo.svfs, path[5:-2]) | 534 return filelog.filelog(repo.svfs, path[5:-2]) |
535 | |
536 def _copyrevlog(tr, destrepo, oldrl, unencodedname): | |
537 """copy all relevant files for `oldrl` into `destrepo` store | |
538 | |
539 Files are copied "as is" without any transformation. The copy is performed | |
540 without extra checks. Callers are responsible for making sure the copied | |
541 content is compatible with format of the destination repository. | |
542 """ | |
543 oldrl = getattr(oldrl, '_revlog', oldrl) | |
544 newrl = _revlogfrompath(destrepo, unencodedname) | |
545 newrl = getattr(newrl, '_revlog', newrl) | |
546 | |
547 oldvfs = oldrl.opener | |
548 newvfs = newrl.opener | |
549 oldindex = oldvfs.join(oldrl.indexfile) | |
550 newindex = newvfs.join(newrl.indexfile) | |
551 olddata = oldvfs.join(oldrl.datafile) | |
552 newdata = newvfs.join(newrl.datafile) | |
553 | |
554 newdir = newvfs.dirname(newrl.indexfile) | |
555 newvfs.makedirs(newdir) | |
556 | |
557 util.copyfile(oldindex, newindex) | |
558 if oldrl.opener.exists(olddata): | |
559 util.copyfile(olddata, newdata) | |
560 | |
561 if not (unencodedname.endswith('00changelog.i') | |
562 or unencodedname.endswith('00manifest.i')): | |
563 destrepo.svfs.fncache.add(unencodedname) | |
535 | 564 |
536 def _clonerevlogs(ui, srcrepo, dstrepo, tr, deltareuse, forcedeltabothparents): | 565 def _clonerevlogs(ui, srcrepo, dstrepo, tr, deltareuse, forcedeltabothparents): |
537 """Copy revlogs between 2 repos.""" | 566 """Copy revlogs between 2 repos.""" |
538 revcount = 0 | 567 revcount = 0 |
539 srcsize = 0 | 568 srcsize = 0 |