~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Patch Queue Manager
  • Date: 2012-04-16 11:35:53 UTC
  • mfrom: (6159.2.8 overwrite-tags)
  • Revision ID: pqm@pqm.ubuntu.com-20120416113553-1vnossk7c384rp4q
(jelmer) Add --overwrite-tags option to push and pull. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
3270
3270
        raise NotImplementedError(self.fetch)
3271
3271
 
3272
3272
 
 
3273
def _fix_overwrite_type(overwrite):
 
3274
    if isinstance(overwrite, bool):
 
3275
        if overwrite:
 
3276
            return ["history", "tags"]
 
3277
        else:
 
3278
            return []
 
3279
    return overwrite
 
3280
 
 
3281
 
3273
3282
class GenericInterBranch(InterBranch):
3274
3283
    """InterBranch implementation that uses public Branch functions."""
3275
3284
 
3440
3449
        result.target_branch = self.target
3441
3450
        result.old_revno, result.old_revid = self.target.last_revision_info()
3442
3451
        self.source.update_references(self.target)
 
3452
        overwrite = _fix_overwrite_type(overwrite)
3443
3453
        if result.old_revid != stop_revision:
3444
3454
            # We assume that during 'push' this repository is closer than
3445
3455
            # the target.
3446
3456
            graph = self.source.repository.get_graph(self.target.repository)
3447
 
            self._update_revisions(stop_revision, overwrite=overwrite,
3448
 
                    graph=graph)
 
3457
            self._update_revisions(stop_revision,
 
3458
                overwrite=("history" in overwrite),
 
3459
                graph=graph)
3449
3460
        if self.source._push_should_merge_tags():
3450
3461
            result.tag_updates, result.tag_conflicts = (
3451
 
                self.source.tags.merge_to(self.target.tags, overwrite))
 
3462
                self.source.tags.merge_to(
 
3463
                self.target.tags, "tags" in overwrite))
3452
3464
        result.new_revno, result.new_revid = self.target.last_revision_info()
3453
3465
        return result
3454
3466
 
3532
3544
            # -- JRV20090506
3533
3545
            result.old_revno, result.old_revid = \
3534
3546
                self.target.last_revision_info()
3535
 
            self._update_revisions(stop_revision, overwrite=overwrite,
 
3547
            overwrite = _fix_overwrite_type(overwrite)
 
3548
            self._update_revisions(stop_revision,
 
3549
                overwrite=("history" in overwrite),
3536
3550
                graph=graph)
3537
3551
            # TODO: The old revid should be specified when merging tags, 
3538
3552
            # so a tags implementation that versions tags can only 
3539
3553
            # pull in the most recent changes. -- JRV20090506
3540
3554
            result.tag_updates, result.tag_conflicts = (
3541
 
                self.source.tags.merge_to(self.target.tags, overwrite,
 
3555
                self.source.tags.merge_to(self.target.tags,
 
3556
                    "tags" in overwrite,
3542
3557
                    ignore_master=not merge_tags_to_master))
3543
3558
            result.new_revno, result.new_revid = self.target.last_revision_info()
3544
3559
            if _hook_master: