Mercurial > hg-stable
comparison hgext/remotefilelog/__init__.py @ 40563:525dcf5c1d41
remotefilelog: remove some BC code related to streamclone
Since remotefilelog is now moved to core and we have
streamclone._walkstreamfiles() in core, we don't need to have the backward
compatibility code.
People with old mercurial version should use remotefilelog from hg-experimental
repo as IMO remotefilelog will go under a good refactoring and old clients will
break.
# no-check-commit foo_bar function name
Differential Revision: https://phab.mercurial-scm.org/D5189
author | Pulkit Goyal <pulkit@yandex-team.ru> |
---|---|
date | Wed, 24 Oct 2018 16:59:05 +0300 |
parents | b35a096b9bff |
children | 6f0b6905ef6f |
comparison
equal
deleted
inserted
replaced
40562:b35a096b9bff | 40563:525dcf5c1d41 |
---|---|
119 repair, | 119 repair, |
120 repoview, | 120 repoview, |
121 revset, | 121 revset, |
122 scmutil, | 122 scmutil, |
123 smartset, | 123 smartset, |
124 streamclone, | |
124 templatekw, | 125 templatekw, |
125 util, | 126 util, |
126 ) | 127 ) |
127 from . import ( | 128 from . import ( |
128 constants, | 129 constants, |
140 ) | 141 ) |
141 | 142 |
142 # ensures debug commands are registered | 143 # ensures debug commands are registered |
143 hgdebugcommands.command | 144 hgdebugcommands.command |
144 | 145 |
145 try: | |
146 from mercurial import streamclone | |
147 streamclone._walkstreamfiles | |
148 hasstreamclone = True | |
149 except Exception: | |
150 hasstreamclone = False | |
151 | |
152 cmdtable = {} | 146 cmdtable = {} |
153 command = registrar.command(cmdtable) | 147 command = registrar.command(cmdtable) |
154 | 148 |
155 configtable = {} | 149 configtable = {} |
156 configitem = registrar.configitem(configtable) | 150 configitem = registrar.configitem(configtable) |
303 opts['excludepattern'] = '\0'.join(repo.excludepattern) | 297 opts['excludepattern'] = '\0'.join(repo.excludepattern) |
304 return remote._callstream('stream_out_shallow', **opts) | 298 return remote._callstream('stream_out_shallow', **opts) |
305 else: | 299 else: |
306 return orig() | 300 return orig() |
307 extensions.wrapfunction(remote, 'stream_out', stream_out_shallow) | 301 extensions.wrapfunction(remote, 'stream_out', stream_out_shallow) |
308 if hasstreamclone: | 302 def stream_wrap(orig, op): |
309 def stream_wrap(orig, op): | 303 setup_streamout(op.repo, op.remote) |
310 setup_streamout(op.repo, op.remote) | 304 return orig(op) |
311 return orig(op) | 305 extensions.wrapfunction( |
312 extensions.wrapfunction( | 306 streamclone, 'maybeperformlegacystreamclone', stream_wrap) |
313 streamclone, 'maybeperformlegacystreamclone', stream_wrap) | 307 |
314 | 308 def canperformstreamclone(orig, pullop, bundle2=False): |
315 def canperformstreamclone(orig, pullop, bundle2=False): | 309 # remotefilelog is currently incompatible with the |
316 # remotefilelog is currently incompatible with the | 310 # bundle2 flavor of streamclones, so force us to use |
317 # bundle2 flavor of streamclones, so force us to use | 311 # v1 instead. |
318 # v1 instead. | 312 if 'v2' in pullop.remotebundle2caps.get('stream', []): |
319 if 'v2' in pullop.remotebundle2caps.get('stream', []): | 313 pullop.remotebundle2caps['stream'] = [ |
320 pullop.remotebundle2caps['stream'] = [ | 314 c for c in pullop.remotebundle2caps['stream'] |
321 c for c in pullop.remotebundle2caps['stream'] | 315 if c != 'v2'] |
322 if c != 'v2'] | 316 if bundle2: |
323 if bundle2: | 317 return False, None |
324 return False, None | 318 supported, requirements = orig(pullop, bundle2=bundle2) |
325 supported, requirements = orig(pullop, bundle2=bundle2) | 319 if requirements is not None: |
326 if requirements is not None: | |
327 requirements.add(constants.SHALLOWREPO_REQUIREMENT) | |
328 return supported, requirements | |
329 extensions.wrapfunction( | |
330 streamclone, 'canperformstreamclone', canperformstreamclone) | |
331 else: | |
332 def stream_in_shallow(orig, repo, remote, requirements): | |
333 setup_streamout(repo, remote) | |
334 requirements.add(constants.SHALLOWREPO_REQUIREMENT) | 320 requirements.add(constants.SHALLOWREPO_REQUIREMENT) |
335 return orig(repo, remote, requirements) | 321 return supported, requirements |
336 extensions.wrapfunction( | 322 extensions.wrapfunction( |
337 localrepo.localrepository, 'stream_in', stream_in_shallow) | 323 streamclone, 'canperformstreamclone', canperformstreamclone) |
338 | 324 |
339 try: | 325 try: |
340 orig(ui, repo, *args, **opts) | 326 orig(ui, repo, *args, **opts) |
341 finally: | 327 finally: |
342 if opts.get('shallow'): | 328 if opts.get('shallow'): |