~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/upgrade.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:
81
81
from bzrlib.xml4 import serializer_v4
82
82
from bzrlib.xml5 import serializer_v5
83
83
from bzrlib.trace import mutter, note, warning
84
 
from bzrlib.osutils import sha_strings, sha_string
 
84
from bzrlib.osutils import sha_strings, sha_string, pathjoin, abspath
85
85
 
86
86
 
87
87
class Convert(object):
108
108
            note('starting upgrade from format 5 to 6')
109
109
            self._convert_to_prefixed()
110
110
            self._open_branch()
111
 
        cache = hashcache.HashCache(os.path.abspath(self.base))
 
111
        cache = hashcache.HashCache(abspath(self.base))
112
112
        cache.clear()
113
113
        cache.write()
114
114
        note("finished")
118
118
        from bzrlib.store import hash_prefix
119
119
        for store_name in ["weaves", "revision-store"]:
120
120
            note("adding prefixes to %s" % store_name) 
121
 
            store_dir = os.path.join(self.base, ".bzr", store_name)
 
121
            store_dir = pathjoin(self.base, ".bzr", store_name)
122
122
            for filename in os.listdir(store_dir):
123
123
                if filename.endswith(".weave") or filename.endswith(".gz"):
124
124
                    file_id = os.path.splitext(filename)[0]
125
125
                else:
126
126
                    file_id = filename
127
 
                prefix_dir = os.path.join(store_dir, hash_prefix(file_id))
 
127
                prefix_dir = pathjoin(store_dir, hash_prefix(file_id))
128
128
                if not os.path.isdir(prefix_dir):
129
129
                    os.mkdir(prefix_dir)
130
 
                os.rename(os.path.join(store_dir, filename),
131
 
                          os.path.join(prefix_dir, filename))
 
130
                os.rename(pathjoin(store_dir, filename),
 
131
                          pathjoin(prefix_dir, filename))
132
132
        self._set_new_format(BZR_BRANCH_FORMAT_6)
133
133
 
134
134