~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/delta.py

  • Committer: Martin Pool
  • Date: 2009-07-27 06:28:35 UTC
  • mto: This revision was merged to the branch mainline in revision 4587.
  • Revision ID: mbp@sourcefrog.net-20090727062835-o66p8it658tq1sma
Add CountedLock.get_physical_lock_status

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,
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: