~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: INADA Naoki
  • Date: 2011-05-18 06:27:34 UTC
  • mfrom: (5887 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5894.
  • Revision ID: songofacandy@gmail.com-20110518062734-1ilhll0rrqyyp8um
merge from lp:bzr and resolve conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1102
1102
            stop_revision=stop_revision,
1103
1103
            possible_transports=possible_transports, *args, **kwargs)
1104
1104
 
1105
 
    def push(self, target, overwrite=False, stop_revision=None, *args,
1106
 
        **kwargs):
 
1105
    def push(self, target, overwrite=False, stop_revision=None, lossy=False,
 
1106
            *args, **kwargs):
1107
1107
        """Mirror this branch into target.
1108
1108
 
1109
1109
        This branch is considered to be 'local', having low latency.
1110
1110
        """
1111
1111
        return InterBranch.get(self, target).push(overwrite, stop_revision,
1112
 
            *args, **kwargs)
1113
 
 
1114
 
    def lossy_push(self, target, stop_revision=None):
1115
 
        """Push deltas into another branch.
1116
 
 
1117
 
        :note: This does not, like push, retain the revision ids from 
1118
 
            the source branch and will, rather than adding bzr-specific 
1119
 
            metadata, push only those semantics of the revision that can be 
1120
 
            natively represented by this branch' VCS.
1121
 
 
1122
 
        :param target: Target branch
1123
 
        :param stop_revision: Revision to push, defaults to last revision.
1124
 
        :return: BranchPushResult with an extra member revidmap: 
1125
 
            A dictionary mapping revision ids from the target branch 
1126
 
            to new revision ids in the target branch, for each 
1127
 
            revision that was pushed.
1128
 
        """
1129
 
        inter = InterBranch.get(self, target)
1130
 
        lossy_push = getattr(inter, "lossy_push", None)
1131
 
        if lossy_push is None:
1132
 
            raise errors.LossyPushToSameVCS(self, target)
1133
 
        return lossy_push(stop_revision)
 
1112
            lossy, *args, **kwargs)
1134
1113
 
1135
1114
    def basis_tree(self):
1136
1115
        """Return `Tree` object for last revision."""
3251
3230
        raise NotImplementedError(self.pull)
3252
3231
 
3253
3232
    @needs_write_lock
3254
 
    def push(self, overwrite=False, stop_revision=None,
 
3233
    def push(self, overwrite=False, stop_revision=None, lossy=False,
3255
3234
             _override_hook_source_branch=None):
3256
3235
        """Mirror the source branch into the target branch.
3257
3236
 
3405
3384
            if master_branch:
3406
3385
                master_branch.unlock()
3407
3386
 
3408
 
    def push(self, overwrite=False, stop_revision=None,
 
3387
    def push(self, overwrite=False, stop_revision=None, lossy=False,
3409
3388
             _override_hook_source_branch=None):
3410
3389
        """See InterBranch.push.
3411
3390
 
3416
3395
        This is for use of RemoteBranch, where push is delegated to the
3417
3396
        underlying vfs-based Branch.
3418
3397
        """
 
3398
        if lossy:
 
3399
            raise errors.LossyPushToSameVCS(self.source, self.target)
3419
3400
        # TODO: Public option to disable running hooks - should be trivial but
3420
3401
        # needs tests.
3421
3402
        self.source.lock_read()
3422
3403
        try:
3423
3404
            return _run_with_write_locked_target(
3424
3405
                self.target, self._push_with_bound_branches, overwrite,
3425
 
                stop_revision,
 
3406
                stop_revision, 
3426
3407
                _override_hook_source_branch=_override_hook_source_branch)
3427
3408
        finally:
3428
3409
            self.source.unlock()