##// END OF EJS Templates
bookmarks: rewrite comparing bookmarks in commands.summary() by compare()...
FUJIWARA Katsunori -
r24400:03c84c96 default
parent child Browse files
Show More
@@ -498,6 +498,16 b' def outgoing(ui, repo, other):'
498
498
499 return 0
499 return 0
500
500
501 def summary(repo, other):
502 '''Compare bookmarks between repo and other for "hg summary" output
503
504 This returns "(# of incoming, # of outgoing)" tuple.
505 '''
506 r = compare(repo, other.listkeys('bookmarks'), repo._bookmarks,
507 dsthex=hex)
508 addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = r
509 return (len(addsrc), len(adddst))
510
501 def validdest(repo, old, new):
511 def validdest(repo, old, new):
502 """Is the new bookmark destination a valid update from the old one"""
512 """Is the new bookmark destination a valid update from the old one"""
503 repo = repo.unfiltered()
513 repo = repo.unfiltered()
@@ -5982,14 +5982,11 b' def summary(ui, repo, **opts):'
5982 t.append(_('%d outgoing') % len(o))
5982 t.append(_('%d outgoing') % len(o))
5983 other = dother or sother
5983 other = dother or sother
5984 if 'bookmarks' in other.listkeys('namespaces'):
5984 if 'bookmarks' in other.listkeys('namespaces'):
5985 lmarks = repo.listkeys('bookmarks')
5985 counts = bookmarks.summary(repo, other)
5986 rmarks = other.listkeys('bookmarks')
5986 if counts[0] > 0:
5987 diff = set(rmarks) - set(lmarks)
5987 t.append(_('%d incoming bookmarks') % counts[0])
5988 if len(diff) > 0:
5988 if counts[1] > 0:
5989 t.append(_('%d incoming bookmarks') % len(diff))
5989 t.append(_('%d outgoing bookmarks') % counts[1])
5990 diff = set(lmarks) - set(rmarks)
5991 if len(diff) > 0:
5992 t.append(_('%d outgoing bookmarks') % len(diff))
5993
5990
5994 if t:
5991 if t:
5995 # i18n: column positioning for "hg summary"
5992 # i18n: column positioning for "hg summary"
@@ -494,6 +494,13 b' pushing a new bookmark on a new head doe'
494 $ hg -R ../b id -r W
494 $ hg -R ../b id -r W
495 cc978a373a53 tip W
495 cc978a373a53 tip W
496
496
497 Check summary output for incoming/outgoing bookmarks
498
499 $ hg bookmarks -d X
500 $ hg bookmarks -d Y
501 $ hg summary --remote | grep '^remote:'
502 remote: *, 2 incoming bookmarks, 1 outgoing bookmarks (glob)
503
497 $ cd ..
504 $ cd ..
498
505
499 pushing an unchanged bookmark should result in no changes
506 pushing an unchanged bookmark should result in no changes
General Comments 0
You need to be logged in to leave comments. Login now