mercurial/commands.py
changeset 1761 7eb1934f83fb
parent 1760 13f8e068d13c
parent 1757 23012d48ae91
child 1762 8eaa8e06a364
equal deleted inserted replaced
1760:13f8e068d13c 1761:7eb1934f83fb
  1609         def debug(self, *args):
  1609         def debug(self, *args):
  1610             if self.debugflag:
  1610             if self.debugflag:
  1611                 self.write(*args)
  1611                 self.write(*args)
  1612         def __getattr__(self, key):
  1612         def __getattr__(self, key):
  1613             return getattr(self.ui, key)
  1613             return getattr(self.ui, key)
       
  1614 
  1614     changeiter, getchange, matchfn = walkchangerevs(ui, repo, pats, opts)
  1615     changeiter, getchange, matchfn = walkchangerevs(ui, repo, pats, opts)
       
  1616 
       
  1617     if opts['limit']:
       
  1618         try:
       
  1619             limit = int(opts['limit'])
       
  1620         except ValueError:
       
  1621             raise util.Abort(_('limit must be a positive integer'))
       
  1622         if limit <= 0: raise util.Abort(_('limit must be positive'))
       
  1623     else:
       
  1624         limit = sys.maxint
       
  1625     count = 0
       
  1626 
  1615     for st, rev, fns in changeiter:
  1627     for st, rev, fns in changeiter:
  1616         if st == 'window':
  1628         if st == 'window':
  1617             du = dui(ui)
  1629             du = dui(ui)
  1618         elif st == 'add':
  1630         elif st == 'add':
  1619             du.bump(rev)
  1631             du.bump(rev)
  1645             if opts['patch']:
  1657             if opts['patch']:
  1646                 prev = (parents and parents[0]) or nullid
  1658                 prev = (parents and parents[0]) or nullid
  1647                 dodiff(du, du, repo, prev, changenode, match=matchfn)
  1659                 dodiff(du, du, repo, prev, changenode, match=matchfn)
  1648                 du.write("\n\n")
  1660                 du.write("\n\n")
  1649         elif st == 'iter':
  1661         elif st == 'iter':
       
  1662             if count == limit: break
       
  1663             count += 1
  1650             for args in du.hunk[rev]:
  1664             for args in du.hunk[rev]:
  1651                 ui.write(*args)
  1665                 ui.write(*args)
  1652 
  1666 
  1653 def manifest(ui, repo, rev=None):
  1667 def manifest(ui, repo, rev=None):
  1654     """output the latest or given revision of the project manifest
  1668     """output the latest or given revision of the project manifest
  2460         (log,
  2474         (log,
  2461          [('I', 'include', [], _('include names matching the given patterns')),
  2475          [('I', 'include', [], _('include names matching the given patterns')),
  2462           ('X', 'exclude', [], _('exclude names matching the given patterns')),
  2476           ('X', 'exclude', [], _('exclude names matching the given patterns')),
  2463           ('b', 'branch', None, _('show branches')),
  2477           ('b', 'branch', None, _('show branches')),
  2464           ('k', 'keyword', [], _('search for a keyword')),
  2478           ('k', 'keyword', [], _('search for a keyword')),
       
  2479           ('l', 'limit', '', _('limit number of changes displayed')),
  2465           ('r', 'rev', [], _('show the specified revision or range')),
  2480           ('r', 'rev', [], _('show the specified revision or range')),
  2466           ('M', 'no-merges', None, _('do not show merges')),
  2481           ('M', 'no-merges', None, _('do not show merges')),
  2467           ('m', 'only-merges', None, _('show only merges')),
  2482           ('m', 'only-merges', None, _('show only merges')),
  2468           ('p', 'patch', None, _('show patch'))],
  2483           ('p', 'patch', None, _('show patch'))],
  2469          _('hg log [-I] [-X] [-r REV]... [-p] [FILE]')),
  2484          _('hg log [-I] [-X] [-r REV]... [-p] [FILE]')),