541
541
rev = self.repository.get_revision(revision_id)
542
542
new_history = rev.get_history(self.repository)[1:]
543
543
destination.set_revision_history(new_history)
544
parent = self.get_parent()
546
destination.set_parent(parent)
545
parent = self.get_parent()
546
except errors.InaccessibleParent, e:
547
mutter('parent was not accessible to copy: %s', e)
550
destination.set_parent(parent)
575
579
mainline_parent_id = revision_id
576
580
return BranchCheckResult(self)
582
def create_checkout(self, to_location, revision_id=None,
584
"""Create a checkout of a branch.
586
:param to_location: The url to produce the checkout at
587
:param revision_id: The revision to check out
588
:param lightweight: If True, produce a lightweight checkout, otherwise,
589
produce a bound branch (heavyweight checkout)
590
:return: The tree of the created checkout
593
t = transport.get_transport(to_location)
596
except errors.FileExists:
598
checkout = bzrdir.BzrDirMetaFormat1().initialize_on_transport(t)
599
BranchReferenceFormat().initialize(checkout, self)
601
checkout_branch = bzrdir.BzrDir.create_branch_convenience(
602
to_location, force_new_tree=False)
603
checkout = checkout_branch.bzrdir
604
checkout_branch.bind(self)
605
if revision_id is not None:
606
rh = checkout_branch.revision_history()
607
new_rh = rh[:rh.index(revision_id) + 1]
608
checkout_branch.set_revision_history(new_rh)
609
return checkout.create_workingtree(revision_id)
579
612
class BranchFormat(object):
580
613
"""An encapsulation of the initialization and open routines for a format.
1067
1100
transaction = self.get_transaction()
1068
1101
history = transaction.map.find_revision_history()
1069
1102
if history is not None:
1070
mutter("cache hit for revision-history in %s", self)
1103
# mutter("cache hit for revision-history in %s", self)
1071
1104
return list(history)
1072
1105
decode_utf8 = cache_utf8.decode
1073
1106
history = [decode_utf8(l.rstrip('\r\n')) for l in
1178
1211
# turn it into a url
1179
1212
if parent.startswith('/'):
1180
1213
parent = urlutils.local_path_to_url(parent.decode('utf8'))
1181
return urlutils.join(self.base[:-1], parent)
1215
return urlutils.join(self.base[:-1], parent)
1216
except errors.InvalidURLJoin, e:
1217
raise errors.InaccessibleParent(parent, self.base)
1184
1220
def get_push_location(self):