~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-10-18 12:54:37 UTC
  • mfrom: (2084.2.1 lightweight-update)
  • Revision ID: pqm@pqm.ubuntu.com-20061018125437-d8794b0eb9f111a7
Support updating lightweight checkouts of readonly branches

Show diffs side-by-side

added added

removed removed

Lines of Context:
1641
1641
        """
1642
1642
        raise NotImplementedError(self.unlock)
1643
1643
 
1644
 
    @needs_write_lock
1645
1644
    def update(self):
1646
1645
        """Update a working tree along its branch.
1647
1646
 
1667
1666
          basis.
1668
1667
        - Do a 'normal' merge of the old branch basis if it is relevant.
1669
1668
        """
1670
 
        old_tip = self.branch.update()
1671
 
 
 
1669
        if self.branch.get_master_branch() is not None:
 
1670
            self.lock_write()
 
1671
            update_branch = True
 
1672
        else:
 
1673
            self.lock_tree_write()
 
1674
            update_branch = False
 
1675
        try:
 
1676
            if update_branch:
 
1677
                old_tip = self.branch.update()
 
1678
            else:
 
1679
                old_tip = None
 
1680
            return self._update_tree(old_tip)
 
1681
        finally:
 
1682
            self.unlock()
 
1683
 
 
1684
    @needs_tree_write_lock
 
1685
    def _update_tree(self, old_tip=None):
 
1686
        """Update a tree to the master branch.
 
1687
 
 
1688
        :param old_tip: if supplied, the previous tip revision the branch,
 
1689
            before it was changed to the master branch's tip.
 
1690
        """
1672
1691
        # here if old_tip is not None, it is the old tip of the branch before
1673
1692
        # it was updated from the master branch. This should become a pending
1674
1693
        # merge in the working tree to preserve the user existing work.  we