~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: John Arbash Meinel
  • Date: 2011-01-10 21:31:59 UTC
  • mto: This revision was merged to the branch mainline in revision 5592.
  • Revision ID: john@arbash-meinel.com-20110110213159-lse0quagm5oyxcxu
Fix bug 701212. Don't set the tags for a master branch during update.

We currently avoid trying to write to the master branch by checking that the
source URL is the same as the master URL. Use that same logic to avoid setting
the tag dict under the same circumstances.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
3453
3453
        if local and not bound_location:
3454
3454
            raise errors.LocalRequiresBoundBranch()
3455
3455
        master_branch = None
3456
 
        if not local and bound_location and self.source.user_url != bound_location:
 
3456
        source_is_master = (self.source.user_url == bound_location)
 
3457
        if not local and bound_location and not source_is_master:
3457
3458
            # not pulling from master, so we need to update master.
3458
3459
            master_branch = self.target.get_master_branch(possible_transports)
3459
3460
            master_branch.lock_write()
3465
3466
            return self._pull(overwrite,
3466
3467
                stop_revision, _hook_master=master_branch,
3467
3468
                run_hooks=run_hooks,
3468
 
                _override_hook_target=_override_hook_target)
 
3469
                _override_hook_target=_override_hook_target,
 
3470
                merge_tags_to_master=not source_is_master)
3469
3471
        finally:
3470
3472
            if master_branch:
3471
3473
                master_branch.unlock()
3538
3540
 
3539
3541
    def _pull(self, overwrite=False, stop_revision=None,
3540
3542
             possible_transports=None, _hook_master=None, run_hooks=True,
3541
 
             _override_hook_target=None, local=False):
 
3543
             _override_hook_target=None, local=False,
 
3544
             merge_tags_to_master=True):
3542
3545
        """See Branch.pull.
3543
3546
 
3544
3547
        This function is the core worker, used by GenericInterBranch.pull to
3579
3582
            # so a tags implementation that versions tags can only 
3580
3583
            # pull in the most recent changes. -- JRV20090506
3581
3584
            result.tag_conflicts = self.source.tags.merge_to(self.target.tags,
3582
 
                overwrite)
 
3585
                overwrite, ignore_master=not merge_tags_to_master)
3583
3586
            result.new_revno, result.new_revid = self.target.last_revision_info()
3584
3587
            if _hook_master:
3585
3588
                result.master_branch = _hook_master