~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/diff.py

  • Committer: Martin Pool
  • Date: 2006-01-13 07:37:48 UTC
  • mto: (1185.50.49 bzr-jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1549.
  • Revision ID: mbp@sourcefrog.net-20060113073748-d6893fbd5454d5a4
[cherrypick] Hold locks around entire diff operations to avoid thrashing
hashcache.  (from denys)

Show diffs side-by-side

added added

removed removed

Lines of Context:
190
190
        If set, use an external GNU diff and pass these options.
191
191
    """
192
192
 
 
193
    old_tree.lock_read()
 
194
    try:
 
195
        new_tree.lock_read()
 
196
        try:
 
197
            return _show_diff_trees(old_tree, new_tree, to_file,
 
198
                                    specific_files, external_diff_options)
 
199
        finally:
 
200
            new_tree.unlock()
 
201
    finally:
 
202
        old_tree.unlock()
 
203
 
 
204
 
 
205
def _show_diff_trees(old_tree, new_tree, to_file,
 
206
                     specific_files, external_diff_options):
 
207
 
193
208
    # TODO: Options to control putting on a prefix or suffix, perhaps as a format string
194
209
    old_label = ''
195
210
    new_label = ''