~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/diff.py

  • Committer: Martin Pool
  • Date: 2005-06-06 04:47:33 UTC
  • Revision ID: mbp@sourcefrog.net-20050606044733-e902b05ac1747cd2
- fix invocation of testbzr when giving explicit bzr location

Show diffs side-by-side

added added

removed removed

Lines of Context:
209
209
                          specific_files=specific_files)
210
210
 
211
211
    for path, file_id, kind in delta.removed:
212
 
        print >>to_file, '*** removed %s %r' % (kind, path)
 
212
        print '*** removed %s %r' % (kind, path)
213
213
        if kind == 'file':
214
214
            diff_file(old_label + path,
215
215
                      old_tree.get_file(file_id).readlines(),
218
218
                      to_file)
219
219
 
220
220
    for path, file_id, kind in delta.added:
221
 
        print >>to_file, '*** added %s %r' % (kind, path)
 
221
        print '*** added %s %r' % (kind, path)
222
222
        if kind == 'file':
223
223
            diff_file(DEVNULL,
224
224
                      [],
227
227
                      to_file)
228
228
 
229
229
    for old_path, new_path, file_id, kind, text_modified in delta.renamed:
230
 
        print >>to_file, '*** renamed %s %r => %r' % (kind, old_path, new_path)
 
230
        print '*** renamed %s %r => %r' % (kind, old_path, new_path)
231
231
        if text_modified:
232
232
            diff_file(old_label + old_path,
233
233
                      old_tree.get_file(file_id).readlines(),
236
236
                      to_file)
237
237
 
238
238
    for path, file_id, kind in delta.modified:
239
 
        print >>to_file, '*** modified %s %r' % (kind, path)
 
239
        print '*** modified %s %r' % (kind, path)
240
240
        if kind == 'file':
241
241
            diff_file(old_label + path,
242
242
                      old_tree.get_file(file_id).readlines(),
276
276
        self.modified = []
277
277
        self.unchanged = []
278
278
 
279
 
    def __eq__(self, other):
280
 
        if not isinstance(other, TreeDelta):
281
 
            return False
282
 
        return self.added == other.added \
283
 
               and self.removed == other.removed \
284
 
               and self.renamed == other.renamed \
285
 
               and self.modified == other.modified \
286
 
               and self.unchanged == other.unchanged
287
 
 
288
 
    def __ne__(self, other):
289
 
        return not (self == other)
290
 
 
291
 
    def __repr__(self):
292
 
        return "TreeDelta(added=%r, removed=%r, renamed=%r, modified=%r," \
293
 
            " unchanged=%r)" % (self.added, self.removed, self.renamed,
294
 
            self.modified, self.unchanged)
295
 
 
296
279
    def has_changed(self):
297
280
        changes = len(self.added) + len(self.removed) + len(self.renamed)
298
281
        changes += len(self.modified) 
349
332
 
350
333
 
351
334
 
352
 
def compare_trees(old_tree, new_tree, want_unchanged=False, specific_files=None):
 
335
def compare_trees(old_tree, new_tree, want_unchanged, specific_files=None):
353
336
    """Describe changes from one tree to another.
354
337
 
355
338
    Returns a TreeDelta with details of added, modified, renamed, and