~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

[merge] win32

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
import bzrlib.inventory as inventory
28
28
from bzrlib.trace import mutter, note
29
29
from bzrlib.osutils import (isdir, quotefn,
30
 
                            rename, splitpath, sha_file, appendpath, 
31
 
                            file_kind, abspath)
 
30
                            rename, splitpath, sha_file,
 
31
                            file_kind, abspath, normpath, pathjoin)
32
32
import bzrlib.errors as errors
33
33
from bzrlib.errors import (BzrError, InvalidRevisionNumber, InvalidRevisionId,
34
34
                           NoSuchRevision, HistoryMissing, NotBranchError,
133
133
        while True:
134
134
            try:
135
135
                return BzrBranch(t), t.relpath(url)
136
 
            except NotBranchError:
137
 
                pass
 
136
            except NotBranchError, e:
 
137
                mutter('not a branch in: %r %s', t.base, e)
138
138
            new_t = t.clone('..')
139
139
            if new_t.base == t.base:
140
140
                # reached the root, whatever that may be
568
568
            # or entirely uncompressed is tidy, but breaks upgrade from 
569
569
            # some existing branches where there's a mixture; we probably 
570
570
            # still want the option to look for both.
571
 
            relpath = self._rel_controlfilename(name)
 
571
            relpath = self._rel_controlfilename(unicode(name))
572
572
            store = TextStore(self._transport.clone(relpath),
573
573
                              prefixed=prefixed,
574
574
                              compressed=compressed)
575
575
            #if self._transport.should_cache():
576
 
            #    cache_path = os.path.join(self.cache_root, name)
 
576
            #    cache_path = pathjoin(self.cache_root, name)
577
577
            #    os.mkdir(cache_path)
578
578
            #    store = bzrlib.store.CachedStore(store, cache_path)
579
579
            return store
 
580
 
580
581
        def get_weave(name, prefixed=False):
581
 
            relpath = self._rel_controlfilename(name)
 
582
            relpath = self._rel_controlfilename(unicode(name))
582
583
            ws = WeaveStore(self._transport.clone(relpath), prefixed=prefixed)
583
584
            if self._transport.should_cache():
584
585
                ws.enable_cache = True
585
586
            return ws
586
587
 
587
588
        if self._branch_format == 4:
588
 
            self.inventory_store = get_store(u'inventory-store')
589
 
            self.text_store = get_store(u'text-store')
590
 
            self.revision_store = get_store(u'revision-store')
 
589
            self.inventory_store = get_store('inventory-store')
 
590
            self.text_store = get_store('text-store')
 
591
            self.revision_store = get_store('revision-store')
591
592
        elif self._branch_format == 5:
592
593
            self.control_weaves = get_weave(u'')
593
594
            self.weave_store = get_weave(u'weaves')
1133
1134
        ...   orig.base == clone.base
1134
1135
        ...
1135
1136
        False
1136
 
        >>> os.path.isfile(os.path.join(clone.base, "file1"))
 
1137
        >>> os.path.isfile(pathjoin(clone.base, "file1"))
1137
1138
        True
1138
1139
        """
1139
1140
        from shutil import copytree
1140
 
        from tempfile import mkdtemp
 
1141
        from bzrlib.osutils import mkdtemp
1141
1142
        base = mkdtemp()
1142
1143
        os.rmdir(base)
1143
1144
        copytree(self.base, base, symlinks=True)
1151
1152
 
1152
1153
def is_control_file(filename):
1153
1154
    ## FIXME: better check
1154
 
    filename = os.path.normpath(filename)
 
1155
    filename = normpath(filename)
1155
1156
    while filename != '':
1156
1157
        head, tail = os.path.split(filename)
1157
1158
        ## mutter('check %r for control file' % ((head, tail), ))