comparison mercurial/hg.py @ 46915:efc6f6a794bd

outgoing: merge the code handling --graph with the main one The --graph code had its own copy of the logic. With the previous reorganisation of the code, we can now merge it with the main code, reducing fragile complication. As a side effect, `hg out --graph` now use the right return code when they are nothing outgoing. This explain the change to output in `tests/test-largefiles-misc.t`. Differential Revision: https://phab.mercurial-scm.org/D10383
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 11 Apr 2021 20:00:46 +0200
parents 50b79f8b802d
children 0afe96e374a7
comparison
equal deleted inserted replaced
46914:50b79f8b802d 46915:efc6f6a794bd
30 destutil, 30 destutil,
31 discovery, 31 discovery,
32 error, 32 error,
33 exchange, 33 exchange,
34 extensions, 34 extensions,
35 graphmod,
35 httppeer, 36 httppeer,
36 localrepo, 37 localrepo,
37 lock, 38 lock,
38 logcmdutil, 39 logcmdutil,
39 logexchange, 40 logexchange,
1380 count += 1 1381 count += 1
1381 yield n 1382 yield n
1382 1383
1383 1384
1384 def outgoing(ui, repo, dest, opts): 1385 def outgoing(ui, repo, dest, opts):
1385 1386 if opts.get(b'graph'):
1387 logcmdutil.checkunsupportedgraphflags([], opts)
1386 o, other = _outgoing(ui, repo, dest, opts) 1388 o, other = _outgoing(ui, repo, dest, opts)
1387 ret = 1 1389 ret = 1
1388 try: 1390 try:
1389 if o: 1391 if o:
1390 ret = 0 1392 ret = 0
1391 1393
1392 ui.pager(b'outgoing') 1394 if opts.get(b'graph'):
1393 displayer = logcmdutil.changesetdisplayer(ui, repo, opts) 1395 revdag = logcmdutil.graphrevs(repo, o, opts)
1394 for n in _outgoing_filter(repo, o, opts): 1396 ui.pager(b'outgoing')
1395 displayer.show(repo[n]) 1397 displayer = logcmdutil.changesetdisplayer(
1396 displayer.close() 1398 ui, repo, opts, buffered=True
1399 )
1400 logcmdutil.displaygraph(
1401 ui, repo, revdag, displayer, graphmod.asciiedges
1402 )
1403 else:
1404 ui.pager(b'outgoing')
1405 displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
1406 for n in _outgoing_filter(repo, o, opts):
1407 displayer.show(repo[n])
1408 displayer.close()
1397 cmdutil.outgoinghooks(ui, repo, other, opts, o) 1409 cmdutil.outgoinghooks(ui, repo, other, opts, o)
1398 ret = min(ret, _outgoing_recurse(ui, repo, dest, opts)) 1410 ret = min(ret, _outgoing_recurse(ui, repo, dest, opts))
1399 return ret # exit code is zero since we found outgoing changes 1411 return ret # exit code is zero since we found outgoing changes
1400 finally: 1412 finally:
1401 other.close() 1413 other.close()