/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

  • Committer: Jelmer Vernooij
  • Date: 2010-05-02 19:26:28 UTC
  • mto: (0.200.912 trunk)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@samba.org-20100502192628-dy0lavjbjexavvmb
More work on roundtripping support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
    extract_bzr_metadata,
50
50
    inject_bzr_metadata,
51
51
    BzrGitRevisionMetadata,
 
52
    deserialize_fileid_map,
 
53
    serialize_fileid_map,
52
54
    )
53
55
 
54
56
DEFAULT_FILE_MODE = stat.S_IFREG | 0644
119
121
    """Class that maps between Git and Bazaar semantics."""
120
122
    experimental = False
121
123
 
 
124
    BZR_FILE_IDS_FILE = '.bzrfileids'
 
125
 
122
126
    def __init__(self):
123
127
        super(BzrGitMapping, self).__init__(foreign_git)
124
128
 
233
237
        :param fileid_map: File id map, mapping paths to file ids
234
238
        :return: A Git blob object
235
239
        """
236
 
        raise NotImplementedError(self.export_fileid_map)
 
240
        from dulwich.objects import Blob
 
241
        b = Blob()
 
242
        b.set_raw_chunks(serialize_fileid_map(fileid_map))
 
243
        return b
237
244
 
238
245
    def export_commit(self, rev, tree_sha, parent_lookup, roundtrip):
239
246
        """Turn a Bazaar revision in to a Git commit
304
311
        :param blob: Git blob object with fileid map
305
312
        :return: Dictionary mapping paths to file ids
306
313
        """
307
 
        raise NotImplementedError(self.import_fileid_map)
 
314
        return deserialize_fileid_map(blob.text)
308
315
 
309
316
    def import_commit(self, commit):
310
317
        """Convert a git commit to a bzr revision.