/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: Canonical.com Patch Queue Manager
  • Date: 2006-06-08 06:38:32 UTC
  • mfrom: (1685.1.81 encoding)
  • Revision ID: pqm@pqm.ubuntu.com-20060608063832-74b46cf8fdd4567a
(jam,mbp,wvh) Lots of updates to unicode,url,and encoding support

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
from bzrlib.trace import mutter, note
100
100
from bzrlib.transport import get_transport
101
101
from bzrlib.transport.local import LocalTransport
 
102
import bzrlib.urlutils as urlutils
102
103
import bzrlib.ui
103
104
import bzrlib.xml5
104
105
 
279
280
        # if needed, or, when the cache sees a change, append it to the hash
280
281
        # cache file, and have the parser take the most recent entry for a
281
282
        # given path only.
282
 
        cache_filename = self.bzrdir.get_workingtree_transport(None).abspath('stat-cache')
 
283
        cache_filename = self.bzrdir.get_workingtree_transport(None).local_abspath('stat-cache')
283
284
        hc = self._hashcache = HashCache(basedir, cache_filename, self._control_files._file_mode)
284
285
        hc.read()
285
286
        # is this scan needed ? it makes things kinda slow.
349
350
        run into /.  If there isn't one, raises NotBranchError.
350
351
        TODO: give this a new exception.
351
352
        If there is one, it is returned, along with the unused portion of path.
 
353
 
 
354
        :return: The WorkingTree that contains 'path', and the rest of path
352
355
        """
353
356
        if path is None:
354
357
            path = os.getcwdu()
355
358
        control, relpath = bzrdir.BzrDir.open_containing(path)
 
359
 
356
360
        return control.open_workingtree(), relpath
357
361
 
358
362
    @staticmethod
1081
1085
        l = bzrlib.DEFAULT_IGNORE[:]
1082
1086
        if self.has_filename(bzrlib.IGNORE_FILENAME):
1083
1087
            f = self.get_file_byname(bzrlib.IGNORE_FILENAME)
1084
 
            l.extend([line.rstrip("\n\r") for line in f.readlines()])
 
1088
            l.extend([line.rstrip("\n\r").decode('utf-8') 
 
1089
                      for line in f.readlines()])
1085
1090
        self._ignorelist = l
1086
1091
        self._ignore_regex = self._combine_ignore_rules(l)
1087
1092
        return l
1235
1240
        return result
1236
1241
 
1237
1242
    @needs_write_lock
1238
 
    def remove(self, files, verbose=False):
 
1243
    def remove(self, files, verbose=False, to_file=None):
1239
1244
        """Remove nominated files from the working inventory..
1240
1245
 
1241
1246
        This does not remove their text.  This does not run on XXX on what? RBC
1270
1275
                    new_status = 'I'
1271
1276
                else:
1272
1277
                    new_status = '?'
1273
 
                show_status(new_status, inv[fid].kind, quotefn(f))
 
1278
                show_status(new_status, inv[fid].kind, quotefn(f), to_file=to_file)
1274
1279
            del inv[fid]
1275
1280
 
1276
1281
        self._write_inventory(inv)
1653
1658
                branch.unlock()
1654
1659
        revision = branch.last_revision()
1655
1660
        inv = Inventory() 
1656
 
        wt = WorkingTree(a_bzrdir.root_transport.base,
 
1661
        wt = WorkingTree(a_bzrdir.root_transport.local_abspath('.'),
1657
1662
                         branch,
1658
1663
                         inv,
1659
1664
                         _internal=True,
1681
1686
            raise NotImplementedError
1682
1687
        if not isinstance(a_bzrdir.transport, LocalTransport):
1683
1688
            raise errors.NotLocalUrl(a_bzrdir.transport.base)
1684
 
        return WorkingTree(a_bzrdir.root_transport.base,
 
1689
        return WorkingTree(a_bzrdir.root_transport.local_abspath('.'),
1685
1690
                           _internal=True,
1686
1691
                           _format=self,
1687
1692
                           _bzrdir=a_bzrdir)
1732
1737
        if revision_id is None:
1733
1738
            revision_id = branch.last_revision()
1734
1739
        inv = Inventory() 
1735
 
        wt = WorkingTree3(a_bzrdir.root_transport.base,
 
1740
        wt = WorkingTree3(a_bzrdir.root_transport.local_abspath('.'),
1736
1741
                         branch,
1737
1742
                         inv,
1738
1743
                         _internal=True,
1767
1772
        if not isinstance(a_bzrdir.transport, LocalTransport):
1768
1773
            raise errors.NotLocalUrl(a_bzrdir.transport.base)
1769
1774
        control_files = self._open_control_files(a_bzrdir)
1770
 
        return WorkingTree3(a_bzrdir.root_transport.base,
 
1775
        return WorkingTree3(a_bzrdir.root_transport.local_abspath('.'),
1771
1776
                           _internal=True,
1772
1777
                           _format=self,
1773
1778
                           _bzrdir=a_bzrdir,