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

  • Committer: Jelmer Vernooij
  • Date: 2019-03-02 22:31:28 UTC
  • mfrom: (7291 work)
  • mto: This revision was merged to the branch mainline in revision 7293.
  • Revision ID: jelmer@jelmer.uk-20190302223128-0qk1i5tozmzq5nyq
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
    )
38
38
from ..revision import (
39
39
    NULL_REVISION,
 
40
    Revision,
40
41
    )
41
42
from ..sixish import (
42
43
    PY3,
377
378
        """
378
379
        return deserialize_fileid_map(blob.data)
379
380
 
 
381
    def get_revision_id(self, commit):
 
382
        if commit.encoding:
 
383
            encoding = commit.encoding.decode('ascii')
 
384
        else:
 
385
            encoding = 'utf-8'
 
386
        message, metadata = self._decode_commit_message(
 
387
            None, commit.message, encoding)
 
388
        if metadata.revision_id:
 
389
            return metadata.revision_id
 
390
        return self.revision_id_foreign_to_bzr(commit.id)
 
391
 
380
392
    def import_commit(self, commit, lookup_parent_revid):
381
393
        """Convert a git commit to a bzr revision.
382
394
 
499
511
    BZR_DUMMY_FILE = '.bzrdummy'
500
512
 
501
513
    def _decode_commit_message(self, rev, message, encoding):
 
514
        if rev is None:
 
515
            rev = Revision()
502
516
        message = self._extract_hg_metadata(rev, message)
503
517
        message = self._extract_git_svn_metadata(rev, message)
504
518
        message, metadata = self._extract_bzr_metadata(rev, message)