1277
1277
This format modified the hash cache from the format 1 hash cache.
1280
def initialize(self, a_bzrdir):
1280
def initialize(self, a_bzrdir, revision_id=None):
1281
1281
"""See WorkingTreeFormat.initialize()."""
1282
1282
if not isinstance(a_bzrdir.transport, LocalTransport):
1283
1283
raise errors.NotLocalUrl(a_bzrdir.transport.base)
1284
1284
branch = a_bzrdir.open_branch()
1285
if revision_id is not None:
1288
revision_history = branch.revision_history()
1290
position = revision_history.index(revision_id)
1292
raise errors.NoSuchRevision(branch, revision_id)
1293
branch.set_revision_history(revision_history[:position + 1])
1285
1296
revision = branch.last_revision()
1286
1297
basis_tree = branch.repository.revision_tree(revision)
1287
1298
inv = basis_tree.inventory
1329
1340
"""See WorkingTreeFormat.get_format_string()."""
1330
1341
return "Bazaar-NG Working Tree format 3"
1332
def initialize(self, a_bzrdir):
1333
"""See WorkingTreeFormat.initialize()."""
1343
def initialize(self, a_bzrdir, revision_id=None):
1344
"""See WorkingTreeFormat.initialize().
1346
revision_id allows creating a working tree at a differnet
1347
revision than the branch is at.
1334
1349
if not isinstance(a_bzrdir.transport, LocalTransport):
1335
1350
raise errors.NotLocalUrl(a_bzrdir.transport.base)
1336
1351
transport = a_bzrdir.get_workingtree_transport(self)
1337
1352
control_files = LockableFiles(transport, 'lock')
1338
1353
control_files.put_utf8('format', self.get_format_string())
1339
1354
branch = a_bzrdir.open_branch()
1340
revision = branch.last_revision()
1341
basis_tree = branch.repository.revision_tree(revision)
1342
inv = basis_tree.inventory
1355
if revision_id is None:
1356
revision_id = branch.last_revision()
1357
new_basis_tree = branch.repository.revision_tree(revision_id)
1358
inv = new_basis_tree.inventory
1343
1359
wt = WorkingTree3(a_bzrdir.root_transport.base,