Mercurial > evolve
comparison hgext3rd/topic/discovery.py @ 6564:2d3771d61068
topic: use a config option to signal explicit target arguments (for tns)
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Mon, 09 Oct 2023 15:07:38 -0300 |
parents | bdc8978232de |
children | cb009f13126a |
comparison
equal
deleted
inserted
replaced
6563:bdc8978232de | 6564:2d3771d61068 |
---|---|
10 bundle2, | 10 bundle2, |
11 discovery, | 11 discovery, |
12 encoding, | 12 encoding, |
13 exchange, | 13 exchange, |
14 extensions, | 14 extensions, |
15 hg, | |
15 scmutil, | 16 scmutil, |
16 util, | 17 util, |
17 wireprototypes, | 18 wireprototypes, |
18 wireprotov1server, | 19 wireprotov1server, |
19 ) | 20 ) |
352 else: | 353 else: |
353 # _branchinfo() gets called through branchinfo(), the latter will need | 354 # _branchinfo() gets called through branchinfo(), the latter will need |
354 # to do the conversion | 355 # to do the conversion |
355 return orig(self, rev, **kwargs) | 356 return orig(self, rev, **kwargs) |
356 | 357 |
358 def wraphgpeer(orig, uiorrepo, opts, *args, **kwargs): | |
359 """hg.peer() that checks if there are explicit arguments for e.g. pull""" | |
360 peer = orig(uiorrepo, opts, *args, **kwargs) | |
361 if any(opts.get(k) for k in (b'rev', b'bookmark', b'branch')): | |
362 peer.ui.setconfig(b'_internal', b'tns-explicit-target', True, b'topic-namespaces') | |
363 return peer | |
364 | |
357 def wraphgremoteui(orig, src, opts): | 365 def wraphgremoteui(orig, src, opts): |
358 """hg.remoteui() that copies tns-related config options to peer ui""" | 366 """hg.remoteui() that copies tns-related config options to peer ui""" |
359 dst = orig(src, opts) | 367 dst = orig(src, opts) |
360 if util.safehasattr(src, 'baseui'): # looks like a repository | 368 if util.safehasattr(src, 'baseui'): # looks like a repository |
361 src = src.ui | 369 src = src.ui |
387 extensions.wrapfunction(bundle2, 'handlecheckupdatedheads', handlecheckheads) | 395 extensions.wrapfunction(bundle2, 'handlecheckupdatedheads', handlecheckheads) |
388 bundle2.handlecheckupdatedheads.params = frozenset() | 396 bundle2.handlecheckupdatedheads.params = frozenset() |
389 bundle2.parthandlermapping[b'check:updated-heads'] = bundle2.handlecheckupdatedheads | 397 bundle2.parthandlermapping[b'check:updated-heads'] = bundle2.handlecheckupdatedheads |
390 extensions.wrapfunction(exchange, '_pushb2phases', _pushb2phases) | 398 extensions.wrapfunction(exchange, '_pushb2phases', _pushb2phases) |
391 exchange.b2partsgenmapping[b'phase'] = exchange._pushb2phases | 399 exchange.b2partsgenmapping[b'phase'] = exchange._pushb2phases |
400 extensions.wrapfunction(hg, 'peer', wraphgpeer) | |
392 extensions.wrapfunction(hg, 'remoteui', wraphgremoteui) | 401 extensions.wrapfunction(hg, 'remoteui', wraphgremoteui) |