/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-13 12:34:24 UTC
  • mto: (0.200.912 trunk)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@samba.org-20100513123424-c1sk9vcg2ekrcsol
Some refactoring, support proper file ids in revision deltas.

Show diffs side-by-side

added added

removed removed

Lines of Context:
266
266
            metadata = BzrGitRevisionMetadata()
267
267
        else:
268
268
            metadata = None
 
269
        parents = []
269
270
        for p in rev.parent_ids:
270
271
            try:
271
272
                git_p = parent_lookup(p)
275
276
                    metadata.explicit_parent_ids = rev.parent_ids
276
277
            if git_p is not None:
277
278
                assert len(git_p) == 40, "unexpected length for %r" % git_p
278
 
                commit.parents.append(git_p)
 
279
                parents.append(git_p)
 
280
        commit.parents = parents
279
281
        try:
280
282
            encoding = rev.properties['git-explicit-encoding']
281
283
        except KeyError:
375
377
            rev.properties.update(md.properties)
376
378
        return rev
377
379
 
 
380
    def get_fileid_map(self, lookup_object, tree_sha):
 
381
        """Obtain a fileid map for a particular tree.
 
382
 
 
383
        :param lookup_object: Function for looking up an object
 
384
        :param tree_sha: SHA of the root tree
 
385
        :return: GitFileIdMap instance
 
386
        """
 
387
        try:
 
388
            file_id_map_sha = lookup_object(tree_sha)[self.BZR_FILE_IDS_FILE][1]
 
389
        except KeyError:
 
390
            file_ids = {}
 
391
        else:
 
392
            file_ids = self.import_fileid_map(lookup_object(file_id_map_sha))
 
393
        return GitFileIdMap(file_ids, self)
 
394
 
378
395
 
379
396
class BzrGitMappingv1(BzrGitMapping):
380
397
    revid_prefix = 'git-v1'