37
38
assert cmd.startswith("cmd_")
38
39
return cmd[4:].replace('_','-')
40
def _parse_revision_str(revstr):
41
"""This handles a revision string -> revno.
43
There are several possibilities:
46
'234:345' -> [234, 345]
50
In the future we will also support:
51
'uuid:blah-blah-blah' -> ?
52
'hash:blahblahblah' -> ?
56
if revstr.find(':') != -1:
57
revs = revstr.split(':')
59
raise ValueError('More than 2 pieces not supported for --revision: %r' % revstr)
64
revs[0] = int(revs[0])
69
revs[1] = int(revs[1])
74
41
def get_all_cmds():
75
42
"""Return canonical name and class for all registered commands."""
76
43
for k, v in globals().iteritems():
528
495
def run(self, revision=None, file_list=None):
529
496
from bzrlib.diff import show_diff
530
from bzrlib import find_branch
533
b = find_branch(file_list[0], lock_mode='r')
534
file_list = [b.relpath(f) for f in file_list]
535
if file_list == ['']:
536
# just pointing to top-of-tree
539
b = Branch('.', lock_mode='r')
541
show_diff(b, revision, specific_files=file_list)
498
show_diff(Branch('.'), revision, specific_files=file_list)
628
585
class cmd_log(Command):
629
586
"""Show log of this branch.
631
To request a range of logs, you can use the command -r begin:end
632
-r revision requests a specific revision, -r :end or -r begin: are
588
TODO: Option to limit range.
635
TODO: Make --revision support uuid: and hash: [future tag:] notation.
590
TODO: Perhaps show most-recent first with an option for last.
639
592
takes_args = ['filename?']
640
takes_options = ['forward', 'timezone', 'verbose', 'show-ids', 'revision']
642
def run(self, filename=None, timezone='original',
647
from bzrlib import show_log, find_branch
650
direction = (forward and 'forward') or 'reverse'
593
takes_options = ['timezone', 'verbose', 'show-ids']
594
def run(self, filename=None, timezone='original', verbose=False, show_ids=False):
595
from branch import find_branch
596
b = find_branch((filename or '.'), lock_mode='r')
653
b = find_branch(filename, lock_mode='r')
654
fp = b.relpath(filename)
656
file_id = b.read_working_inventory().path2id(fp)
658
file_id = None # points to branch root
660
b = find_branch('.', lock_mode='r')
664
revision = [None, None]
665
elif isinstance(revision, int):
666
revision = [revision, revision]
671
assert len(revision) == 2
673
mutter('encoding log as %r' % bzrlib.user_encoding)
674
outf = codecs.getwriter(bzrlib.user_encoding)(sys.stdout)
677
show_timezone=timezone,
682
start_revision=revision[0],
683
end_revision=revision[1])
598
filename = b.relpath(filename)
599
bzrlib.show_log(b, filename,
600
show_timezone=timezone,
687
606
class cmd_touching_revisions(Command):
688
"""Return revision-ids which affected a particular file.
690
A more user-friendly interface is "bzr log FILE"."""
607
"""Return revision-ids which affected a particular file."""
692
609
takes_args = ["filename"]
693
610
def run(self, filename):
926
843
failures, tests = 0, 0
928
import doctest, bzrlib.store
845
import doctest, bzrlib.store, bzrlib.tests
929
846
bzrlib.trace.verbose = False
931
848
for m in bzrlib.store, bzrlib.inventory, bzrlib.branch, bzrlib.osutils, \