Well there are no private public functions in Python, but we generally treat
functions and variables starting with _ as private ones.
A function which needs to be overrided in extension should be a public one.
marmoute | |
mharbison72 |
hg-reviewers |
Well there are no private public functions in Python, but we generally treat
functions and variables starting with _ as private ones.
A function which needs to be overrided in extension should be a public one.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Path | Packages | |||
---|---|---|---|---|
M | hgext/lfs/wrapper.py (2 lines) | |||
M | mercurial/upgrade_utils/engine.py (4 lines) |
Status | Author | Revision | |
---|---|---|---|
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Changes Planned | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit |
"""upload given pointers from local blobstore""" | """upload given pointers from local blobstore""" | ||||
if not pointers: | if not pointers: | ||||
return | return | ||||
remoteblob = repo.svfs.lfsremoteblobstore | remoteblob = repo.svfs.lfsremoteblobstore | ||||
remoteblob.writebatch(pointers, repo.svfs.lfslocalblobstore) | remoteblob.writebatch(pointers, repo.svfs.lfslocalblobstore) | ||||
@eh.wrapfunction(upgrade_engine, b'_finishdatamigration') | @eh.wrapfunction(upgrade_engine, b'finishdatamigration') | ||||
def upgradefinishdatamigration(orig, ui, srcrepo, dstrepo, requirements): | def upgradefinishdatamigration(orig, ui, srcrepo, dstrepo, requirements): | ||||
orig(ui, srcrepo, dstrepo, requirements) | orig(ui, srcrepo, dstrepo, requirements) | ||||
# Skip if this hasn't been passed to reposetup() | # Skip if this hasn't been passed to reposetup() | ||||
if util.safehasattr( | if util.safehasattr( | ||||
srcrepo.svfs, b'lfslocalblobstore' | srcrepo.svfs, b'lfslocalblobstore' | ||||
) and util.safehasattr(dstrepo.svfs, b'lfslocalblobstore'): | ) and util.safehasattr(dstrepo.svfs, b'lfslocalblobstore'): | ||||
srclfsvfs = srcrepo.svfs.lfslocalblobstore.vfs | srclfsvfs = srcrepo.svfs.lfslocalblobstore.vfs |
return False | return False | ||||
# Skip other skipped files. | # Skip other skipped files. | ||||
if path in (b'lock', b'fncache'): | if path in (b'lock', b'fncache'): | ||||
return False | return False | ||||
return True | return True | ||||
def _finishdatamigration(ui, srcrepo, dstrepo, requirements): | def finishdatamigration(ui, srcrepo, dstrepo, requirements): | ||||
"""Hook point for extensions to perform additional actions during upgrade. | """Hook point for extensions to perform additional actions during upgrade. | ||||
This function is called after revlogs and store files have been copied but | This function is called after revlogs and store files have been copied but | ||||
before the new store is swapped into the original location. | before the new store is swapped into the original location. | ||||
""" | """ | ||||
def upgrade(ui, srcrepo, dstrepo, upgrade_op): | def upgrade(ui, srcrepo, dstrepo, upgrade_op): | ||||
): | ): | ||||
continue | continue | ||||
srcrepo.ui.status(_(b'copying %s\n') % p) | srcrepo.ui.status(_(b'copying %s\n') % p) | ||||
src = srcrepo.store.rawvfs.join(p) | src = srcrepo.store.rawvfs.join(p) | ||||
dst = dstrepo.store.rawvfs.join(p) | dst = dstrepo.store.rawvfs.join(p) | ||||
util.copyfile(src, dst, copystat=True) | util.copyfile(src, dst, copystat=True) | ||||
_finishdatamigration(ui, srcrepo, dstrepo, requirements) | finishdatamigration(ui, srcrepo, dstrepo, requirements) | ||||
ui.status(_(b'data fully migrated to temporary repository\n')) | ui.status(_(b'data fully migrated to temporary repository\n')) | ||||
backuppath = pycompat.mkdtemp(prefix=b'upgradebackup.', dir=srcrepo.path) | backuppath = pycompat.mkdtemp(prefix=b'upgradebackup.', dir=srcrepo.path) | ||||
backupvfs = vfsmod.vfs(backuppath) | backupvfs = vfsmod.vfs(backuppath) | ||||
# Make a backup of requires file first, as it is the first to be modified. | # Make a backup of requires file first, as it is the first to be modified. | ||||
util.copyfile(srcrepo.vfs.join(b'requires'), backupvfs.join(b'requires')) | util.copyfile(srcrepo.vfs.join(b'requires'), backupvfs.join(b'requires')) |