~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Robert Collins
  • Date: 2005-10-18 06:42:17 UTC
  • mfrom: (0.2.1)
  • mto: This revision was merged to the branch mainline in revision 1463.
  • Revision ID: robertc@robertcollins.net-20051018064217-e810bd94c74a9ad1
Factor out the guts of 'pull' from the command into WorkingTree.pull().
(Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
from bzrlib.branch import Branch, needs_read_lock, needs_write_lock, quotefn
28
28
import bzrlib.tree
29
29
from bzrlib.osutils import appendpath, file_kind, isdir, splitpath, relpath
30
 
from bzrlib.errors import BzrCheckError
 
30
from bzrlib.errors import BzrCheckError, DivergedBranches
31
31
from bzrlib.trace import mutter
32
32
 
33
33
class TreeEntry(object):
305
305
                conflicted.add(stem)
306
306
                yield stem
307
307
 
 
308
    @needs_write_lock
 
309
    def pull(self, source, remember=False):
 
310
        from bzrlib.merge import merge
 
311
        source.lock_read()
 
312
        try:
 
313
            old_revno = self.branch.revno()
 
314
            old_revision_history = self.branch.revision_history()
 
315
            try:
 
316
                self.branch.update_revisions(source)
 
317
            except DivergedBranches:
 
318
                if True:
 
319
                    raise
 
320
            new_revision_history = self.branch.revision_history()
 
321
            if new_revision_history != old_revision_history:
 
322
                merge((self.basedir, -1), (self.basedir, old_revno), check_clean=False)
 
323
            if self.branch.get_parent() is None or remember:
 
324
                self.branch.set_parent(source.base)
 
325
        finally:
 
326
            source.unlock()
 
327
 
308
328
    def extras(self):
309
329
        """Yield all unknown files in this WorkingTree.
310
330