comparison mercurial/hg.py @ 12400:40852b4b910c

incoming/outgoing: Fix recursion on sub repositories Incoming and outgoing are fixed so they go through the whole three of repositories instead of only visiting first level of sub repositories.
author Erik Zielke <ez@aragost.com>
date Fri, 24 Sep 2010 12:00:55 +0200
parents f2daa6ab514a
children 55f0648c7e2d
comparison
equal deleted inserted replaced
12399:4fee1fd3de9a 12400:40852b4b910c
407 elif remind: 407 elif remind:
408 repo.ui.status(_("(branch merge, don't forget to commit)\n")) 408 repo.ui.status(_("(branch merge, don't forget to commit)\n"))
409 return stats[3] > 0 409 return stats[3] > 0
410 410
411 def incoming(ui, repo, source, opts): 411 def incoming(ui, repo, source, opts):
412 def recurse():
413 ret = 1
414 if opts.get('subrepos'):
415 ctx = repo[None]
416 for subpath in sorted(ctx.substate):
417 sub = ctx.sub(subpath)
418 ret = min(ret, sub.incoming(ui, source, opts))
419 return ret
420
412 limit = cmdutil.loglimit(opts) 421 limit = cmdutil.loglimit(opts)
413 source, branches = parseurl(ui.expandpath(source), opts.get('branch')) 422 source, branches = parseurl(ui.expandpath(source), opts.get('branch'))
414 other = repository(remoteui(repo, opts), source) 423 other = repository(remoteui(repo, opts), source)
415 ui.status(_('comparing with %s\n') % url.hidepassword(source)) 424 ui.status(_('comparing with %s\n') % url.hidepassword(source))
416 revs, checkout = addbranchrevs(repo, other, branches, opts.get('rev')) 425 revs, checkout = addbranchrevs(repo, other, branches, opts.get('rev'))
424 try: 433 try:
425 os.unlink(opts["bundle"]) 434 os.unlink(opts["bundle"])
426 except: 435 except:
427 pass 436 pass
428 ui.status(_("no changes found\n")) 437 ui.status(_("no changes found\n"))
429 return 1 438 return recurse()
430 439
431 cleanup = None 440 cleanup = None
432 try: 441 try:
433 fname = opts["bundle"] 442 fname = opts["bundle"]
434 if fname or not other.local(): 443 if fname or not other.local():
467 finally: 476 finally:
468 if hasattr(other, 'close'): 477 if hasattr(other, 'close'):
469 other.close() 478 other.close()
470 if cleanup: 479 if cleanup:
471 os.unlink(cleanup) 480 os.unlink(cleanup)
481 recurse()
482 return 0 # exit code is zero since we found incoming changes
472 483
473 def outgoing(ui, repo, dest, opts): 484 def outgoing(ui, repo, dest, opts):
485 def recurse():
486 ret = 1
487 if opts.get('subrepos'):
488 ctx = repo[None]
489 for subpath in sorted(ctx.substate):
490 sub = ctx.sub(subpath)
491 ret = min(ret, sub.outgoing(ui, dest, opts))
492 return ret
493
474 limit = cmdutil.loglimit(opts) 494 limit = cmdutil.loglimit(opts)
475 dest = ui.expandpath(dest or 'default-push', dest or 'default') 495 dest = ui.expandpath(dest or 'default-push', dest or 'default')
476 dest, branches = parseurl(dest, opts.get('branch')) 496 dest, branches = parseurl(dest, opts.get('branch'))
477 revs, checkout = addbranchrevs(repo, repo, branches, opts.get('rev')) 497 revs, checkout = addbranchrevs(repo, repo, branches, opts.get('rev'))
478 if revs: 498 if revs:
481 other = repository(remoteui(repo, opts), dest) 501 other = repository(remoteui(repo, opts), dest)
482 ui.status(_('comparing with %s\n') % url.hidepassword(dest)) 502 ui.status(_('comparing with %s\n') % url.hidepassword(dest))
483 o = discovery.findoutgoing(repo, other, force=opts.get('force')) 503 o = discovery.findoutgoing(repo, other, force=opts.get('force'))
484 if not o: 504 if not o:
485 ui.status(_("no changes found\n")) 505 ui.status(_("no changes found\n"))
486 return 1 506 return recurse()
507
487 o = repo.changelog.nodesbetween(o, revs)[0] 508 o = repo.changelog.nodesbetween(o, revs)[0]
488 if opts.get('newest_first'): 509 if opts.get('newest_first'):
489 o.reverse() 510 o.reverse()
490 displayer = cmdutil.show_changeset(ui, repo, opts) 511 displayer = cmdutil.show_changeset(ui, repo, opts)
491 count = 0 512 count = 0
496 if opts.get('no_merges') and len(parents) == 2: 517 if opts.get('no_merges') and len(parents) == 2:
497 continue 518 continue
498 count += 1 519 count += 1
499 displayer.show(repo[n]) 520 displayer.show(repo[n])
500 displayer.close() 521 displayer.close()
522 recurse()
523 return 0 # exit code is zero since we found outgoing changes
501 524
502 def revert(repo, node, choose): 525 def revert(repo, node, choose):
503 """revert changes to revision in node without updating dirstate""" 526 """revert changes to revision in node without updating dirstate"""
504 return mergemod.update(repo, node, False, True, choose)[3] > 0 527 return mergemod.update(repo, node, False, True, choose)[3] > 0
505 528