comparison mercurial/revset.py @ 46933:9519312ecd81

outgoing: use `get_push_paths` in the revset too The revsets now use the same code as everyone and is ready for entry in `[paths]` pointing to multiple entries. Differential Revision: https://phab.mercurial-scm.org/D10393
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 11 Apr 2021 19:18:54 +0200
parents 4452cb788404
children c5c2936f6fb2
comparison
equal deleted inserted replaced
46932:dec31caf5fd6 46933:9519312ecd81
1853 l = getargs(x, 0, 1, _(b"outgoing takes one or no arguments")) 1853 l = getargs(x, 0, 1, _(b"outgoing takes one or no arguments"))
1854 # i18n: "outgoing" is a keyword 1854 # i18n: "outgoing" is a keyword
1855 dest = ( 1855 dest = (
1856 l and getstring(l[0], _(b"outgoing requires a repository path")) or b'' 1856 l and getstring(l[0], _(b"outgoing requires a repository path")) or b''
1857 ) 1857 )
1858 if not dest: 1858 if dest:
1859 # ui.getpath() explicitly tests for None, not just a boolean 1859 # ui.getpath() explicitly tests for None, not just a boolean
1860 dest = None 1860 dests = [dest]
1861 path = repo.ui.getpath(dest, default=(b'default-push', b'default')) 1861 else:
1862 if not path: 1862 dests = []
1863 raise error.Abort( 1863 missing = set()
1864 _(b'default repository not configured!'), 1864 for path in urlutil.get_push_paths(repo, repo.ui, dests):
1865 hint=_(b"see 'hg help config.paths'"), 1865 dest = path.pushloc or path.loc
1866 ) 1866 branches = path.branch, []
1867 dest = path.pushloc or path.loc 1867
1868 branches = path.branch, [] 1868 revs, checkout = hg.addbranchrevs(repo, repo, branches, [])
1869 1869 if revs:
1870 revs, checkout = hg.addbranchrevs(repo, repo, branches, []) 1870 revs = [repo.lookup(rev) for rev in revs]
1871 if revs: 1871 other = hg.peer(repo, {}, dest)
1872 revs = [repo.lookup(rev) for rev in revs] 1872 try:
1873 other = hg.peer(repo, {}, dest) 1873 repo.ui.pushbuffer()
1874 try: 1874 outgoing = discovery.findcommonoutgoing(repo, other, onlyheads=revs)
1875 repo.ui.pushbuffer() 1875 repo.ui.popbuffer()
1876 outgoing = discovery.findcommonoutgoing(repo, other, onlyheads=revs) 1876 finally:
1877 repo.ui.popbuffer() 1877 other.close()
1878 finally: 1878 missing.update(outgoing.missing)
1879 other.close()
1880 cl = repo.changelog 1879 cl = repo.changelog
1881 o = {cl.rev(r) for r in outgoing.missing} 1880 o = {cl.rev(r) for r in missing}
1882 return subset & o 1881 return subset & o
1883 1882
1884 1883
1885 @predicate(b'p1([set])', safe=True) 1884 @predicate(b'p1([set])', safe=True)
1886 def p1(repo, subset, x): 1885 def p1(repo, subset, x):