Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/commands.py @ 1756:f29857aaa053
add -l,--limit to log command.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Mon, 20 Feb 2006 11:06:41 -0800 |
parents | 91c56c427171 |
children | 23012d48ae91 |
comparison
equal
deleted
inserted
replaced
1747:91c56c427171 | 1756:f29857aaa053 |
---|---|
1597 def debug(self, *args): | 1597 def debug(self, *args): |
1598 if self.debugflag: | 1598 if self.debugflag: |
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) |
1606 elif st == 'add': | 1618 elif st == 'add': |
1607 du.bump(rev) | 1619 du.bump(rev) |
1633 if opts['patch']: | 1645 if opts['patch']: |
1634 prev = (parents and parents[0]) or nullid | 1646 prev = (parents and parents[0]) or nullid |
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 |
1641 def manifest(ui, repo, rev=None): | 1655 def manifest(ui, repo, rev=None): |
1642 """output the latest or given revision of the project manifest | 1656 """output the latest or given revision of the project manifest |
2444 (log, | 2458 (log, |
2445 [('I', 'include', [], _('include names matching the given patterns')), | 2459 [('I', 'include', [], _('include names matching the given patterns')), |
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')), |
2452 ('p', 'patch', None, _('show patch'))], | 2467 ('p', 'patch', None, _('show patch'))], |
2453 _('hg log [-I] [-X] [-r REV]... [-p] [FILE]')), | 2468 _('hg log [-I] [-X] [-r REV]... [-p] [FILE]')), |