998
999
def revert(self, filenames=None, old_tree=None, backups=True,
999
1000
pb=None, report_changes=False):
1000
1001
from .conflicts import resolve
1001
with self.lock_tree_write():
1002
with cleanup.ExitStack() as exit_stack:
1003
exit_stack.enter_context(self.lock_tree_write())
1002
1004
if old_tree is None:
1003
1005
basis_tree = self.basis_tree()
1004
basis_tree.lock_read()
1006
exit_stack.enter_context(basis_tree.lock_read())
1005
1007
old_tree = basis_tree
1007
1009
basis_tree = None
1009
conflicts = transform.revert(self, old_tree, filenames, backups, pb,
1011
if filenames is None and len(self.get_parent_ids()) > 1:
1013
last_revision = self.last_revision()
1014
if last_revision != _mod_revision.NULL_REVISION:
1015
if basis_tree is None:
1016
basis_tree = self.basis_tree()
1017
basis_tree.lock_read()
1018
parent_trees.append((last_revision, basis_tree))
1019
self.set_parent_trees(parent_trees)
1022
resolve(self, filenames, ignore_misses=True, recursive=True)
1024
if basis_tree is not None:
1010
conflicts = transform.revert(self, old_tree, filenames, backups, pb,
1012
if filenames is None and len(self.get_parent_ids()) > 1:
1014
last_revision = self.last_revision()
1015
if last_revision != _mod_revision.NULL_REVISION:
1016
if basis_tree is None:
1017
basis_tree = self.basis_tree()
1018
exit_stack.enter_context(basis_tree.lock_read())
1019
parent_trees.append((last_revision, basis_tree))
1020
self.set_parent_trees(parent_trees)
1023
resolve(self, filenames, ignore_misses=True, recursive=True)
1026
1024
return conflicts
1028
1026
def store_uncommitted(self):