upgrade: remove the upgrade module

Summary: It is about legacy revlog formats that are no longer relevant.

Reviewed By: DurhamG

Differential Revision: D23390436

fbshipit-source-id: 58c2c432804181bcc6517d6c988777b843fc9ba4
This commit is contained in:
Jun Wu 2020-08-31 11:55:57 -07:00 committed by Facebook GitHub Bot
parent 2d5000293e
commit 1199790982
7 changed files with 4 additions and 1158 deletions

View File

@ -59,7 +59,6 @@ from edenscm.mercurial import (
registrar,
revlog,
scmutil,
upgrade,
util,
vfs as vfsmod,
)
@ -150,11 +149,6 @@ def extsetup(ui):
# "convert"-related and missing them is not fatal. Ignore them so
# bootstrapping from an old Mercurial works.
wrapfunction(scmutil, "wrapconvertsink", wrapper.convertsink)
wrapfunction(
upgrade, "_finishdatamigration", wrapper.upgradefinishdatamigration
)
wrapfunction(upgrade, "preservedrequirements", wrapper.upgraderequirements)
wrapfunction(upgrade, "supporteddestrequirements", wrapper.upgraderequirements)
except AttributeError:
pass

View File

@ -350,23 +350,3 @@ def uploadblobs(repo, pointers):
remoteblob = repo.svfs.lfsremoteblobstore
remoteblob.writebatch(pointers, repo.svfs.lfslocalblobstore)
def upgradefinishdatamigration(orig, ui, srcrepo, dstrepo, requirements):
orig(ui, srcrepo, dstrepo, requirements)
srclfsvfs = srcrepo.svfs.lfslocalblobstore.vfs
dstlfsvfs = dstrepo.svfs.lfslocalblobstore.vfs
if srclfsvfs and dstlfsvfs:
for dirpath, dirs, files in srclfsvfs.walk():
for oid in files:
ui.write(_("copying lfs blob %s\n") % oid)
srclfsvfs.linktovfs(oid, dstlfsvfs)
def upgraderequirements(orig, repo):
reqs = orig(repo)
if "lfs" in repo.requirements:
reqs.add("lfs")
return reqs

View File

