1351
1357
basis_tree.unlock()
1352
1358
return conflicts
1361
def store_uncommitted(self):
1362
"""Store uncommitted changes from the tree in the branch."""
1363
target_tree = self.basis_tree()
1364
shelf_creator = shelf.ShelfCreator(self, target_tree)
1366
if not shelf_creator.shelve_all():
1368
self.branch.store_uncommitted(shelf_creator)
1369
shelf_creator.transform()
1371
shelf_creator.finalize()
1372
note('Uncommitted changes stored in branch "%s".', self.branch.nick)
1375
def restore_uncommitted(self):
1376
"""Restore uncommitted changes from the branch into the tree."""
1377
unshelver = self.branch.get_unshelver(self)
1378
if unshelver is None:
1381
merger = unshelver.make_merger()
1382
merger.ignore_zero = True
1384
self.branch.store_uncommitted(None)
1386
unshelver.finalize()
1354
1388
def revision_tree(self, revision_id):
1355
1389
"""See Tree.revision_tree.
3078
3112
def __ne__(self, other):
3079
3113
return not (self == other)
3082
@symbol_versioning.deprecated_method(
3083
symbol_versioning.deprecated_in((2, 4, 0)))
3084
def get_default_format(klass):
3085
"""Return the current default format."""
3086
return format_registry.get_default()
3088
3115
def get_format_description(self):
3089
3116
"""Return the short description for this format."""
3090
3117
raise NotImplementedError(self.get_format_description)
3106
3133
"""True if this format supports stored views."""
3110
@symbol_versioning.deprecated_method(
3111
symbol_versioning.deprecated_in((2, 4, 0)))
3112
def register_format(klass, format):
3113
format_registry.register(format)
3116
@symbol_versioning.deprecated_method(
3117
symbol_versioning.deprecated_in((2, 4, 0)))
3118
def register_extra_format(klass, format):
3119
format_registry.register_extra(format)
3122
@symbol_versioning.deprecated_method(
3123
symbol_versioning.deprecated_in((2, 4, 0)))
3124
def unregister_extra_format(klass, format):
3125
format_registry.unregister_extra(format)
3128
@symbol_versioning.deprecated_method(
3129
symbol_versioning.deprecated_in((2, 4, 0)))
3130
def get_formats(klass):
3131
return format_registry._get_all()
3134
@symbol_versioning.deprecated_method(
3135
symbol_versioning.deprecated_in((2, 4, 0)))
3136
def set_default_format(klass, format):
3137
format_registry.set_default(format)
3140
@symbol_versioning.deprecated_method(
3141
symbol_versioning.deprecated_in((2, 4, 0)))
3142
def unregister_format(klass, format):
3143
format_registry.remove(format)
3136
def get_controldir_for_branch(self):
3137
"""Get the control directory format for creating branches.
3139
This is to support testing of working tree formats that can not exist
3140
in the same control directory as a branch.
3142
return self._matchingbzrdir
3145
class WorkingTreeFormatMetaDir(bzrdir.BzrFormat, WorkingTreeFormat):
3146
"""Base class for working trees that live in bzr meta directories."""
3149
WorkingTreeFormat.__init__(self)
3150
bzrdir.BzrFormat.__init__(self)
3153
def find_format_string(klass, controldir):
3154
"""Return format name for the working tree object in controldir."""
3156
transport = controldir.get_workingtree_transport(None)
3157
return transport.get_bytes("format")
3158
except errors.NoSuchFile:
3159
raise errors.NoWorkingTree(base=transport.base)
3162
def find_format(klass, controldir):
3163
"""Return the format for the working tree object in controldir."""
3164
format_string = klass.find_format_string(controldir)
3165
return klass._find_format(format_registry, 'working tree',
3168
def check_support_status(self, allow_unsupported, recommend_upgrade=True,
3170
WorkingTreeFormat.check_support_status(self,
3171
allow_unsupported=allow_unsupported, recommend_upgrade=recommend_upgrade,
3173
bzrdir.BzrFormat.check_support_status(self, allow_unsupported=allow_unsupported,
3174
recommend_upgrade=recommend_upgrade, basedir=basedir)
3145
3176
def get_controldir_for_branch(self):
3146
3177
"""Get the control directory format for creating branches.