~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/upgrade.py

Merged mailine

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
 
 
86
 
 
87
# TODO: jam 20060108 Create a new branch format, and as part of upgrade
 
88
#       make sure that ancestry.weave is deleted (it is never used, but
 
89
#       used to be created)
85
90
 
86
91
 
87
92
class Convert(object):
108
113
            note('starting upgrade from format 5 to 6')
109
114
            self._convert_to_prefixed()
110
115
            self._open_branch()
111
 
        cache = hashcache.HashCache(os.path.abspath(self.base))
 
116
        cache = hashcache.HashCache(abspath(self.base))
112
117
        cache.clear()
113
118
        cache.write()
114
119
        note("finished")
118
123
        from bzrlib.store import hash_prefix
119
124
        for store_name in ["weaves", "revision-store"]:
120
125
            note("adding prefixes to %s" % store_name) 
121
 
            store_dir = os.path.join(self.base, ".bzr", store_name)
 
126
            store_dir = pathjoin(self.base, ".bzr", store_name)
122
127
            for filename in os.listdir(store_dir):
123
128
                if filename.endswith(".weave") or filename.endswith(".gz"):
124
129
                    file_id = os.path.splitext(filename)[0]
125
130
                else:
126
131
                    file_id = filename
127
 
                prefix_dir = os.path.join(store_dir, hash_prefix(file_id))
 
132
                prefix_dir = pathjoin(store_dir, hash_prefix(file_id))
128
133
                if not os.path.isdir(prefix_dir):
129
134
                    os.mkdir(prefix_dir)
130
 
                os.rename(os.path.join(store_dir, filename),
131
 
                          os.path.join(prefix_dir, filename))
 
135
                os.rename(pathjoin(store_dir, filename),
 
136
                          pathjoin(prefix_dir, filename))
132
137
        self._set_new_format(BZR_BRANCH_FORMAT_6)
133
138
 
134
139