lfs: allow to run 'debugupgraderepo' on repo with largefiles
authorBoris Feld <boris.feld@octobus.net>
Thu, 07 Dec 2017 21:56:18 +0100
changeset 35346 9eb19b13e92a
parent 35345 6226668a7169
child 35347 a29fe459fc49
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.
hgext/lfs/__init__.py
hgext/lfs/wrapper.py
--- 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