~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Martin Pool
  • Date: 2005-08-04 22:30:50 UTC
  • Revision ID: mbp@sourcefrog.net-20050804223050-01256e5e26a90b1d
- merge patch to take ranges to diff -r option

Show diffs side-by-side

added added

removed removed

Lines of Context:
837
837
    If files are listed, only the changes in those files are listed.
838
838
    Otherwise, all changes for the tree are listed.
839
839
 
840
 
    TODO: Given two revision arguments, show the difference between them.
841
 
 
842
840
    TODO: Allow diff across branches.
843
841
 
844
842
    TODO: Option to use external diff command; could be GNU diff, wdiff,
853
851
          deleted files.
854
852
 
855
853
    TODO: This probably handles non-Unix newlines poorly.
 
854
 
 
855
    examples:
 
856
        bzr diff
 
857
        bzr diff -r1
 
858
        bzr diff -r1:2
856
859
    """
857
860
    
858
861
    takes_args = ['file*']
871
874
        else:
872
875
            b = find_branch('.')
873
876
 
874
 
        # TODO: Make show_diff support taking 2 arguments
875
 
        base_rev = None
876
877
        if revision is not None:
877
 
            if len(revision) != 1:
878
 
                raise BzrCommandError('bzr diff --revision takes exactly one revision identifier')
879
 
            base_rev = revision[0]
880
 
    
881
 
        show_diff(b, base_rev, specific_files=file_list,
882
 
                  external_diff_options=diff_options)
883
 
 
 
878
            if len(revision) == 1:
 
879
                show_diff(b, revision[0], specific_files=file_list,
 
880
                          external_diff_options=diff_options)
 
881
            elif len(revision) == 2:
 
882
                show_diff(b, revision[0], specific_files=file_list,
 
883
                          external_diff_options=diff_options,
 
884
                          revision2=revision[1])
 
885
            else:
 
886
                raise BzrCommandError('bzr diff --revision takes exactly one or two revision identifiers')
 
887
        else:
 
888
            show_diff(b, None, specific_files=file_list,
 
889
                      external_diff_options=diff_options)
884
890
 
885
891
        
886
892