~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Aaron Bentley
  • Date: 2007-02-14 13:01:43 UTC
  • mto: (2230.3.47 branch6)
  • mto: This revision was merged to the branch mainline in revision 2290.
  • Revision ID: aaron.bentley@utoronto.ca-20070214130143-ducyb0e9jl8xa5l3
Get log as fast branch5

Show diffs side-by-side

added added

removed removed

Lines of Context:
1543
1543
            dir, relpath = bzrdir.BzrDir.open_containing(location)
1544
1544
            b = dir.open_branch()
1545
1545
 
1546
 
        if revision is None:
1547
 
            rev1 = None
1548
 
            rev2 = None
1549
 
        elif len(revision) == 1:
1550
 
            rev1 = rev2 = revision[0].in_history(b).revno
1551
 
        elif len(revision) == 2:
1552
 
            if revision[1].get_branch() != revision[0].get_branch():
1553
 
                # b is taken from revision[0].get_branch(), and
1554
 
                # show_log will use its revision_history. Having
1555
 
                # different branches will lead to weird behaviors.
 
1546
        b.lock_read()
 
1547
        try:
 
1548
            if revision is None:
 
1549
                rev1 = None
 
1550
                rev2 = None
 
1551
            elif len(revision) == 1:
 
1552
                rev1 = rev2 = revision[0].in_history(b).revno
 
1553
            elif len(revision) == 2:
 
1554
                if revision[1].get_branch() != revision[0].get_branch():
 
1555
                    # b is taken from revision[0].get_branch(), and
 
1556
                    # show_log will use its revision_history. Having
 
1557
                    # different branches will lead to weird behaviors.
 
1558
                    raise errors.BzrCommandError(
 
1559
                        "Log doesn't accept two revisions in different"
 
1560
                        " branches.")
 
1561
                if revision[0].spec is None:
 
1562
                    # missing begin-range means first revision
 
1563
                    rev1 = 1
 
1564
                else:
 
1565
                    rev1 = revision[0].in_history(b).revno
 
1566
 
 
1567
                if revision[1].spec is None:
 
1568
                    # missing end-range means last known revision
 
1569
                    rev2 = b.revno()
 
1570
                else:
 
1571
                    rev2 = revision[1].in_history(b).revno
 
1572
            else:
1556
1573
                raise errors.BzrCommandError(
1557
 
                    "Log doesn't accept two revisions in different branches.")
1558
 
            if revision[0].spec is None:
1559
 
                # missing begin-range means first revision
1560
 
                rev1 = 1
1561
 
            else:
1562
 
                rev1 = revision[0].in_history(b).revno
1563
 
 
1564
 
            if revision[1].spec is None:
1565
 
                # missing end-range means last known revision
1566
 
                rev2 = b.revno()
1567
 
            else:
1568
 
                rev2 = revision[1].in_history(b).revno
1569
 
        else:
1570
 
            raise errors.BzrCommandError('bzr log --revision takes one or two values.')
1571
 
 
1572
 
        # By this point, the revision numbers are converted to the +ve
1573
 
        # form if they were supplied in the -ve form, so we can do
1574
 
        # this comparison in relative safety
1575
 
        if rev1 > rev2:
1576
 
            (rev2, rev1) = (rev1, rev2)
1577
 
 
1578
 
        if log_format is None:
1579
 
            log_format = log.log_formatter_registry.get_default(b)
1580
 
 
1581
 
        lf = log_format(show_ids=show_ids, to_file=self.outf,
1582
 
                        show_timezone=timezone)
1583
 
 
1584
 
        show_log(b,
1585
 
                 lf,
1586
 
                 file_id,
1587
 
                 verbose=verbose,
1588
 
                 direction=direction,
1589
 
                 start_revision=rev1,
1590
 
                 end_revision=rev2,
1591
 
                 search=message)
 
1574
                    'bzr log --revision takes one or two values.')
 
1575
 
 
1576
            # By this point, the revision numbers are converted to the +ve
 
1577
            # form if they were supplied in the -ve form, so we can do
 
1578
            # this comparison in relative safety
 
1579
            if rev1 > rev2:
 
1580
                (rev2, rev1) = (rev1, rev2)
 
1581
 
 
1582
            if log_format is None:
 
1583
                log_format = log.log_formatter_registry.get_default(b)
 
1584
 
 
1585
            lf = log_format(show_ids=show_ids, to_file=self.outf,
 
1586
                            show_timezone=timezone)
 
1587
 
 
1588
            show_log(b,
 
1589
                     lf,
 
1590
                     file_id,
 
1591
                     verbose=verbose,
 
1592
                     direction=direction,
 
1593
                     start_revision=rev1,
 
1594
                     end_revision=rev2,
 
1595
                     search=message)
 
1596
        finally:
 
1597
            b.unlock()
1592
1598
 
1593
1599
 
1594
1600
def get_log_format(long=False, short=False, line=False, default='long'):