~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/delta.py

  • Committer: wang
  • Date: 2006-10-29 13:41:32 UTC
  • mto: (2104.4.1 wang_65714)
  • mto: This revision was merged to the branch mainline in revision 2109.
  • Revision ID: wang@ubuntu-20061029134132-3d7f4216f20c4aef
Replace python's difflib by patiencediff because the worst case 
performance is cubic for difflib and people commiting large data 
files are often hurt by this. The worst case performance of patience is 
quadratic. Fix bug 65714.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical
 
1
# Copyright (C) 2005, 2006 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
152
152
        want_unchanged=want_unchanged,
153
153
        specific_files=specific_files,
154
154
        extra_trees=extra_trees,
155
 
        require_versioned=require_versioned)
156
 
 
157
 
 
158
 
def _compare_trees(old_tree, new_tree, want_unchanged, specific_file_ids):
 
155
        require_versioned=require_versioned,
 
156
        include_root=False)
 
157
 
 
158
 
 
159
def _compare_trees(old_tree, new_tree, want_unchanged, specific_file_ids,
 
160
                   include_root):
159
161
 
160
162
    from osutils import is_inside_any
161
 
    
162
163
    old_inv = old_tree.inventory
163
164
    new_inv = new_tree.inventory
164
165
    delta = TreeDelta()
165
 
    mutter('start compare_trees')
 
166
    # mutter('start compare_trees')
166
167
 
167
168
    # TODO: Rather than iterating over the whole tree and then filtering, we
168
169
    # could diff just the specified files (if any) and their subtrees.  
169
170
 
170
 
    old_files = old_tree.list_files()
171
 
    new_files = new_tree.list_files()
 
171
    old_files = old_tree.list_files(include_root)
 
172
    new_files = new_tree.list_files(include_root)
172
173
 
173
174
    more_old = True
174
175
    more_new = True
251
252
            assert entry.file_id not in added
252
253
            added[entry.file_id] = path, entry
253
254
 
254
 
    while old_path or new_path:
 
255
    while old_path is not None or new_path is not None:
255
256
        # list_files() returns files in alphabetical path sorted order
256
257
        if old_path == new_path:
257
258
            if old_file_id == new_file_id: