~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: mbp at sourcefrog
  • Date: 2005-04-06 02:05:46 UTC
  • Revision ID: mbp@sourcefrog.net-20050406020546-479d86af7ad5607439f7fb33
New cat command contributed by janmar.

Show diffs side-by-side

added added

removed removed

Lines of Context:
538
538
    t = b.revision_tree(rh)
539
539
    t.export(dest)
540
540
 
 
541
def cmd_cat(revision, filename):
 
542
    """Print file to stdout."""
 
543
    b = Branch('.')
 
544
    b.print_file(b.relpath(filename), int(revision))
541
545
 
542
546
 
543
547
######################################################################
725
729
# listed take none.
726
730
cmd_options = {
727
731
    'add':                    ['verbose'],
 
732
    'cat':                    ['revision'],
728
733
    'commit':                 ['message', 'verbose'],
729
734
    'deleted':                ['show-ids'],
730
735
    'diff':                   ['revision'],
738
743
 
739
744
cmd_args = {
740
745
    'add':                    ['file+'],
 
746
    'cat':                    ['filename'],
741
747
    'commit':                 [],
742
748
    'diff':                   [],
743
749
    'export':                 ['revno', 'dest'],
923
929
            bailout("option %r is not allowed for command %r"
924
930
                    % (oname, cmd))
925
931
 
 
932
    # TODO: give an error if there are any mandatory options which are
 
933
    # not specified?  Or maybe there shouldn't be any "mandatory
 
934
    # options" (it is an oxymoron)
 
935
 
926
936
    # mix arguments and options into one dictionary
927
937
    cmdargs = _match_args(cmd, args)
928
938
    for k, v in opts.items():