~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: John Arbash Meinel
  • Date: 2007-06-07 22:31:44 UTC
  • mfrom: (2517 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2518.
  • Revision ID: john@arbash-meinel.com-20070607223144-u4oljlajcvq6by2n
[merge] bzr.dev 2517

Show diffs side-by-side

added added

removed removed

Lines of Context:
1775
1775
        if isinstance(files, basestring):
1776
1776
            files = [files]
1777
1777
 
1778
 
        inv = self.inventory
 
1778
        inv_delta = []
1779
1779
 
1780
1780
        new_files=set()
1781
1781
        unknown_files_in_directory=set()
1783
1783
        def recurse_directory_to_add_files(directory):
1784
1784
            # recurse directory and add all files
1785
1785
            # so we can check if they have changed.
1786
 
            for contained_dir_info in self.walkdirs(directory):
1787
 
                for file_info in contained_dir_info[1]:
1788
 
                    if file_info[2] == 'file':
1789
 
                        relpath = self.relpath(file_info[0])
1790
 
                        if file_info[4]: #is it versioned?
 
1786
            for parent_info, file_infos in\
 
1787
                osutils.walkdirs(self.abspath(directory),
 
1788
                    directory):
 
1789
                for relpath, basename, kind, lstat, abspath in file_infos:
 
1790
                    if kind == 'file':
 
1791
                        if self.path2id(relpath): #is it versioned?
1791
1792
                            new_files.add(relpath)
1792
1793
                        else:
1793
1794
                            unknown_files_in_directory.add(
1794
 
                                (relpath, None, file_info[2]))
 
1795
                                (relpath, None, kind))
1795
1796
 
1796
1797
        for filename in files:
1797
1798
            # Get file name into canonical form.
1798
 
            filename = self.relpath(self.abspath(filename))
 
1799
            abspath = self.abspath(filename)
 
1800
            filename = self.relpath(abspath)
1799
1801
            if len(filename) > 0:
1800
1802
                new_files.add(filename)
1801
 
                if osutils.isdir(filename) and len(os.listdir(filename)) > 0:
 
1803
                if osutils.isdir(abspath):
1802
1804
                    recurse_directory_to_add_files(filename)
1803
1805
        files = [f for f in new_files]
1804
1806
 
1818
1820
 
1819
1821
        # do this before any modifications
1820
1822
        for f in files:
1821
 
            fid = inv.path2id(f)
 
1823
            fid = self.path2id(f)
1822
1824
            message=None
1823
1825
            if not fid:
1824
1826
                message="%s is not versioned." % (f,)
1829
1831
                        new_status = 'I'
1830
1832
                    else:
1831
1833
                        new_status = '?'
1832
 
                    textui.show_status(new_status, inv[fid].kind, f,
 
1834
                    textui.show_status(new_status, self.kind(fid), f,
1833
1835
                                       to_file=to_file)
1834
1836
                # unversion file
1835
 
                del inv[fid]
 
1837
                inv_delta.append((f, None, fid, None))
1836
1838
                message="removed %s" % (f,)
1837
1839
 
1838
1840
            if not keep_files:
1852
1854
            # print only one message (if any) per file.
1853
1855
            if message is not None:
1854
1856
                note(message)
1855
 
        self._write_inventory(inv)
 
1857
        self.apply_inventory_delta(inv_delta)
1856
1858
 
1857
1859
    @needs_tree_write_lock
1858
1860
    def revert(self, filenames, old_tree=None, backups=True,