# HG changeset patch # User Matt Harbison # Date 2018-03-27 03:02:50 # Node ID a54113fcc8c9ce2cc59a463ddd3f0ddce3549521 # Parent d30810d09d6fe9d33cb3fecab785975fa7d8934f 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 diff --git a/hgext/lfs/__init__.py b/hgext/lfs/__init__.py --- a/hgext/lfs/__init__.py +++ b/hgext/lfs/__init__.py @@ -307,9 +307,6 @@ def extsetup(ui): wrapper.upgraderequirements) wrapfunction(changegroup, - 'supportedoutgoingversions', - wrapper.supportedoutgoingversions) - wrapfunction(changegroup, 'allsupportedversions', wrapper.allsupportedversions) diff --git a/hgext/lfs/wrapper.py b/hgext/lfs/wrapper.py --- a/hgext/lfs/wrapper.py +++ b/hgext/lfs/wrapper.py @@ -30,14 +30,6 @@ from . import ( 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') diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -36,6 +36,8 @@ from .utils import ( _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 @@ def supportedoutgoingversions(repo): # 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):