335
334
raise NotImplementedError('update_revisions is abstract')
337
def pullable_revisions(self, other, stop_revision):
338
raise NotImplementedError('pullable_revisions is abstract')
340
336
def revision_id_to_revno(self, revision_id):
341
337
"""Given a revision id, return its revno"""
342
338
if revision_id is None:
567
563
"""Return the ASCII format string that identifies this format."""
568
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)
570
570
def initialize(self, a_bzrdir):
571
571
"""Create a branch of this format in a_bzrdir."""
572
572
raise NotImplementedError(self.initialized)
610
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"
613
620
def initialize(self, a_bzrdir):
614
621
"""Create a branch of this format in a_bzrdir."""
615
622
mutter('creating branch in %s', a_bzrdir.transport.base)
663
673
def get_format_string(self):
664
674
"""See BranchFormat.get_format_string()."""
665
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"
667
681
def initialize(self, a_bzrdir):
668
682
"""Create a branch of this format in a_bzrdir."""
720
734
def get_format_string(self):
721
735
"""See BranchFormat.get_format_string()."""
722
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"
724
742
def initialize(self, a_bzrdir, target_branch=None):
725
743
"""Create a branch of this format in a_bzrdir."""
1011
1029
# transaction.register_clean(history, precious=True)
1012
1030
return list(history)
1014
1033
def update_revisions(self, other, stop_revision=None):
1015
1034
"""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)
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)
1027
1073
def pullable_revisions(self, other, stop_revision):
1074
"""Please use bzrlib.missing instead."""
1028
1075
other_revno = other.revision_id_to_revno(stop_revision)
1030
1077
return self.missing_revisions(other, other_revno)
1103
1150
# FIXUP this and get_parent in a future branch format bump:
1104
1151
# read and rewrite the file, and have the new format code read
1105
1152
# using .get not .get_utf8. RBC 20060125
1106
self.control_files.put_utf8('parent', url + '\n')
1154
self.control_files._transport.delete('parent')
1156
self.control_files.put_utf8('parent', url + '\n')
1108
1158
def tree_config(self):
1109
1159
return TreeConfig(self)