1543
1543
dir, relpath = bzrdir.BzrDir.open_containing(location)
1544
1544
b = dir.open_branch()
1546
if revision is 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.
1548
if revision is 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"
1561
if revision[0].spec is None:
1562
# missing begin-range means first revision
1565
rev1 = revision[0].in_history(b).revno
1567
if revision[1].spec is None:
1568
# missing end-range means last known revision
1571
rev2 = revision[1].in_history(b).revno
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
1562
rev1 = revision[0].in_history(b).revno
1564
if revision[1].spec is None:
1565
# missing end-range means last known revision
1568
rev2 = revision[1].in_history(b).revno
1570
raise errors.BzrCommandError('bzr log --revision takes one or two values.')
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
1576
(rev2, rev1) = (rev1, rev2)
1578
if log_format is None:
1579
log_format = log.log_formatter_registry.get_default(b)
1581
lf = log_format(show_ids=show_ids, to_file=self.outf,
1582
show_timezone=timezone)
1588
direction=direction,
1589
start_revision=rev1,
1574
'bzr log --revision takes one or two values.')
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
1580
(rev2, rev1) = (rev1, rev2)
1582
if log_format is None:
1583
log_format = log.log_formatter_registry.get_default(b)
1585
lf = log_format(show_ids=show_ids, to_file=self.outf,
1586
show_timezone=timezone)
1592
direction=direction,
1593
start_revision=rev1,
1594
1600
def get_log_format(long=False, short=False, line=False, default='long'):