~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/diff.py

  • Committer: Aaron Bentley
  • Date: 2006-02-22 14:39:42 UTC
  • mto: (2027.1.2 revert-subpath-56549)
  • mto: This revision was merged to the branch mainline in revision 1570.
  • Revision ID: abentley@panoramicfeedback.com-20060222143942-ae72299f2de66767
Fixed build_tree with symlinks

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
 
17
from bzrlib.delta import compare_trees
 
18
from bzrlib.errors import BzrError
17
19
from bzrlib.trace import mutter
18
 
from bzrlib.errors import BzrError
19
 
from bzrlib.delta import compare_trees
20
20
 
21
21
# TODO: Rather than building a changeset object, we should probably
22
22
# invoke callbacks on an object.  That object can either accumulate a
159
159
        output = sys.stdout
160
160
 
161
161
    if from_spec is None:
 
162
        old_tree = b.bzrdir.open_workingtree()
162
163
        if b2 is None:
163
 
            old_tree = b.basis_tree()
164
 
        else:
165
 
            old_tree = b.working_tree()
 
164
            old_tree = old_tree = old_tree.basis_tree()
166
165
    else:
167
 
        old_tree = b.revision_tree(from_spec.in_history(b).rev_id)
 
166
        old_tree = b.repository.revision_tree(from_spec.in_history(b).rev_id)
168
167
 
169
168
    if revision2 is None:
170
169
        if b2 is None:
171
 
            new_tree = b.working_tree()
 
170
            new_tree = b.bzrdir.open_workingtree()
172
171
        else:
173
 
            new_tree = b2.working_tree()
 
172
            new_tree = b2.bzrdir.open_workingtree()
174
173
    else:
175
 
        new_tree = b.revision_tree(revision2.in_history(b).rev_id)
 
174
        new_tree = b.repository.revision_tree(revision2.in_history(b).rev_id)
176
175
 
177
176
    return show_diff_trees(old_tree, new_tree, output, specific_files,
178
177
                           external_diff_options)
190
189
        If set, use an external GNU diff and pass these options.
191
190
    """
192
191
 
 
192
    old_tree.lock_read()
 
193
    try:
 
194
        new_tree.lock_read()
 
195
        try:
 
196
            return _show_diff_trees(old_tree, new_tree, to_file,
 
197
                                    specific_files, external_diff_options)
 
198
        finally:
 
199
            new_tree.unlock()
 
200
    finally:
 
201
        old_tree.unlock()
 
202
 
 
203
 
 
204
def _show_diff_trees(old_tree, new_tree, to_file,
 
205
                     specific_files, external_diff_options):
 
206
 
193
207
    # TODO: Options to control putting on a prefix or suffix, perhaps as a format string
194
208
    old_label = ''
195
209
    new_label = ''