334
334
raise NotImplementedError('update_revisions is abstract')
336
def pullable_revisions(self, other, stop_revision):
337
raise NotImplementedError('pullable_revisions is abstract')
339
336
def revision_id_to_revno(self, revision_id):
340
337
"""Given a revision id, return its revno"""
341
338
if revision_id is None:
566
563
"""Return the ASCII format string that identifies this format."""
567
564
raise NotImplementedError(self.get_format_string)
566
def get_format_description(self):
567
"""Return the short format description for this format."""
568
raise NotImplementedError(self.get_format_string)
569
570
def initialize(self, a_bzrdir):
570
571
"""Create a branch of this format in a_bzrdir."""
571
572
raise NotImplementedError(self.initialized)
612
613
- a branch-lock lock file [ to be shared with the bzrdir ]
616
def get_format_description(self):
617
"""See BranchFormat.get_format_description()."""
618
return "Branch format 4"
615
620
def initialize(self, a_bzrdir):
616
621
"""Create a branch of this format in a_bzrdir."""
617
622
mutter('creating branch in %s', a_bzrdir.transport.base)
668
673
def get_format_string(self):
669
674
"""See BranchFormat.get_format_string()."""
670
675
return "Bazaar-NG branch format 5\n"
677
def get_format_description(self):
678
"""See BranchFormat.get_format_description()."""
679
return "Branch format 5"
672
681
def initialize(self, a_bzrdir):
673
682
"""Create a branch of this format in a_bzrdir."""
725
734
def get_format_string(self):
726
735
"""See BranchFormat.get_format_string()."""
727
736
return "Bazaar-NG Branch Reference Format 1\n"
738
def get_format_description(self):
739
"""See BranchFormat.get_format_description()."""
740
return "Checkout reference format 1"
729
742
def initialize(self, a_bzrdir, target_branch=None):
730
743
"""Create a branch of this format in a_bzrdir."""
1016
1029
# transaction.register_clean(history, precious=True)
1017
1030
return list(history)
1019
1033
def update_revisions(self, other, stop_revision=None):
1020
1034
"""See Branch.update_revisions."""
1021
if stop_revision is None:
1022
stop_revision = other.last_revision()
1023
### Should this be checking is_ancestor instead of revision_history?
1024
if (stop_revision is not None and
1025
stop_revision in self.revision_history()):
1027
self.fetch(other, stop_revision)
1028
pullable_revs = self.pullable_revisions(other, stop_revision)
1029
if len(pullable_revs) > 0:
1030
self.append_revision(*pullable_revs)
1037
if stop_revision is None:
1038
stop_revision = other.last_revision()
1039
if stop_revision is None:
1040
# if there are no commits, we're done.
1042
# whats the current last revision, before we fetch [and change it
1044
last_rev = self.last_revision()
1045
# we fetch here regardless of whether we need to so that we pickup
1047
self.fetch(other, stop_revision)
1048
my_ancestry = self.repository.get_ancestry(last_rev)
1049
if stop_revision in my_ancestry:
1050
# last_revision is a descendant of stop_revision
1052
# stop_revision must be a descendant of last_revision
1053
stop_graph = self.repository.get_revision_graph(stop_revision)
1054
if last_rev is not None and last_rev not in stop_graph:
1055
# our previous tip is not merged into stop_revision
1056
raise errors.DivergedBranches(self, other)
1057
# make a new revision history from the graph
1058
current_rev_id = stop_revision
1060
while current_rev_id not in (None, NULL_REVISION):
1061
new_history.append(current_rev_id)
1062
current_rev_id_parents = stop_graph[current_rev_id]
1064
current_rev_id = current_rev_id_parents[0]
1066
current_rev_id = None
1067
new_history.reverse()
1068
self.set_revision_history(new_history)
1072
@deprecated_method(zero_eight)
1032
1073
def pullable_revisions(self, other, stop_revision):
1074
"""Please use bzrlib.missing instead."""
1033
1075
other_revno = other.revision_id_to_revno(stop_revision)
1035
1077
return self.missing_revisions(other, other_revno)
1108
1150
# FIXUP this and get_parent in a future branch format bump:
1109
1151
# read and rewrite the file, and have the new format code read
1110
1152
# using .get not .get_utf8. RBC 20060125
1111
self.control_files.put_utf8('parent', url + '\n')
1154
self.control_files._transport.delete('parent')
1156
self.control_files.put_utf8('parent', url + '\n')
1113
1158
def tree_config(self):
1114
1159
return TreeConfig(self)