~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Martin Pool
  • Date: 2007-05-07 12:03:14 UTC
  • mto: (2483.1.1 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 2484.
  • Revision ID: mbp@sourcefrog.net-20070507120314-a2h78bjezemwyl17
Review cleanups from John, mostly docs

Show diffs side-by-side

added added

removed removed

Lines of Context:
1476
1476
 
1477
1477
    @needs_write_lock
1478
1478
    def pull(self, source, overwrite=False, stop_revision=None,
1479
 
        _hook_master=None, run_hooks=True):
 
1479
             _hook_master=None, run_hooks=True):
1480
1480
        """See Branch.pull.
1481
1481
 
1482
1482
        :param _hook_master: Private parameter - set the branch to 
1526
1526
 
1527
1527
    @needs_read_lock
1528
1528
    def push(self, target, overwrite=False, stop_revision=None,
1529
 
        _override_hook_source_branch=None):
 
1529
             _override_hook_source_branch=None):
1530
1530
        """See Branch.push.
1531
1531
 
1532
1532
        This is the basic concrete implementation of push()
 
1533
 
 
1534
        :param _override_hook_source_branch: If specified, run
 
1535
        the hooks passing this Branch as the source, rather than self.  
 
1536
        This is for use of RemoteBranch, where push is delegated to the
 
1537
        underlying vfs-based Branch. 
1533
1538
        """
1534
1539
        # TODO: Public option to disable running hooks - should be trivial but
1535
1540
        # needs tests.
1545
1550
    def _push_with_bound_branches(self, target, overwrite,
1546
1551
            stop_revision,
1547
1552
            _override_hook_source_branch=None):
1548
 
        """Updates branch.push to be bound branch aware
 
1553
        """Push from self into target, and into target's master if any.
1549
1554
        
1550
1555
        This is on the base BzrBranch class even though it doesn't support 
1551
1556
        bound branches because the *target* might be bound.
1552
 
        
1553
 
        :param run_hooks_cb: Callback taking the Result object which should run
1554
 
            any applicable hooks.  It can make adjustments to the Result object 
1555
 
            first.  May be a do-nothing function to disable running hooks.
1556
 
            Called with all branches locked, including the master if any.
1557
1557
        """
1558
1558
        def _run_hooks():
1559
1559
            if _override_hook_source_branch:
1563
1563
 
1564
1564
        bound_location = target.get_bound_location()
1565
1565
        if bound_location and target.base != bound_location:
1566
 
            # there is a master branch and we're not pushing to it, so we need
1567
 
            # to update the master.
 
1566
            # there is a master branch.
1568
1567
            #
1569
 
            # TODO: don't just compare the locations, instead look at the lock
1570
 
            # tokens to see if they're the same object -- mbp 20070504
 
1568
            # XXX: Why the second check?  Is it even supported for a branch to
 
1569
            # be bound to itself? -- mbp 20070507
1571
1570
            master_branch = target.get_master_branch()
1572
1571
            master_branch.lock_write()
1573
1572
            try:
1687
1686
        
1688
1687
    @needs_write_lock
1689
1688
    def pull(self, source, overwrite=False, stop_revision=None,
1690
 
        run_hooks=True):
1691
 
        """Extends branch.pull to be bound branch aware.
 
1689
             run_hooks=True):
 
1690
        """Pull from source into self, updating my master if any.
1692
1691
        
1693
1692
        :param run_hooks: Private parameter - if false, this branch
1694
1693
            is being called because it's the master of the primary branch,