/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: John Arbash Meinel
  • Date: 2008-09-05 03:11:40 UTC
  • mfrom: (3691 +trunk)
  • mto: (3697.7.4 1.7)
  • mto: This revision was merged to the branch mainline in revision 3748.
  • Revision ID: john@arbash-meinel.com-20080905031140-hj0adlcf30l7i99v
Merge in bzr.dev 3691

Show diffs side-by-side

added added

removed removed

Lines of Context:
379
379
        """Return RevisionTree for the current last revision.
380
380
        
381
381
        If the left most parent is a ghost then the returned tree will be an
382
 
        empty tree - one obtained by calling repository.revision_tree(None).
 
382
        empty tree - one obtained by calling 
 
383
        repository.revision_tree(NULL_REVISION).
383
384
        """
384
385
        try:
385
386
            revision_id = self.get_parent_ids()[0]
387
388
            # no parents, return an empty revision tree.
388
389
            # in the future this should return the tree for
389
390
            # 'empty:' - the implicit root empty tree.
390
 
            return self.branch.repository.revision_tree(None)
 
391
            return self.branch.repository.revision_tree(
 
392
                       _mod_revision.NULL_REVISION)
391
393
        try:
392
394
            return self.revision_tree(revision_id)
393
395
        except errors.NoSuchRevision:
404
406
            if self.branch.repository.has_revision(revision_id):
405
407
                raise
406
408
            # the basis tree is a ghost so return an empty tree.
407
 
            return self.branch.repository.revision_tree(None)
 
409
            return self.branch.repository.revision_tree(
 
410
                       _mod_revision.NULL_REVISION)
408
411
 
409
412
    def _cleanup(self):
410
413
        self._flush_ignore_list_cache()
520
523
            and this one merged in.
521
524
        """
522
525
        # assumes the target bzr dir format is compatible.
523
 
        result = self._format.initialize(to_bzrdir)
 
526
        result = to_bzrdir.create_workingtree()
524
527
        self.copy_content_into(result, revision_id)
525
528
        return result
526
529
 
1316
1319
                only_change_inv = True
1317
1320
            elif self.has_filename(from_rel) and not self.has_filename(to_rel):
1318
1321
                only_change_inv = False
1319
 
            elif (sys.platform == 'win32'
1320
 
                and from_rel.lower() == to_rel.lower()
1321
 
                and self.has_filename(from_rel)):
 
1322
            elif (not self.case_sensitive
 
1323
                  and from_rel.lower() == to_rel.lower()
 
1324
                  and self.has_filename(from_rel)):
1322
1325
                only_change_inv = False
1323
1326
            else:
1324
1327
                # something is wrong, so lets determine what exactly
1859
1862
            # Recurse directory and add all files
1860
1863
            # so we can check if they have changed.
1861
1864
            for parent_info, file_infos in\
1862
 
                osutils.walkdirs(self.abspath(directory),
1863
 
                    directory):
1864
 
                for relpath, basename, kind, lstat, abspath in file_infos:
 
1865
                self.walkdirs(directory):
 
1866
                for relpath, basename, kind, lstat, fileid, kind in file_infos:
1865
1867
                    # Is it versioned or ignored?
1866
1868
                    if self.path2id(relpath) or self.is_ignored(relpath):
1867
1869
                        # Add nested content for deletion.
1877
1879
            filename = self.relpath(abspath)
1878
1880
            if len(filename) > 0:
1879
1881
                new_files.add(filename)
1880
 
                if osutils.isdir(abspath):
1881
 
                    recurse_directory_to_add_files(filename)
 
1882
                recurse_directory_to_add_files(filename)
1882
1883
 
1883
1884
        files = list(new_files)
1884
1885
 
2418
2419
                relroot = ""
2419
2420
            # FIXME: stash the node in pending
2420
2421
            entry = inv[top_id]
2421
 
            for name, child in entry.sorted_children():
2422
 
                dirblock.append((relroot + name, name, child.kind, None,
2423
 
                    child.file_id, child.kind
2424
 
                    ))
 
2422
            if entry.kind == 'directory':
 
2423
                for name, child in entry.sorted_children():
 
2424
                    dirblock.append((relroot + name, name, child.kind, None,
 
2425
                        child.file_id, child.kind
 
2426
                        ))
2425
2427
            yield (currentdir[0], entry.file_id), dirblock
2426
2428
            # push the user specified dirs from dirblock
2427
2429
            for dir in reversed(dirblock):
2715
2717
        """See WorkingTreeFormat.get_format_description()."""
2716
2718
        return "Working tree format 2"
2717
2719
 
2718
 
    def _stub_initialize_remote(self, branch):
2719
 
        """As a special workaround create critical control files for a remote working tree.
2720
 
        
 
2720
    def _stub_initialize_on_transport(self, transport, file_mode):
 
2721
        """Workaround: create control files for a remote working tree.
 
2722
 
2721
2723
        This ensures that it can later be updated and dealt with locally,
2722
 
        since BzrDirFormat6 and BzrDirFormat5 cannot represent dirs with 
 
2724
        since BzrDirFormat6 and BzrDirFormat5 cannot represent dirs with
2723
2725
        no working tree.  (See bug #43064).
2724
2726
        """
2725
2727
        sio = StringIO()
2726
2728
        inv = Inventory()
2727
2729
        xml5.serializer_v5.write_inventory(inv, sio, working=True)
2728
2730
        sio.seek(0)
2729
 
        branch._transport.put_file('inventory', sio,
2730
 
            mode=branch.control_files._file_mode)
2731
 
        branch._transport.put_bytes('pending-merges', '',
2732
 
            mode=branch.control_files._file_mode)
2733
 
        
 
2731
        transport.put_file('inventory', sio, file_mode)
 
2732
        transport.put_bytes('pending-merges', '', file_mode)
2734
2733
 
2735
2734
    def initialize(self, a_bzrdir, revision_id=None, from_branch=None,
2736
2735
                   accelerator_tree=None, hardlink=False):