# HG changeset patch # User Augie Fackler # Date 2017-04-18 15:22:42 # Node ID 52902059edc77045c5601aa84f70c0ed6fd6527b # Parent d4074271166a5923b8da6cd5fe8d4d6624cd47f7 # Parent 8110d49e0558d3b50f8e82b5aa95c8f0e53e47e4 Merge stable with security patch. diff --git a/mercurial/repair.py b/mercurial/repair.py --- a/mercurial/repair.py +++ b/mercurial/repair.py @@ -868,14 +868,15 @@ def _upgraderepo(ui, srcrepo, dstrepo, r 'redeltamultibase' in actions) # Now copy other files in the store directory. - for p, kind, st in srcrepo.store.vfs.readdir('', stat=True): + # The sorted() makes execution deterministic. + for p, kind, st in sorted(srcrepo.store.vfs.readdir('', stat=True)): if not _upgradefilterstorefile(srcrepo, dstrepo, requirements, p, kind, st): continue srcrepo.ui.write(_('copying %s\n') % p) - src = srcrepo.store.vfs.join(p) - dst = dstrepo.store.vfs.join(p) + src = srcrepo.store.rawvfs.join(p) + dst = dstrepo.store.rawvfs.join(p) util.copyfile(src, dst, copystat=True) _upgradefinishdatamigration(ui, srcrepo, dstrepo, requirements) diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t --- a/tests/test-upgrade-repo.t +++ b/tests/test-upgrade-repo.t @@ -310,3 +310,45 @@ old store should be backed up undo.phaseroots $ cd .. + +store files with special filenames aren't encoded during copy + + $ hg init store-filenames + $ cd store-filenames + $ touch foo + $ hg -q commit -A -m initial + $ touch .hg/store/.XX_special_filename + + $ hg debugupgraderepo --run + upgrade will perform the following actions: + + requirements + preserved: dotencode, fncache, generaldelta, revlogv1, store + + beginning upgrade... + repository locked and read-only + creating temporary repository to stage migrated data: $TESTTMP/store-filenames/.hg/upgrade.* (glob) + (it is safe to interrupt this process any time before data migration completes) + migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog) + migrating 109 bytes in store; 107 bytes tracked data + migrating 1 filelogs containing 1 revisions (0 bytes in store; 0 bytes tracked data) + finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes + migrating 1 manifests containing 1 revisions (46 bytes in store; 45 bytes tracked data) + finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes + migrating changelog containing 1 revisions (63 bytes in store; 62 bytes tracked data) + finished migrating 1 changelog revisions; change in size: 0 bytes + finished migrating 3 total revisions; total change in store size: 0 bytes + copying .XX_special_filename + copying phaseroots + data fully migrated to temporary repository + marking source repository as being upgraded; clients will be unable to read from repository + starting in-place swap of repository data + replaced files will be backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob) + replacing store... + store replacement complete; repository was inconsistent for *s (glob) + finalizing requirements file and making repository readable again + removing temporary repository $TESTTMP/store-filenames/.hg/upgrade.* (glob) + copy of old repository backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob) + the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified + + $ cd ..