335
340
raise NotImplementedError('update_revisions is abstract')
337
def pullable_revisions(self, other, stop_revision):
338
raise NotImplementedError('pullable_revisions is abstract')
340
342
def revision_id_to_revno(self, revision_id):
341
343
"""Given a revision id, return its revno"""
342
344
if revision_id is None:
567
569
"""Return the ASCII format string that identifies this format."""
568
570
raise NotImplementedError(self.get_format_string)
572
def get_format_description(self):
573
"""Return the short format description for this format."""
574
raise NotImplementedError(self.get_format_string)
570
576
def initialize(self, a_bzrdir):
571
577
"""Create a branch of this format in a_bzrdir."""
572
578
raise NotImplementedError(self.initialized)
610
619
- a branch-lock lock file [ to be shared with the bzrdir ]
622
def get_format_description(self):
623
"""See BranchFormat.get_format_description()."""
624
return "Branch format 4"
613
626
def initialize(self, a_bzrdir):
614
627
"""Create a branch of this format in a_bzrdir."""
615
628
mutter('creating branch in %s', a_bzrdir.transport.base)
663
679
def get_format_string(self):
664
680
"""See BranchFormat.get_format_string()."""
665
681
return "Bazaar-NG branch format 5\n"
683
def get_format_description(self):
684
"""See BranchFormat.get_format_description()."""
685
return "Branch format 5"
667
687
def initialize(self, a_bzrdir):
668
688
"""Create a branch of this format in a_bzrdir."""
720
740
def get_format_string(self):
721
741
"""See BranchFormat.get_format_string()."""
722
742
return "Bazaar-NG Branch Reference Format 1\n"
744
def get_format_description(self):
745
"""See BranchFormat.get_format_description()."""
746
return "Checkout reference format 1"
724
748
def initialize(self, a_bzrdir, target_branch=None):
725
749
"""Create a branch of this format in a_bzrdir."""
1011
1041
# transaction.register_clean(history, precious=True)
1012
1042
return list(history)
1014
1045
def update_revisions(self, other, stop_revision=None):
1015
1046
"""See Branch.update_revisions."""
1016
if stop_revision is None:
1017
stop_revision = other.last_revision()
1018
### Should this be checking is_ancestor instead of revision_history?
1019
if (stop_revision is not None and
1020
stop_revision in self.revision_history()):
1022
self.fetch(other, stop_revision)
1023
pullable_revs = self.pullable_revisions(other, stop_revision)
1024
if len(pullable_revs) > 0:
1025
self.append_revision(*pullable_revs)
1049
if stop_revision is None:
1050
stop_revision = other.last_revision()
1051
if stop_revision is None:
1052
# if there are no commits, we're done.
1054
# whats the current last revision, before we fetch [and change it
1056
last_rev = self.last_revision()
1057
# we fetch here regardless of whether we need to so that we pickup
1059
self.fetch(other, stop_revision)
1060
my_ancestry = self.repository.get_ancestry(last_rev)
1061
if stop_revision in my_ancestry:
1062
# last_revision is a descendant of stop_revision
1064
# stop_revision must be a descendant of last_revision
1065
stop_graph = self.repository.get_revision_graph(stop_revision)
1066
if last_rev is not None and last_rev not in stop_graph:
1067
# our previous tip is not merged into stop_revision
1068
raise errors.DivergedBranches(self, other)
1069
# make a new revision history from the graph
1070
current_rev_id = stop_revision
1072
while current_rev_id not in (None, NULL_REVISION):
1073
new_history.append(current_rev_id)
1074
current_rev_id_parents = stop_graph[current_rev_id]
1076
current_rev_id = current_rev_id_parents[0]
1078
current_rev_id = None
1079
new_history.reverse()
1080
self.set_revision_history(new_history)
1084
@deprecated_method(zero_eight)
1027
1085
def pullable_revisions(self, other, stop_revision):
1086
"""Please use bzrlib.missing instead."""
1028
1087
other_revno = other.revision_id_to_revno(stop_revision)
1030
1089
return self.missing_revisions(other, other_revno)
1103
1162
# FIXUP this and get_parent in a future branch format bump:
1104
1163
# read and rewrite the file, and have the new format code read
1105
1164
# using .get not .get_utf8. RBC 20060125
1106
self.control_files.put_utf8('parent', url + '\n')
1166
self.control_files._transport.delete('parent')
1168
self.control_files.put_utf8('parent', url + '\n')
1108
1170
def tree_config(self):
1109
1171
return TreeConfig(self)