/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/workingtree.py

  • Committer: Matthieu Moy
  • Date: 2006-08-04 16:23:43 UTC
  • mto: (2009.1.1 update-r)
  • mto: This revision was merged to the branch mainline in revision 4923.
  • Revision ID: Matthieu.Moy@imag.fr-20060804162343-5dc628faf643da23
Added test-cases for update -r. Tweaked the implementation too.

* builtins.py: don't check the master branch since we just ran
  branch.update()

* Moved the error for revision out of branch history in workingtree.py.

* Document new arguments in workingtree.update()

Show diffs side-by-side

added added

removed removed

Lines of Context:
1383
1383
        raise NotImplementedError(self.unlock)
1384
1384
 
1385
1385
    @needs_write_lock
1386
 
    def update(self,revision=None,old_tip="not_computed"):
 
1386
    def update(self,revision=None,old_tip=0):
1387
1387
        """Update a working tree along its branch.
1388
1388
 
1389
1389
        This will update the branch if its bound too, which means we have multiple trees involved:
1401
1401
        There isn't a single operation at the moment to do that, so we:
1402
1402
        Merge current state -> basis tree of the master w.r.t. the old tree basis.
1403
1403
        Do a 'normal' merge of the old branch basis if it is relevant.
 
1404
 
 
1405
        :param revision: The target revision to update to. Must be in the revision history.
 
1406
        :param old_tip: If branch.update() has already been run, the value it returned 
 
1407
        (old tip of the branch or nil). Otherwise, the number 0.
1404
1408
        """
1405
 
        if old_tip == "not_computed":
 
1409
        if old_tip == 0:
1406
1410
            old_tip = self.branch.update()
1407
1411
        if old_tip is not None:
1408
1412
            self.add_pending_merge(old_tip)
1410
1414
        try:
1411
1415
            if revision is None:
1412
1416
                revision = self.branch.last_revision()
 
1417
            else:
 
1418
                if revision not in self.branch.revision_history():
 
1419
                    raise errors.NoSuchRevision(self.branch, revision)
1413
1420
            result = 0
1414
1421
            if self.last_revision() != revision:
1415
1422
                # merge tree state up to new branch tip.