~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/delta.py

  • Committer: Andrew Bennetts
  • Date: 2010-01-15 05:30:30 UTC
  • mto: (4973.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4975.
  • Revision ID: andrew.bennetts@canonical.com-20100115053030-1d6qd89pnj8hmb55
Pass kinds (not pairs) to MergeHookParams.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
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
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
from bzrlib import (
18
18
    errors,
47
47
 
48
48
    Files that are both modified and renamed are listed only in
49
49
    renamed, with the text_modified flag true. The text_modified
50
 
    applies either to the the content of the file or the target of the
 
50
    applies either to the content of the file or the target of the
51
51
    symbolic link, depending of the kind of file.
52
52
 
53
53
    Files are only considered renamed if their name has changed or
276
276
    """Report changes between two trees"""
277
277
 
278
278
    def __init__(self, output=None, suppress_root_add=True,
279
 
                 output_file=None, unversioned_filter=None):
 
279
                 output_file=None, unversioned_filter=None, view_info=None):
280
280
        """Constructor
281
281
 
282
282
        :param output: a function with the signature of trace.note, i.e.
285
285
            (i.e. when a tree has just been initted)
286
286
        :param output_file: If supplied, a file-like object to write to.
287
287
            Only one of output and output_file may be supplied.
288
 
        :param unversioned_filter: A filter function to be called on 
 
288
        :param unversioned_filter: A filter function to be called on
289
289
            unversioned files. This should return True to ignore a path.
290
290
            By default, no filtering takes place.
 
291
        :param view_info: A tuple of view_name,view_files if only
 
292
            items inside a view are to be reported on, or None for
 
293
            no view filtering.
291
294
        """
292
295
        if output_file is not None:
293
296
            if output is not None:
310
313
                              'unversioned': '?', # versioned in neither
311
314
                              }
312
315
        self.unversioned_filter = unversioned_filter
 
316
        if view_info is None:
 
317
            self.view_name = None
 
318
            self.view_files = []
 
319
        else:
 
320
            self.view_name = view_info[0]
 
321
            self.view_files = view_info[1]
 
322
            self.output("Operating on whole tree but only reporting on "
 
323
                        "'%s' view." % (self.view_name,))
313
324
 
314
325
    def report(self, file_id, paths, versioned, renamed, modified, exe_change,
315
326
               kind):
330
341
            return
331
342
        if paths[1] == '' and versioned == 'added' and self.suppress_root_add:
332
343
            return
 
344
        if self.view_files and not osutils.is_inside_any(self.view_files,
 
345
            paths[1]):
 
346
            return
333
347
        if versioned == 'unversioned':
334
348
            # skip ignored unversioned files if needed.
335
349
            if self.unversioned_filter is not None: