# HG changeset patch # User Boris Feld # Date 1518616423 -3600 # Node ID a43fdbd6f7ebcd8472caad3f7b5a87d28efb3241 # Parent 512706514555416b12b4a5b74f9ca53afbc09b2d wireproto: fix *_capabilities for change of API types Mercurial commit 2f7290555c96 introduced new types for *_capabilities, update the code to use them. diff -r 512706514555 -r a43fdbd6f7eb hgext3rd/evolve/obsdiscovery.py --- a/hgext3rd/evolve/obsdiscovery.py Wed Feb 14 09:46:56 2018 +0100 +++ b/hgext3rd/evolve/obsdiscovery.py Wed Feb 14 14:53:43 2018 +0100 @@ -698,10 +698,22 @@ caps = orig(repo, proto) enabled = _useobshashrange(repo) if obsolete.isenabled(repo, obsolete.exchangeopt) and enabled: + + # Compat hg 4.6+ (2f7290555c96) + bytesresponse = False + if util.safehasattr(caps, 'data'): + bytesresponse = True + caps = caps.data + caps = caps.split() - caps.append('_evoext_obshashrange_v1') + caps.append(b'_evoext_obshashrange_v1') caps.sort() - caps = ' '.join(caps) + caps = b' '.join(caps) + + # Compat hg 4.6+ (2f7290555c96) + if bytesresponse: + from mercurial import wireprototypes + caps = wireprototypes.bytesresponse(caps) return caps @eh.extsetup @@ -840,11 +852,23 @@ caps = orig(repo, proto) if (obsolete.isenabled(repo, obsolete.exchangeopt) and repo.ui.configbool('experimental', 'evolution.obsdiscovery', True)): + + # Compat hg 4.6+ (2f7290555c96) + bytesresponse = False + if util.safehasattr(caps, 'data'): + bytesresponse = True + caps = caps.data + caps = caps.split() - caps.append('_evoext_obshash_0') - caps.append('_evoext_obshash_1') + caps.append(b'_evoext_obshash_0') + caps.append(b'_evoext_obshash_1') caps.sort() - caps = ' '.join(caps) + caps = b' '.join(caps) + + # Compat hg 4.6+ (2f7290555c96) + if bytesresponse: + from mercurial import wireprototypes + caps = wireprototypes.bytesresponse(caps) return caps @eh.extsetup diff -r 512706514555 -r a43fdbd6f7eb hgext3rd/evolve/obsexchange.py --- a/hgext3rd/evolve/obsexchange.py Wed Feb 14 09:46:56 2018 +0100 +++ b/hgext3rd/evolve/obsexchange.py Wed Feb 14 14:53:43 2018 +0100 @@ -106,10 +106,22 @@ """wrapper to advertise new capability""" caps = orig(repo, proto) if obsolete.isenabled(repo, obsolete.exchangeopt): + + # Compat hg 4.6+ (2f7290555c96) + bytesresponse = False + if util.safehasattr(caps, 'data'): + bytesresponse = True + caps = caps.data + caps = caps.split() - caps.append('_evoext_getbundle_obscommon') + caps.append(b'_evoext_getbundle_obscommon') caps.sort() - caps = ' '.join(caps) + caps = b' '.join(caps) + + # Compat hg 4.6+ (2f7290555c96) + if bytesresponse: + from mercurial import wireprototypes + caps = wireprototypes.bytesresponse(caps) return caps @eh.extsetup