662
662
raise errors.UnsupportedOperation(self.get_reference_info, self)
664
664
@needs_write_lock
665
def fetch(self, from_branch, last_revision=None, pb=None, fetch_spec=None):
665
def fetch(self, from_branch, last_revision=None, fetch_spec=None):
666
666
"""Copy revisions from from_branch into this branch.
668
668
:param from_branch: Where to copy from.
669
669
:param last_revision: What revision to stop at (None for at the end
671
:param pb: An optional progress bar to use.
672
671
:param fetch_spec: If specified, a SearchResult or
673
672
PendingAncestryResult that describes which revisions to copy. This
674
673
allows copying multiple heads at once. Mutually exclusive with
680
679
"fetch_spec and last_revision are mutually exclusive.")
681
680
if self.base == from_branch.base:
684
symbol_versioning.warn(
685
symbol_versioning.deprecated_in((1, 14, 0))
686
% "pb parameter to fetch()")
687
682
from_branch.lock_read()
689
684
if last_revision is None and fetch_spec is None:
691
686
last_revision = _mod_revision.ensure_null(last_revision)
692
687
return self.repository.fetch(from_branch.repository,
693
688
revision_id=last_revision,
694
pb=pb, fetch_spec=fetch_spec)
689
fetch_spec=fetch_spec)
696
691
from_branch.unlock()
1007
1002
return (0, _mod_revision.NULL_REVISION)
1009
@deprecated_method(deprecated_in((1, 6, 0)))
1010
def missing_revisions(self, other, stop_revision=None):
1011
"""Return a list of new revisions that would perfectly fit.
1013
If self and other have not diverged, return a list of the revisions
1014
present in other, but missing from self.
1016
self_history = self.revision_history()
1017
self_len = len(self_history)
1018
other_history = other.revision_history()
1019
other_len = len(other_history)
1020
common_index = min(self_len, other_len) -1
1021
if common_index >= 0 and \
1022
self_history[common_index] != other_history[common_index]:
1023
raise errors.DivergedBranches(self, other)
1025
if stop_revision is None:
1026
stop_revision = other_len
1028
if stop_revision > other_len:
1029
raise errors.NoSuchRevision(self, stop_revision)
1030
return other_history[self_len:stop_revision]
1032
1004
def update_revisions(self, other, stop_revision=None, overwrite=False,
1033
1005
graph=None, fetch_tags=True):
1034
1006
"""Pull in new perfect-fit revisions.