~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Robert Collins
  • Date: 2006-01-02 22:37:32 UTC
  • mfrom: (1185.50.33 bzr-jam-integration)
  • Revision ID: robertc@robertcollins.net-20060102223732-d5221b37ff0f7888
Merge in John Meinels integration branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
                            compact_date,
64
64
                            file_kind,
65
65
                            isdir,
 
66
                            getcwd,
 
67
                            pathjoin,
66
68
                            pumpfile,
67
69
                            splitpath,
68
70
                            rand_bytes,
 
71
                            abspath,
 
72
                            normpath,
69
73
                            realpath,
70
74
                            relpath,
71
75
                            rename)
225
229
        If there is one, it is returned, along with the unused portion of path.
226
230
        """
227
231
        if path is None:
228
 
            path = os.getcwdu()
 
232
            path = getcwd()
229
233
        else:
230
234
            # sanity check.
231
235
            if path.find('://') != -1:
232
236
                raise NotBranchError(path=path)
233
 
        path = os.path.abspath(path)
 
237
        path = abspath(path)
234
238
        tail = u''
235
239
        while True:
236
240
            try:
238
242
            except NotBranchError:
239
243
                pass
240
244
            if tail:
241
 
                tail = os.path.join(os.path.basename(path), tail)
 
245
                tail = pathjoin(os.path.basename(path), tail)
242
246
            else:
243
247
                tail = os.path.basename(path)
 
248
            lastpath = path
244
249
            path = os.path.dirname(path)
245
 
            # FIXME: top in windows is indicated how ???
246
 
            if path == os.path.sep:
 
250
            if lastpath == path:
247
251
                # reached the root, whatever that may be
248
252
                raise NotBranchError(path=path)
249
253
 
263
267
                               getattr(self, 'basedir', None))
264
268
 
265
269
    def abspath(self, filename):
266
 
        return os.path.join(self.basedir, filename)
 
270
        return pathjoin(self.basedir, filename)
267
271
 
268
 
    def relpath(self, abspath):
 
272
    def relpath(self, abs):
269
273
        """Return the local path portion from a given absolute path."""
270
 
        return relpath(self.basedir, abspath)
 
274
        return relpath(self.basedir, abs)
271
275
 
272
276
    def has_filename(self, filename):
273
277
        return bzrlib.osutils.lexists(self.abspath(filename))
372
376
            if len(fp) == 0:
373
377
                raise BzrError("cannot add top-level %r" % f)
374
378
 
375
 
            fullpath = os.path.normpath(self.abspath(f))
 
379
            fullpath = normpath(self.abspath(f))
376
380
 
377
381
            try:
378
382
                kind = file_kind(fullpath)