/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Jelmer Vernooij
  • Date: 2011-05-14 07:56:12 UTC
  • mto: (5853.2.8 lossy-argument)
  • mto: This revision was merged to the branch mainline in revision 5877.
  • Revision ID: jelmer@samba.org-20110514075612-d53tdgrx926q24mc
Make lossy_push an argument to InterBranch.push.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1098
1098
            stop_revision=stop_revision,
1099
1099
            possible_transports=possible_transports, *args, **kwargs)
1100
1100
 
1101
 
    def push(self, target, overwrite=False, stop_revision=None, *args,
1102
 
        **kwargs):
 
1101
    def push(self, target, overwrite=False, stop_revision=None, lossy=False,
 
1102
            *args, **kwargs):
1103
1103
        """Mirror this branch into target.
1104
1104
 
1105
1105
        This branch is considered to be 'local', having low latency.
1106
1106
        """
1107
1107
        return InterBranch.get(self, target).push(overwrite, stop_revision,
1108
 
            *args, **kwargs)
1109
 
 
1110
 
    def lossy_push(self, target, stop_revision=None):
1111
 
        """Push deltas into another branch.
1112
 
 
1113
 
        :note: This does not, like push, retain the revision ids from 
1114
 
            the source branch and will, rather than adding bzr-specific 
1115
 
            metadata, push only those semantics of the revision that can be 
1116
 
            natively represented by this branch' VCS.
1117
 
 
1118
 
        :param target: Target branch
1119
 
        :param stop_revision: Revision to push, defaults to last revision.
1120
 
        :return: BranchPushResult with an extra member revidmap: 
1121
 
            A dictionary mapping revision ids from the target branch 
1122
 
            to new revision ids in the target branch, for each 
1123
 
            revision that was pushed.
1124
 
        """
1125
 
        inter = InterBranch.get(self, target)
1126
 
        lossy_push = getattr(inter, "lossy_push", None)
1127
 
        if lossy_push is None:
1128
 
            raise errors.LossyPushToSameVCS(self, target)
1129
 
        return lossy_push(stop_revision)
 
1108
            lossy, *args, **kwargs)
1130
1109
 
1131
1110
    def basis_tree(self):
1132
1111
        """Return `Tree` object for last revision."""
3243
3222
        raise NotImplementedError(self.pull)
3244
3223
 
3245
3224
    @needs_write_lock
3246
 
    def push(self, overwrite=False, stop_revision=None,
 
3225
    def push(self, overwrite=False, stop_revision=None, lossy=False,
3247
3226
             _override_hook_source_branch=None):
3248
3227
        """Mirror the source branch into the target branch.
3249
3228
 
3397
3376
            if master_branch:
3398
3377
                master_branch.unlock()
3399
3378
 
3400
 
    def push(self, overwrite=False, stop_revision=None,
 
3379
    def push(self, overwrite=False, stop_revision=None, lossy=False,
3401
3380
             _override_hook_source_branch=None):
3402
3381
        """See InterBranch.push.
3403
3382
 
3408
3387
        This is for use of RemoteBranch, where push is delegated to the
3409
3388
        underlying vfs-based Branch.
3410
3389
        """
 
3390
        if lossy:
 
3391
            raise errors.LossyPushToSameVCS(self.source, self.target)
3411
3392
        # TODO: Public option to disable running hooks - should be trivial but
3412
3393
        # needs tests.
3413
3394
        self.source.lock_read()
3414
3395
        try:
3415
3396
            return _run_with_write_locked_target(
3416
3397
                self.target, self._push_with_bound_branches, overwrite,
3417
 
                stop_revision,
 
3398
                stop_revision, lossy,
3418
3399
                _override_hook_source_branch=_override_hook_source_branch)
3419
3400
        finally:
3420
3401
            self.source.unlock()