~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tree.py

Add tests for require_versioned to the InterTree.compare() test suite.

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
    """
53
53
    
54
54
    def compare(self, other, want_unchanged=False, specific_files=None,
55
 
        extra_trees=None):
 
55
        extra_trees=None, require_versioned=False):
56
56
        """Return the changes from other to this tree.
57
57
 
58
58
        :param other: A tree to compare with.
64
64
            unchanged entries in the result.
65
65
        :param extra_trees: An optional list of additional trees to use when
66
66
            mapping the contents of specific_files (paths) to file_ids.
 
67
        :param require_versioned: An optional boolean (defaults to False). When
 
68
            supplied and True all the 'specific_files' must be versioned, or
 
69
            a PathsNotVersionedError will be thrown.
67
70
 
68
71
        The comparison will be performed by an InterTree object looked up on 
69
72
        self and other.
71
74
        return InterTree.get(self, other).compare(
72
75
            want_unchanged=want_unchanged,
73
76
            specific_files=specific_files,
74
 
            extra_trees=extra_trees)
 
77
            extra_trees=extra_trees,
 
78
            require_versioned=require_versioned,
 
79
            )
75
80
    
76
81
    def conflicts(self):
77
82
        """Get a list of the conflicts in the tree.
369
374
    _optimisers = set()
370
375
 
371
376
    def compare(self, want_unchanged=False, specific_files=None,
372
 
        extra_trees=None):
 
377
        extra_trees=None, require_versioned=False):
373
378
        """Return the changes from source to target.
374
379
 
375
380
        :return: A TreeDelta.
381
386
            unchanged entries in the result.
382
387
        :param extra_trees: An optional list of additional trees to use when
383
388
            mapping the contents of specific_files (paths) to file_ids.
 
389
        :param require_versioned: An optional boolean (defaults to False). When
 
390
            supplied and True all the 'specific_files' must be versioned, or
 
391
            a PathsNotVersionedError will be thrown.
384
392
        """
385
393
        # imported later to avoid circular imports
386
394
        from bzrlib.delta import compare_trees
390
398
            want_unchanged=want_unchanged,
391
399
            specific_files=specific_files,
392
400
            extra_trees=extra_trees,
 
401
            require_versioned=require_versioned,
393
402
            )