コード例 #1
0
    def _unpack_changesets(self, chunkiter, mapping, pb, limit=None):
        def lookup_foreign_revid(foreign_revid):
            lookup_foreign_revid = getattr(self.source,
                                           "lookup_foreign_revision_id", None)
            if lookup_foreign_revid is not None:
                return lookup_foreign_revid(foreign_revid, mapping)
            return mapping.revision_id_foreign_to_bzr(foreign_revid)

        def get_hg_revision(hgid):
            revid = lookup_foreign_revid(hgid)
            return self._target_overlay.get_changeset_text_by_revid(revid)

        for i, (fulltext, hgkey, hgparents, csid) in enumerate(
                unpack_chunk_iter(chunkiter, get_hg_revision)):
            pb.update("fetching changesets", i)
            if limit is not None and i >= limit:
                continue
            (manifest, user, (time, timezone), files, desc, extra) = \
                parse_changeset(fulltext)
            key = mapping.revision_id_foreign_to_bzr(hgkey)
            parent_ids = as_bzr_parents(hgparents, lookup_foreign_revid)
            rev, fileids = mapping.import_revision(key, parent_ids, hgkey,
                                                   manifest, user,
                                                   (time, timezone), desc,
                                                   extra)
            self._files[rev.revision_id] = files
            self._manifest2rev_map[manifest].add(rev.revision_id)
            self._revisions[rev.revision_id] = rev
コード例 #2
0
ファイル: test_parsers.py プロジェクト: jelmer/breezy-hg
    def test_invalid_timezone(self):
        self.assertEquals(
            (mercurial.node.nullid, "Jelmer Vernooij <*****@*****.**>",
             (1253260798.0, 0), ["myfile"], "Some\ncommit\nmessage", {}),
            parse_changeset("""0000000000000000000000000000000000000000
Jelmer Vernooij <*****@*****.**>
1253260798 bla
myfile

Some
commit
message"""))
コード例 #3
0
ファイル: test_parsers.py プロジェクト: jelmer/breezy-hg
    def test_simple(self):
        self.assertEquals(
            (mercurial.node.nullid, u"Jelmer Vernooij <*****@*****.**>",
             (1253260798.0, -7200), ["myfile"], u"Some\ncommit\nmessage", {}),
            parse_changeset("""0000000000000000000000000000000000000000
Jelmer Vernooij <*****@*****.**>
1253260798 -7200
myfile

Some
commit
message"""))
コード例 #4
0
ファイル: test_parsers.py プロジェクト: breezy-team/breezy-hg
    def test_extra(self):
        self.assertEquals(
            (mercurial.node.nullid, u"Jelmer Vernooij <*****@*****.**>",
             (1253260798.0, -7200), ["myfile"], u"Some\ncommit\nmessage", {
                 "date": "extra"
             }),
            parse_changeset("""0000000000000000000000000000000000000000
Jelmer Vernooij <*****@*****.**>
1253260798 -7200 date:extra
myfile

Some
commit
message"""))