##// END OF EJS Templates
add -l,--limit to log command.
Vadim Gelfer -
r1756:f29857aa default
parent child Browse files
Show More
@@ -376,6 +376,7 b' log [-r revision ...] [-p] [files]::'
376 options:
376 options:
377 -I, --include <pat> include names matching the given patterns
377 -I, --include <pat> include names matching the given patterns
378 -X, --exclude <pat> exclude names matching the given patterns
378 -X, --exclude <pat> exclude names matching the given patterns
379 -l, --limit <num> print no more than this many changes
379 -r, --rev <A> show the specified revision or range
380 -r, --rev <A> show the specified revision or range
380 -p, --patch show patch
381 -p, --patch show patch
381
382
@@ -1599,7 +1599,19 b' def log(ui, repo, *pats, **opts):'
1599 self.write(*args)
1599 self.write(*args)
1600 def __getattr__(self, key):
1600 def __getattr__(self, key):
1601 return getattr(self.ui, key)
1601 return getattr(self.ui, key)
1602
1602 changeiter, getchange, matchfn = walkchangerevs(ui, repo, pats, opts)
1603 changeiter, getchange, matchfn = walkchangerevs(ui, repo, pats, opts)
1604
1605 if opts['limit']:
1606 try:
1607 limit = int(opts['limit'])
1608 except ValueError:
1609 raise util.Abort(_('limit must be a positive integer'))
1610 if limit <= 0: raise util.Abort(_('limit must be positive'))
1611 else:
1612 limit = sys.maxint
1613 count = 0
1614
1603 for st, rev, fns in changeiter:
1615 for st, rev, fns in changeiter:
1604 if st == 'window':
1616 if st == 'window':
1605 du = dui(ui)
1617 du = dui(ui)
@@ -1635,6 +1647,8 b' def log(ui, repo, *pats, **opts):'
1635 dodiff(du, du, repo, prev, changenode, match=matchfn)
1647 dodiff(du, du, repo, prev, changenode, match=matchfn)
1636 du.write("\n\n")
1648 du.write("\n\n")
1637 elif st == 'iter':
1649 elif st == 'iter':
1650 if count == limit: break
1651 count += 1
1638 for args in du.hunk[rev]:
1652 for args in du.hunk[rev]:
1639 ui.write(*args)
1653 ui.write(*args)
1640
1654
@@ -2446,6 +2460,7 b' table = {'
2446 ('X', 'exclude', [], _('exclude names matching the given patterns')),
2460 ('X', 'exclude', [], _('exclude names matching the given patterns')),
2447 ('b', 'branch', None, _('show branches')),
2461 ('b', 'branch', None, _('show branches')),
2448 ('k', 'keyword', [], _('search for a keyword')),
2462 ('k', 'keyword', [], _('search for a keyword')),
2463 ('l', 'limit', '', _('limit number of changes displayed')),
2449 ('r', 'rev', [], _('show the specified revision or range')),
2464 ('r', 'rev', [], _('show the specified revision or range')),
2450 ('M', 'no-merges', None, _('do not show merges')),
2465 ('M', 'no-merges', None, _('do not show merges')),
2451 ('m', 'only-merges', None, _('show only merges')),
2466 ('m', 'only-merges', None, _('show only merges')),
General Comments 0
You need to be logged in to leave comments. Login now