/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 mapping.py

mention the requirement to install Dulwich.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Converters, etc for going between Bazaar and Git ids."""
18
18
 
19
 
from bzrlib import errors, foreign, urlutils
 
19
from bzrlib import errors, foreign
20
20
from bzrlib.inventory import ROOT_ID
21
21
from bzrlib.foreign import (
22
22
        ForeignVcs, 
131
131
 
132
132
    inv = repo.get_inventory(revision_id)
133
133
 
134
 
    # stack contains the set of trees that we haven't 
135
 
    # finished constructing
136
 
 
137
134
    for path, entry in inv.iter_entries():
138
135
        while stack and not path.startswith(cur):
139
136
            tree.serialize()
140
137
            sha = tree.sha().hexdigest()
141
 
            yield sha, tree, cur
142
 
            t = (stat.S_IFDIR, urlutils.basename(cur).encode('UTF-8'), sha)
 
138
            yield sha, tree, path
 
139
            t = (stat.S_IFDIR, splitpath(cur)[-1:][0].encode('UTF-8'), sha)
143
140
            cur, tree = stack.pop()
144
141
            tree.add(*t)
145
142
 
152
149
            #FIXME: We can make potentially make this Lazy to avoid shaing lots of stuff
153
150
            # and having all these objects in memory at once
154
151
            blob = Blob()
155
 
            _, blob._text = repo.iter_files_bytes([(entry.file_id, entry.revision, path)]).next()
 
152
            _, blob._text = repo.iter_files_bytes([(entry.file_id, revision_id, path)]).next()
156
153
            sha = blob.sha().hexdigest()
157
154
            yield sha, blob, path
158
155
 
159
 
            name = urlutils.basename(path).encode("utf-8")
 
156
            name = splitpath(path)[-1:][0].encode('UTF-8')
160
157
            mode = stat.S_IFREG | 0644
161
158
            if entry.executable:
162
159
                mode |= 0111
165
162
    while len(stack) > 1:
166
163
        tree.serialize()
167
164
        sha = tree.sha().hexdigest()
168
 
        yield sha, tree, cur
169
 
        t = (stat.S_IFDIR, urlutils.basename(cur).encode('UTF-8'), sha)
 
165
        yield sha, tree, path
 
166
        t = (stat.S_IFDIR, splitpath(cur)[-1:][0].encode('UTF-8'), sha)
170
167
        cur, tree = stack.pop()
171
168
        tree.add(*t)
172
169
 
173
170
    tree.serialize()
174
 
    yield tree.sha().hexdigest(), tree, cur
 
171
    yield tree.sha().hexdigest(), tree, path
175
172
 
176
173
 
177
174
def revision_to_commit(rev, tree_sha, parent_lookup):