lfs: allow to run 'debugupgraderepo' on repo with largefiles
The extensions wrap the necessary function to ensure the 'lfs' requirements
won't be dropped.
It is now possible to run `hg debugupgraderepo` on a repository with lfs.
--- a/hgext/lfs/__init__.py Thu Dec 07 20:27:03 2017 +0100
+++ b/hgext/lfs/__init__.py Thu Dec 07 21:56:18 2017 +0100
@@ -46,6 +46,7 @@
registrar,
revlog,
scmutil,
+ upgrade,
vfs as vfsmod,
)
@@ -139,6 +140,12 @@
wrapfunction(scmutil, 'wrapconvertsink', wrapper.convertsink)
+ wrapfunction(upgrade, 'preservedrequirements',
+ wrapper.upgraderequirements)
+
+ wrapfunction(upgrade, 'supporteddestrequirements',
+ wrapper.upgraderequirements)
+
wrapfunction(changegroup,
'supportedoutgoingversions',
wrapper.supportedoutgoingversions)
--- a/hgext/lfs/wrapper.py Thu Dec 07 20:27:03 2017 +0100
+++ b/hgext/lfs/wrapper.py Thu Dec 07 21:56:18 2017 +0100
@@ -302,3 +302,9 @@
remoteblob = repo.svfs.lfsremoteblobstore
remoteblob.writebatch(pointers, repo.svfs.lfslocalblobstore)
+
+def upgraderequirements(orig, repo):
+ reqs = orig(repo)
+ if 'lfs' in repo.requirements:
+ reqs.add('lfs')
+ return reqs