35
35
DivergedBranches, LockError, UnlistableStore,
36
36
UnlistableBranch, NoSuchFile)
37
37
from bzrlib.textui import show_status
38
from bzrlib.revision import Revision
38
from bzrlib.revision import Revision, is_ancestor, get_intervening_revisions
39
40
from bzrlib.delta import compare_trees
40
41
from bzrlib.tree import EmptyTree, RevisionTree
41
42
from bzrlib.inventory import Inventory
952
953
# revision in this branch is completely merged into the other,
953
954
# then we should still be able to pull.
954
955
from bzrlib.fetch import greedy_fetch
955
from bzrlib.revision import get_intervening_revisions
956
956
if stop_revision is None:
957
957
stop_revision = other.last_revision()
958
### Should this be checking is_ancestor instead of revision_history?
958
959
if (stop_revision is not None and
959
960
stop_revision in self.revision_history()):
961
962
greedy_fetch(to_branch=self, from_branch=other,
962
963
revision=stop_revision)
963
pullable_revs = self.missing_revisions(
964
other, other.revision_id_to_revno(stop_revision))
964
pullable_revs = self.pullable_revisions(other, stop_revision)
965
965
if pullable_revs:
966
966
greedy_fetch(to_branch=self,
967
967
from_branch=other,
968
968
revision=pullable_revs[-1])
969
969
self.append_revision(*pullable_revs)
971
def pullable_revisions(self, other, stop_revision):
972
other_revno = other.revision_id_to_revno(stop_revision)
974
return self.missing_revisions(other, other_revno)
975
except DivergedBranches, e:
977
pullable_revs = get_intervening_revisions(self.last_revision(),
979
assert self.last_revision() not in pullable_revs
981
except bzrlib.errors.NotAncestor:
982
if is_ancestor(self.last_revision(), stop_revision, self):
972
988
def commit(self, *args, **kw):
973
989
from bzrlib.commit import Commit