Пример #1
0
 def test_not_implicit(self):
     idmap = {"parent": ("parentfileid", "parentrev", None)}
     mapping = mapping_registry.get_default()()
     self.assertRaises(
         KeyError, idmap_reverse_lookup, idmap, mapping,
         mapping.generate_file_id(("someuuid", u"somebp", 42),
                                  u"parent/foo"))
Пример #2
0
    def test_checks_uuid(self):
        repos_url = self.make_svn_repository('d')

        dc = self.get_commit_editor(repos_url)
        dc.add_dir("bp")
        dc.close()

        mapping = mapping_registry.get_default()()
        ra = RemoteAccess(repos_url.encode("utf-8"),
                          auth=Auth([get_username_provider()]))
        revnum = ra.get_latest_revnum()
        revprops = {
            SVN_REVPROP_BZR_REPOS_UUID: "otheruuid",
            "svn:log": "bla",
            SVN_REVPROP_BZR_ROOT: "bp",
            SVN_REVPROP_BZR_MAPPING_VERSION: mapping.name,
            SVN_REVPROP_BZR_BASE_REVISION: "therealbaserevid"
        }
        dc = TestCommitEditor(ra.get_commit_editor(revprops), ra.url, revnum)
        dc.open_dir("bp").add_file("bp/la").modify()
        dc.close()

        repos = Repository.open(repos_url)

        revmeta1 = repos._revmeta_provider.get_revision(u"bp", 1)
        revmeta2 = repos._revmeta_provider.get_revision(u"bp", 2)

        self.assertEquals(
            mapping.revision_id_foreign_to_bzr((repos.uuid, "bp", 1)),
            revmeta2.get_lhs_parent_revid(mapping, revmeta1))
Пример #3
0
 def test_implicit(self):
     idmap = {
         "parent":
         ("parentfileid", "parentrev", ("someuuid", u"somebp", 42))
     }
     mapping = mapping_registry.get_default()()
     self.assertEquals(
         u"parent/foo",
         idmap_reverse_lookup(
             idmap, mapping,
             mapping.generate_file_id(("someuuid", u"somebp", 42),
                                      u"parent/foo")))
Пример #4
0
 def test_implicit(self):
     idmap = {
         "parent":
         ("parentfileid", "parentrev", ("someuuid", u"somebp", 42))
     }
     mapping = mapping_registry.get_default()()
     self.assertEquals(
         (mapping.generate_file_id(
             ("someuuid", u"somebp", 42), u"parent/foo"),
          mapping.revision_id_foreign_to_bzr(
              ("someuuid", u"somebp", 42)), ('someuuid', u'somebp', 42)),
         idmap_lookup(idmap.__getitem__, mapping, u"parent/foo"))
Пример #5
0
 def test_nonexistant(self):
     idmap = {}
     mapping = mapping_registry.get_default()()
     self.assertRaises(KeyError, idmap_reverse_lookup, idmap, mapping,
                       "myfileid")
Пример #6
0
 def test_simple(self):
     idmap = {"filename": ("myfileid", "myrev", None)}
     mapping = mapping_registry.get_default()()
     self.assertEquals("filename",
                       idmap_reverse_lookup(idmap, mapping, "myfileid"))
Пример #7
0
 def test_not_implicit_asserts(self):
     idmap = {"parent": ("parentfileid", "parentrev", None)}
     mapping = mapping_registry.get_default()()
     self.assertRaises(KeyError, idmap_lookup, idmap.__getitem__, mapping,
                       u"parent/foo")