@ -77,7 +77,6 @@ from .. import (
streamclone,
templater,
treestate,
upgrade,
util,
vfs as vfsmod,
visibility,
@ -1211,73 +1210,6 @@ def debugfileset(ui, repo, expr, **opts):
ui.write("%s\n" % f)
@command("debugformat", [] + cmdutil.formatteropts, _(""))
def debugformat(ui, repo, **opts):
"""display format information about the current repository
Use --verbose to get extra information about current config value and
Mercurial default."""
maxvariantlength = max(len(fv.name) for fv in upgrade.allformatvariant)
maxvariantlength = max(len("format-variant"), maxvariantlength)
def makeformatname(name):
return "%s:" + (" " * (maxvariantlength - len(name)))
fm = ui.formatter("debugformat", opts)
if fm.isplain():
def formatvalue(value):
if util.safehasattr(value, "startswith"):
return value
if value:
return "yes"
else:
return "no"
else:
formatvalue = pycompat.identity
fm.plain("format-variant")
fm.plain(" " * (maxvariantlength - len("format-variant")))
fm.plain(" repo")
if ui.verbose:
fm.plain(" config default")
fm.plain("\n")
for fv in upgrade.allformatvariant:
fm.startitem()
repovalue = fv.fromrepo(repo)
configvalue = fv.fromconfig(repo)
if repovalue != configvalue:
namelabel = "formatvariant.name.mismatchconfig"
repolabel = "formatvariant.repo.mismatchconfig"
elif repovalue != fv.default:
namelabel = "formatvariant.name.mismatchdefault"
repolabel = "formatvariant.repo.mismatchdefault"
else:
namelabel = "formatvariant.name.uptodate"
repolabel = "formatvariant.repo.uptodate"
fm.write("name", makeformatname(fv.name), fv.name, label=namelabel)
fm.write("repo", " %3s", formatvalue(repovalue), label=repolabel)
if fv.default != configvalue:
configlabel = "formatvariant.config.special"
else:
configlabel = "formatvariant.config.default"
fm.condwrite(
ui.verbose, "config", " %6s", formatvalue(configvalue), label=configlabel
)
fm.condwrite(
ui.verbose,
"default",
" %7s",
formatvalue(fv.default),
label="formatvariant.default",
)
fm.plain("\n")
fm.end()
@command("debugfsinfo|debugfs", [], _("[PATH]"), norepo=True)
def debugfsinfo(ui, path="."):
"""show information detected about current filesystem"""
@ -3300,35 +3232,6 @@ def debugupdatecaches(ui, repo, *pats, **opts):
repo.updatecaches()
@command(
"debugupgraderepo",
[
("o", "optimize", [], _("extra optimization to perform"), _("NAME")),
("", "run", False, _("performs an upgrade")),
],
)
def debugupgraderepo(ui, repo, run=False, optimize=None):
"""upgrade a repository to use different features
If no arguments are specified, the repository is evaluated for upgrade
and a list of problems and potential optimizations is printed.
With ``--run``, a repository upgrade is performed. Behavior of the upgrade
can be influenced via additional arguments. More details will be provided
by the command output when run without ``--run``.
During the upgrade, the repository will be locked and no writes will be
allowed.
At the end of the upgrade, the repository may not be readable while new
repository data is swapped in. This window will be as long as it takes to
rename some directories inside the ``.hg`` directory. On most machines, this
should complete almost instantaneously and the chances of a consumer being
unable to access the repository should be low.
"""
return upgrade.upgraderepo(ui, repo, run=run, optimize=optimize)
@command("debugvisibleheads", cmdutil.templateopts)
def debugvisibleheads(ui, repo, **opts):
"""print visible heads"""

File diff suppressed because it is too large Load Diff

View File

@ -120,7 +120,6 @@ Show debug commands if there are no other candidates
debugextensions
debugfilerevision
debugfileset
debugformat
debugfsinfo
debugfsync
debuggetbundle
@ -173,7 +172,6 @@ Show debug commands if there are no other candidates
debugthrowrustexception
debugtreestate
debugupdatecaches
debugupgraderepo
debugvisibility
debugvisibleheads
debugwalk
@ -407,7 +405,6 @@ Show all commands + options
debugextensions: excludedefault, template
debugfilerevision: rev, include, exclude
debugfileset: rev
debugformat: template
debugfsinfo:
debugfsync:
debuggetbundle: head, common, type
@ -460,7 +457,6 @@ Show all commands + options
debugthrowrustexception:
debugtreestate:
debugupdatecaches:
debugupgraderepo: optimize, run
debugvisibility:
debugvisibleheads: style, template
debugwalk: include, exclude

View File

@ -143,10 +143,11 @@ Test debuglocks command:
infinitepushbackup.lock: free
Test WdirUnsupported exception
(Rust changelog does not resolve ffffffffffffffffffffffffffffffffffffffff)
$ hg debugdata -c ffffffffffffffffffffffffffffffffffffffff
abort: working directory revision cannot be specified
[255]
# $ hg debugdata -c ffffffffffffffffffffffffffffffffffffffff
# abort: working directory revision cannot be specified
# [255]
Test cache warming command

View File

@ -995,7 +995,6 @@ Test list of internal help commands
debugfilerevision
dump internal metadata for given file revisions
debugfileset parse and apply a fileset specification
debugformat display format information about the current repository
debugfsinfo show information detected about current filesystem
debugfsync call fsync on newly modified key storage files
debuggentrees
@ -1087,8 +1086,6 @@ Test list of internal help commands
manage treestate
debugupdatecaches
warm all known caches in the repository
debugupgraderepo
upgrade a repository to use different features
debugvisibility
control visibility tracking
debugvisibleheads