lfs: move the 'supportedoutgoingversions' handling to changegroup.py
This handling already exists here for the narrow extension. We still need to
either figure out how to enable changegroup v3 without the extension, or figure
out how to let the server detect that the client doesn't have it loaded, and
emit a user friendly error[1]. I can't tell if D1944 is the appropriate vehicle
for the latter.
[1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2018-January/109550.html
--- a/hgext/lfs/__init__.py Sun Mar 04 09:58:57 2018 -0500
+++ b/hgext/lfs/__init__.py Mon Mar 26 23:02:50 2018 -0400
@@ -307,9 +307,6 @@
wrapper.upgraderequirements)
wrapfunction(changegroup,
- 'supportedoutgoingversions',
- wrapper.supportedoutgoingversions)
- wrapfunction(changegroup,
'allsupportedversions',
wrapper.allsupportedversions)
--- a/hgext/lfs/wrapper.py Sun Mar 04 09:58:57 2018 -0500
+++ b/hgext/lfs/wrapper.py Mon Mar 26 23:02:50 2018 -0400
@@ -30,14 +30,6 @@
pointer,
)
-def supportedoutgoingversions(orig, repo):
- versions = orig(repo)
- if 'lfs' in repo.requirements:
- versions.discard('01')
- versions.discard('02')
- versions.add('03')
- return versions
-
def allsupportedversions(orig, ui):
versions = orig(ui)
versions.add('03')
--- a/mercurial/changegroup.py Sun Mar 04 09:58:57 2018 -0500
+++ b/mercurial/changegroup.py Mon Mar 26 23:02:50 2018 -0400
@@ -36,6 +36,8 @@
_CHANGEGROUPV2_DELTA_HEADER = "20s20s20s20s20s"
_CHANGEGROUPV3_DELTA_HEADER = ">20s20s20s20s20sH"
+LFS_REQUIREMENT = 'lfs'
+
# When narrowing is finalized and no longer subject to format changes,
# we should move this to just "narrow" or similar.
NARROW_REQUIREMENT = 'narrowhg-experimental'
@@ -912,6 +914,12 @@
# support that for stripping and unbundling to work.
versions.discard('01')
versions.discard('02')
+ if LFS_REQUIREMENT in repo.requirements:
+ # Versions 01 and 02 don't support revlog flags, and we need to
+ # mark LFS entries with REVIDX_EXTSTORED.
+ versions.discard('01')
+ versions.discard('02')
+
return versions
def localversion(repo):