changeset 35355:9eb19b13e92a

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.
author Boris Feld <boris.feld@octobus.net>
date Thu, 07 Dec 2017 21:56:18 +0100
parents 6226668a7169
children a29fe459fc49
files hgext/lfs/__init__.py hgext/lfs/wrapper.py
diffstat 2 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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