comparison mercurial/exchange.py @ 47012:d55b71393907

node: replace nullid and friends with nodeconstants class The introduction of 256bit hashes require changes to nullid and other constant magic values. Start pushing them down from repository and revlog where sensible. Differential Revision: https://phab.mercurial-scm.org/D9465
author Joerg Sonnenberger <joerg@bec.de>
date Mon, 29 Mar 2021 01:52:06 +0200
parents 3f87d2af0bd6
children 19d4802cb304
comparison
equal deleted inserted replaced
46992:5fa019ceb499 47012:d55b71393907
11 import weakref 11 import weakref
12 12
13 from .i18n import _ 13 from .i18n import _
14 from .node import ( 14 from .node import (
15 hex, 15 hex,
16 nullid,
17 nullrev, 16 nullrev,
18 ) 17 )
19 from . import ( 18 from . import (
20 bookmarks as bookmod, 19 bookmarks as bookmod,
21 bundle2, 20 bundle2,
162 cl = repo.changelog 161 cl = repo.changelog
163 if common: 162 if common:
164 hasnode = cl.hasnode 163 hasnode = cl.hasnode
165 common = [n for n in common if hasnode(n)] 164 common = [n for n in common if hasnode(n)]
166 else: 165 else:
167 common = [nullid] 166 common = [repo.nullid]
168 if not heads: 167 if not heads:
169 heads = cl.heads() 168 heads = cl.heads()
170 return discovery.outgoing(repo, common, heads) 169 return discovery.outgoing(repo, common, heads)
171 170
172 171
1837 # will enable the server to treat clients that support clone bundles 1836 # will enable the server to treat clients that support clone bundles
1838 # differently from those that don't. 1837 # differently from those that don't.
1839 if ( 1838 if (
1840 pullop.remote.capable(b'clonebundles') 1839 pullop.remote.capable(b'clonebundles')
1841 and pullop.heads is None 1840 and pullop.heads is None
1842 and list(pullop.common) == [nullid] 1841 and list(pullop.common) == [pullop.repo.nullid]
1843 ): 1842 ):
1844 kwargs[b'cbattempted'] = pullop.clonebundleattempted 1843 kwargs[b'cbattempted'] = pullop.clonebundleattempted
1845 1844
1846 if streaming: 1845 if streaming:
1847 pullop.repo.ui.status(_(b'streaming all changes\n')) 1846 pullop.repo.ui.status(_(b'streaming all changes\n'))
1848 elif not pullop.fetch: 1847 elif not pullop.fetch:
1849 pullop.repo.ui.status(_(b"no changes found\n")) 1848 pullop.repo.ui.status(_(b"no changes found\n"))
1850 pullop.cgresult = 0 1849 pullop.cgresult = 0
1851 else: 1850 else:
1852 if pullop.heads is None and list(pullop.common) == [nullid]: 1851 if pullop.heads is None and list(pullop.common) == [pullop.repo.nullid]:
1853 pullop.repo.ui.status(_(b"requesting all changes\n")) 1852 pullop.repo.ui.status(_(b"requesting all changes\n"))
1854 if obsolete.isenabled(pullop.repo, obsolete.exchangeopt): 1853 if obsolete.isenabled(pullop.repo, obsolete.exchangeopt):
1855 remoteversions = bundle2.obsmarkersversion(pullop.remotebundle2caps) 1854 remoteversions = bundle2.obsmarkersversion(pullop.remotebundle2caps)
1856 if obsolete.commonversion(remoteversions) is not None: 1855 if obsolete.commonversion(remoteversions) is not None:
1857 kwargs[b'obsmarkers'] = True 1856 kwargs[b'obsmarkers'] = True
1918 if not pullop.fetch: 1917 if not pullop.fetch:
1919 pullop.repo.ui.status(_(b"no changes found\n")) 1918 pullop.repo.ui.status(_(b"no changes found\n"))
1920 pullop.cgresult = 0 1919 pullop.cgresult = 0
1921 return 1920 return
1922 tr = pullop.gettransaction() 1921 tr = pullop.gettransaction()
1923 if pullop.heads is None and list(pullop.common) == [nullid]: 1922 if pullop.heads is None and list(pullop.common) == [pullop.repo.nullid]:
1924 pullop.repo.ui.status(_(b"requesting all changes\n")) 1923 pullop.repo.ui.status(_(b"requesting all changes\n"))
1925 elif pullop.heads is None and pullop.remote.capable(b'changegroupsubset'): 1924 elif pullop.heads is None and pullop.remote.capable(b'changegroupsubset'):
1926 # issue1320, avoid a race if remote changed after discovery 1925 # issue1320, avoid a race if remote changed after discovery
1927 pullop.heads = pullop.rheads 1926 pullop.heads = pullop.rheads
1928 1927