comparison mercurial/hg.py @ 46912:627bb1875fee

outgoing: remove some early return Since 066b8d8f75b8, the push command accept multiple destination. However `hg outgoing` does not. On the way to fix this, we need to clean up the outgoing code. We start with removing some early return to make the code ready to house more changes. Differential Revision: https://phab.mercurial-scm.org/D10380
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 11 Apr 2021 19:20:14 +0200
parents 4452cb788404
children b2740c547243
comparison
equal deleted inserted replaced
46911:6071bfab6292 46912:627bb1875fee
1358 ret = min(ret, sub.outgoing(ui, dest, opts)) 1358 ret = min(ret, sub.outgoing(ui, dest, opts))
1359 return ret 1359 return ret
1360 1360
1361 limit = logcmdutil.getlimit(opts) 1361 limit = logcmdutil.getlimit(opts)
1362 o, other = _outgoing(ui, repo, dest, opts) 1362 o, other = _outgoing(ui, repo, dest, opts)
1363 ret = 1
1363 try: 1364 try:
1364 if not o: 1365 if o:
1365 cmdutil.outgoinghooks(ui, repo, other, opts, o) 1366 ret = 0
1366 return recurse() 1367
1367 1368 if opts.get(b'newest_first'):
1368 if opts.get(b'newest_first'): 1369 o.reverse()
1369 o.reverse() 1370 ui.pager(b'outgoing')
1370 ui.pager(b'outgoing') 1371 displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
1371 displayer = logcmdutil.changesetdisplayer(ui, repo, opts) 1372 count = 0
1372 count = 0 1373 for n in o:
1373 for n in o: 1374 if limit is not None and count >= limit:
1374 if limit is not None and count >= limit: 1375 break
1375 break 1376 parents = [p for p in repo.changelog.parents(n) if p != nullid]
1376 parents = [p for p in repo.changelog.parents(n) if p != nullid] 1377 if opts.get(b'no_merges') and len(parents) == 2:
1377 if opts.get(b'no_merges') and len(parents) == 2: 1378 continue
1378 continue 1379 count += 1
1379 count += 1 1380 displayer.show(repo[n])
1380 displayer.show(repo[n]) 1381 displayer.close()
1381 displayer.close()
1382 cmdutil.outgoinghooks(ui, repo, other, opts, o) 1382 cmdutil.outgoinghooks(ui, repo, other, opts, o)
1383 recurse() 1383 ret = min(ret, recurse())
1384 return 0 # exit code is zero since we found outgoing changes 1384 return ret # exit code is zero since we found outgoing changes
1385 finally: 1385 finally:
1386 other.close() 1386 other.close()
1387 1387
1388 1388
1389 def verify(repo, level=None): 1389 def verify(repo, level=None):