~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Jelmer Vernooij
  • Date: 2012-07-02 18:21:51 UTC
  • mfrom: (6531 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6535.
  • Revision ID: jelmer@samba.org-20120702182151-zk9utamutjtjhipq
mergeĀ lp:bzr

Show diffs side-by-side

added added

removed removed

Lines of Context:
1034
1034
    def _read_last_revision_info(self):
1035
1035
        raise NotImplementedError(self._read_last_revision_info)
1036
1036
 
1037
 
    @deprecated_method(deprecated_in((2, 4, 0)))
1038
 
    def import_last_revision_info(self, source_repo, revno, revid):
1039
 
        """Set the last revision info, importing from another repo if necessary.
1040
 
 
1041
 
        :param source_repo: Source repository to optionally fetch from
1042
 
        :param revno: Revision number of the new tip
1043
 
        :param revid: Revision id of the new tip
1044
 
        """
1045
 
        if not self.repository.has_same_location(source_repo):
1046
 
            self.repository.fetch(source_repo, revision_id=revid)
1047
 
        self.set_last_revision_info(revno, revid)
1048
 
 
1049
1037
    def import_last_revision_info_and_tags(self, source, revno, revid,
1050
1038
                                           lossy=False):
1051
1039
        """Set the last revision info, importing from another repo if necessary.
1694
1682
        """True if this format supports leaving locks in place."""
1695
1683
        return False # by default
1696
1684
 
1697
 
    @classmethod
1698
 
    @deprecated_method(deprecated_in((2, 4, 0)))
1699
 
    def unregister_format(klass, format):
1700
 
        format_registry.remove(format)
1701
 
 
1702
1685
    def __str__(self):
1703
1686
        return self.get_format_description().rstrip()
1704
1687
 
3131
3114
        raise NotImplementedError(self.fetch)
3132
3115
 
3133
3116
 
 
3117
def _fix_overwrite_type(overwrite):
 
3118
    if isinstance(overwrite, bool):
 
3119
        if overwrite:
 
3120
            return ["history", "tags"]
 
3121
        else:
 
3122
            return []
 
3123
    return overwrite
 
3124
 
 
3125
 
3134
3126
class GenericInterBranch(InterBranch):
3135
3127
    """InterBranch implementation that uses public Branch functions."""
3136
3128
 
3301
3293
        result.target_branch = self.target
3302
3294
        result.old_revno, result.old_revid = self.target.last_revision_info()
3303
3295
        self.source.update_references(self.target)
 
3296
        overwrite = _fix_overwrite_type(overwrite)
3304
3297
        if result.old_revid != stop_revision:
3305
3298
            # We assume that during 'push' this repository is closer than
3306
3299
            # the target.
3307
3300
            graph = self.source.repository.get_graph(self.target.repository)
3308
 
            self._update_revisions(stop_revision, overwrite=overwrite,
3309
 
                    graph=graph)
 
3301
            self._update_revisions(stop_revision,
 
3302
                overwrite=("history" in overwrite),
 
3303
                graph=graph)
3310
3304
        if self.source._push_should_merge_tags():
3311
3305
            result.tag_updates, result.tag_conflicts = (
3312
 
                self.source.tags.merge_to(self.target.tags, overwrite))
 
3306
                self.source.tags.merge_to(
 
3307
                self.target.tags, "tags" in overwrite))
3313
3308
        result.new_revno, result.new_revid = self.target.last_revision_info()
3314
3309
        return result
3315
3310
 
3393
3388
            # -- JRV20090506
3394
3389
            result.old_revno, result.old_revid = \
3395
3390
                self.target.last_revision_info()
3396
 
            self._update_revisions(stop_revision, overwrite=overwrite,
 
3391
            overwrite = _fix_overwrite_type(overwrite)
 
3392
            self._update_revisions(stop_revision,
 
3393
                overwrite=("history" in overwrite),
3397
3394
                graph=graph)
3398
3395
            # TODO: The old revid should be specified when merging tags, 
3399
3396
            # so a tags implementation that versions tags can only 
3400
3397
            # pull in the most recent changes. -- JRV20090506
3401
3398
            result.tag_updates, result.tag_conflicts = (
3402
 
                self.source.tags.merge_to(self.target.tags, overwrite,
 
3399
                self.source.tags.merge_to(self.target.tags,
 
3400
                    "tags" in overwrite,
3403
3401
                    ignore_master=not merge_tags_to_master))
3404
3402
            result.new_revno, result.new_revid = self.target.last_revision_info()
3405
3403
            if _hook_master: