~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-05-25 04:33:32 UTC
  • mfrom: (2493.1.1 bzr.ab.integration)
  • Revision ID: pqm@pqm.ubuntu.com-20070525043332-aw7j04dvjy6ua1v9
Merge log --limit (Kent Gibson)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1563
1563
        self.outf.write(tree.basedir + '\n')
1564
1564
 
1565
1565
 
 
1566
def _parse_limit(limitstring):
 
1567
    try:
 
1568
        return int(limitstring)
 
1569
    except ValueError:
 
1570
        msg = "The limit argument must be an integer."
 
1571
        raise errors.BzrCommandError(msg)
 
1572
 
 
1573
 
1566
1574
class cmd_log(Command):
1567
1575
    """Show log of a branch, file, or directory.
1568
1576
 
1593
1601
                            short_name='m',
1594
1602
                            help='show revisions whose message matches this regexp',
1595
1603
                            type=str),
 
1604
                     Option('limit', 
 
1605
                            help='limit the output to the first N revisions',
 
1606
                            type=_parse_limit),
1596
1607
                     ]
1597
1608
    encoding_type = 'replace'
1598
1609
 
1603
1614
            forward=False,
1604
1615
            revision=None,
1605
1616
            log_format=None,
1606
 
            message=None):
 
1617
            message=None,
 
1618
            limit=None):
1607
1619
        from bzrlib.log import show_log
1608
1620
        assert message is None or isinstance(message, basestring), \
1609
1621
            "invalid message argument %r" % message
1684
1696
                     direction=direction,
1685
1697
                     start_revision=rev1,
1686
1698
                     end_revision=rev2,
1687
 
                     search=message)
 
1699
                     search=message,
 
1700
                     limit=limit)
1688
1701
        finally:
1689
1702
            b.unlock()
1690
1703