1
1
# Copyright (C) 2005, 2006 Canonical
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
5
5
# the Free Software Foundation; either version 2 of the License, or
6
6
# (at your option) any later version.
8
8
# This program is distributed in the hope that it will be useful,
9
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
11
# GNU General Public License for more details.
13
13
# You should have received a copy of the GNU General Public License
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
17
17
from bzrlib.inventory import InventoryEntry
18
18
from bzrlib.trace import mutter
19
from bzrlib import tree
19
from bzrlib.symbol_versioning import deprecated_function, zero_ten
22
22
class TreeDelta(object):
143
143
show_list(self.unchanged)
146
def compare_trees(old_tree, new_tree, want_unchanged=False,
147
specific_files=None, extra_trees=None,
146
@deprecated_function(zero_ten)
147
def compare_trees(old_tree, new_tree, want_unchanged=False,
148
specific_files=None, extra_trees=None,
148
149
require_versioned=False):
149
"""Describe changes from one tree to another.
151
Returns a TreeDelta with details of added, modified, renamed, and
154
The root entry is specifically exempt.
156
This only considers versioned files.
159
If true, also list files unchanged from one version to
163
If supplied, only check for changes to specified names or
164
files within them. When mapping filenames to ids, all matches in all
165
trees (including optional extra_trees) are used, and all children of
166
matched directories are included.
169
If non-None, a list of more trees to use for looking up file_ids from
173
If true, an all files are required to be versioned, and
174
PathsNotVersionedError will be thrown if they are not.
176
# NB: show_status depends on being able to pass in non-versioned files and
177
# report them as unknown
182
trees = (new_tree, old_tree)
183
if extra_trees is not None:
184
trees = trees + tuple(extra_trees)
185
specific_file_ids = tree.find_ids_across_trees(specific_files,
186
trees, require_versioned=require_versioned)
187
return _compare_trees(old_tree, new_tree, want_unchanged,
150
"""compare_trees was deprecated in 0.10. Please see Tree.changes_from."""
151
return new_tree.changes_from(old_tree,
152
want_unchanged=want_unchanged,
153
specific_files=specific_files,
154
extra_trees=extra_trees,
155
require_versioned=require_versioned)
195
158
def _compare_trees(old_tree, new_tree, want_unchanged, specific_file_ids):