~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/diff.py

  • Committer: Lalo Martins
  • Date: 2005-09-14 06:11:53 UTC
  • mto: (1185.1.22)
  • mto: This revision was merged to the branch mainline in revision 1390.
  • Revision ID: lalo@exoweb.net-20050914061153-509cea89f773f329
fixing a few tests that came on the merge, for the new constructors

Show diffs side-by-side

added added

removed removed

Lines of Context:
144
144
 
145
145
 
146
146
def show_diff(b, revision, specific_files, external_diff_options=None,
147
 
              revision2=None):
 
147
              revision2=None, output=None):
148
148
    """Shortcut for showing the diff to the working tree.
149
149
 
150
150
    b
156
156
    The more general form is show_diff_trees(), where the caller
157
157
    supplies any two trees.
158
158
    """
159
 
    import sys
 
159
    if output is None:
 
160
        import sys
 
161
        output = sys.stdout
160
162
 
161
 
    if revision == None:
 
163
    if revision is None:
162
164
        old_tree = b.basis_tree()
163
165
    else:
164
 
        old_tree = b.revision_tree(b.lookup_revision(revision))
 
166
        old_tree = b.revision_tree(revision.in_history(b).rev_id)
165
167
 
166
 
    if revision2 == None:
 
168
    if revision2 is None:
167
169
        new_tree = b.working_tree()
168
170
    else:
169
 
        new_tree = b.revision_tree(b.lookup_revision(revision2))
 
171
        new_tree = b.revision_tree(revision2.in_branch(b).rev_id)
170
172
 
171
 
    show_diff_trees(old_tree, new_tree, sys.stdout, specific_files,
 
173
    show_diff_trees(old_tree, new_tree, output, specific_files,
172
174
                    external_diff_options)
173
175
 
174
176