~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Robert Collins
  • Date: 2007-10-30 20:03:23 UTC
  • mto: (2592.6.15 repository)
  • mto: This revision was merged to the branch mainline in revision 2951.
  • Revision ID: robertc@robertcollins.net-20071030200323-2iyytqgqcltpngta
* Revert takes out an appropriate lock when reverting to a basis tree, and
  does not read the basis inventory twice. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1960
1960
                ' as of bzr 0.91.  Please use None (the default) instead.',
1961
1961
                DeprecationWarning, stacklevel=2)
1962
1962
        if old_tree is None:
1963
 
            old_tree = self.basis_tree()
1964
 
        conflicts = transform.revert(self, old_tree, filenames, backups, pb,
1965
 
                                     report_changes)
1966
 
        if filenames is None:
1967
 
            self.set_parent_ids(self.get_parent_ids()[:1])
1968
 
            resolve(self)
 
1963
            basis_tree = self.basis_tree()
 
1964
            basis_tree.lock_read()
 
1965
            old_tree = basis_tree
1969
1966
        else:
1970
 
            resolve(self, filenames, ignore_misses=True)
 
1967
            basis_tree = None
 
1968
        try:
 
1969
            conflicts = transform.revert(self, old_tree, filenames, backups, pb,
 
1970
                                         report_changes)
 
1971
            if filenames is None:
 
1972
                parent_trees = []
 
1973
                last_revision = self.last_revision()
 
1974
                if last_revision != NULL_REVISION:
 
1975
                    if basis_tree is None:
 
1976
                        basis_tree = self.basis_tree()
 
1977
                        basis_tree.lock_read()
 
1978
                    parent_trees.append((last_revision, basis_tree))
 
1979
                self.set_parent_trees(parent_trees)
 
1980
                resolve(self)
 
1981
            else:
 
1982
                resolve(self, filenames, ignore_misses=True)
 
1983
        finally:
 
1984
            if basis_tree is not None:
 
1985
                basis_tree.unlock()
1971
1986
        return conflicts
1972
1987
 
1973
1988
    def revision_tree(self, revision_id):