##// END OF EJS Templates
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check...
FUJIWARA Katsunori -
r21047:f0003f98 default
parent child Browse files
Show More
@@ -2382,6 +2382,16 b' def command(table):'
2382 # a list of (ui, repo) functions called by commands.summary
2382 # a list of (ui, repo) functions called by commands.summary
2383 summaryhooks = util.hooks()
2383 summaryhooks = util.hooks()
2384
2384
2385 # a list of (ui, repo, opts, changes) functions called by commands.summary.
2386 #
2387 # functions should return tuple of booleans below, if 'changes' is None:
2388 # (whether-incomings-are-needed, whether-outgoings-are-needed)
2389 #
2390 # otherwise, 'changes' is a tuple of tuples below:
2391 # - (sourceurl, sourcebranch, sourcepeer, incoming)
2392 # - (desturl, destbranch, destpeer, outgoing)
2393 summaryremotehooks = util.hooks()
2394
2385 # A list of state files kept by multistep operations like graft.
2395 # A list of state files kept by multistep operations like graft.
2386 # Since graft cannot be aborted, it is considered 'clearable' by update.
2396 # Since graft cannot be aborted, it is considered 'clearable' by update.
2387 # note: bisect is intentionally excluded
2397 # note: bisect is intentionally excluded
@@ -5525,11 +5525,23 b' def summary(ui, repo, **opts):'
5525 needsincoming, needsoutgoing = True, True
5525 needsincoming, needsoutgoing = True, True
5526 else:
5526 else:
5527 needsincoming, needsoutgoing = False, False
5527 needsincoming, needsoutgoing = False, False
5528 for i, o in cmdutil.summaryremotehooks(ui, repo, opts, None):
5529 if i:
5530 needsincoming = True
5531 if o:
5532 needsoutgoing = True
5533 if not needsincoming and not needsoutgoing:
5534 return
5528
5535
5529 def getincoming():
5536 def getincoming():
5530 source, branches = hg.parseurl(ui.expandpath('default'))
5537 source, branches = hg.parseurl(ui.expandpath('default'))
5531 sbranch = branches[0]
5538 sbranch = branches[0]
5532 other = hg.peer(repo, {}, source)
5539 try:
5540 other = hg.peer(repo, {}, source)
5541 except error.RepoError:
5542 if opts.get('remote'):
5543 raise
5544 return source, sbranch, None, None, None
5533 revs, checkout = hg.addbranchrevs(repo, other, branches, None)
5545 revs, checkout = hg.addbranchrevs(repo, other, branches, None)
5534 if revs:
5546 if revs:
5535 revs = [other.lookup(rev) for rev in revs]
5547 revs = [other.lookup(rev) for rev in revs]
@@ -5549,8 +5561,16 b' def summary(ui, repo, **opts):'
5549 dbranch = branches[0]
5561 dbranch = branches[0]
5550 revs, checkout = hg.addbranchrevs(repo, repo, branches, None)
5562 revs, checkout = hg.addbranchrevs(repo, repo, branches, None)
5551 if source != dest:
5563 if source != dest:
5552 dother = hg.peer(repo, {}, dest)
5564 try:
5565 dother = hg.peer(repo, {}, dest)
5566 except error.RepoError:
5567 if opts.get('remote'):
5568 raise
5569 return dest, dbranch, None, None
5553 ui.debug('comparing with %s\n' % util.hidepassword(dest))
5570 ui.debug('comparing with %s\n' % util.hidepassword(dest))
5571 elif sother is None:
5572 # there is no explicit destination peer, but source one is invalid
5573 return dest, dbranch, None, None
5554 else:
5574 else:
5555 dother = sother
5575 dother = sother
5556 if (source != dest or (sbranch is not None and sbranch != dbranch)):
5576 if (source != dest or (sbranch is not None and sbranch != dbranch)):
@@ -5595,6 +5615,10 b' def summary(ui, repo, **opts):'
5595 # i18n: column positioning for "hg summary"
5615 # i18n: column positioning for "hg summary"
5596 ui.status(_('remote: (synced)\n'))
5616 ui.status(_('remote: (synced)\n'))
5597
5617
5618 cmdutil.summaryremotehooks(ui, repo, opts,
5619 ((source, sbranch, sother, commoninc),
5620 (dest, dbranch, dother, outgoing)))
5621
5598 @command('tag',
5622 @command('tag',
5599 [('f', 'force', None, _('force tag')),
5623 [('f', 'force', None, _('force tag')),
5600 ('l', 'local', None, _('make the tag local')),
5624 ('l', 'local', None, _('make the tag local')),
General Comments 0
You need to be logged in to leave comments. Login now