Esempio n. 1
0
 def createWorkdir(self, repoUrl, tree = {}, offset = u"", revision = None):
     wdroot = self.createTmpName()
     write_tree(wdroot, tree)
     wd = workdir.Workdir(repoUrl, u"TestSession", offset, revision, wdroot)
     wd.setLogOutput(DevNull())
     wd.use_progress_printer(False)
     self.assertTrue(wd.get_front().find_last_revision(u"TestSession"))
     return wd
Esempio n. 2
0
 def createWorkdir(self, repoUrl, tree={}, offset=u"", revision=None):
     wdroot = self.createTmpName()
     write_tree(wdroot, tree)
     wd = workdir.Workdir(repoUrl, u"TestSession", offset, revision, wdroot)
     wd.setLogOutput(DevNull())
     wd.use_progress_printer(False)
     self.assertTrue(wd.get_front().find_last_revision(u"TestSession"))
     return wd
Esempio n. 3
0
 def testWriteAndReadTree(self):
     """ Really only test helper functions write_tree() and
     read_tree() themselves"""
     tree = {"tjosan.txt": b"tjosan content",
             "subdir/nisse.txt": b"nisse content"}
     testdir = self.createTmpName()
     write_tree(testdir, tree)
     tree2 = read_tree(testdir)
     self.assertEqual(tree, tree2)
Esempio n. 4
0
 def testWriteAndReadTree(self):
     """ Really only test helper functions write_tree() and
     read_tree() themselves"""
     tree = {"tjosan.txt": "tjosan content",
             "subdir/nisse.txt": "nisse content"}
     testdir = self.createTmpName()
     write_tree(testdir, tree)
     tree2 = read_tree(testdir)
     self.assertEqual(tree, tree2)
Esempio n. 5
0
 def testFastModifications(self):
     """Verify that the checksum cache is not confused by more than
     one change per second"""
     wd = self.createWorkdir(self.repoUrl)
     wd.checkin()
     for n in range(0, 10):
         write_tree(wd.root, {'file.txt': 'content 1'}, False, overwrite=True)
         self.assertEqual(wd.cached_md5sum(u"file.txt"), "9297ab3fbd56b42f6566284119238125")
         write_tree(wd.root, {'file.txt': 'content 2'}, False, overwrite=True)
         self.assertEqual(wd.cached_md5sum(u"file.txt"), "6685cd62b95f2c58818cb20e7292168b")
Esempio n. 6
0
 def testFastModifications(self):
     """Verify that the checksum cache is not confused by more than
     one change per second"""
     wd = self.createWorkdir(self.repoUrl)
     wd.checkin()
     for n in range(0, 10):
         write_tree(wd.root, {'file.txt': 'content 1'}, False, overwrite=True)
         self.assertEqual(wd.cached_md5sum(u"file.txt"), "9297ab3fbd56b42f6566284119238125")
         write_tree(wd.root, {'file.txt': 'content 2'}, False, overwrite=True)
         self.assertEqual(wd.cached_md5sum(u"file.txt"), "6685cd62b95f2c58818cb20e7292168b")
Esempio n. 7
0
 def testExistingFileTwice(self):
     """Test derived sha256 checksum. It is only returned from the
     derived storage at the third checkin (at the first, it is
     never requested since there is no file with that md5 in the
     repo. At the second, it is generated and returned. At the
     third, it is not generated, only loaded from storage."""
     wd = self.createWorkdir(self.repoUrl, {'file1.txt': "data"})
     wd.checkin()
     write_tree(wd.root, {'subdir/file2.txt': "data"}, False)
     wd.checkin()
     write_tree(wd.root, {'subdir/file3.txt': "data"}, False)
     wd.checkin()
Esempio n. 8
0
 def testExistingFileTwice(self):
     """Test derived sha256 checksum. It is only returned from the
     derived storage at the third checkin (at the first, it is
     never requested since there is no file with that md5 in the
     repo. At the second, it is generated and returned. At the
     third, it is not generated, only loaded from storage."""
     wd = self.createWorkdir(self.repoUrl,
                             {'file1.txt': "data"})
     wd.checkin()
     write_tree(wd.root, {'subdir/file2.txt': "data"}, False)
     wd.checkin()
     write_tree(wd.root, {'subdir/file3.txt': "data"}, False)
     wd.checkin()
Esempio n. 9
0
 def testOffsetCheckin(self):
     tree1 = {'file.txt': 'fc1',
              'subdir1/subdirfile1.txt': 'fc2'}
     wd = self.createWorkdir(self.repoUrl, tree1)
     wd.checkin()
     wd = self.createWorkdir(self.repoUrl, offset = u"subdir1")
     wd.checkout()
     subtree = read_tree(wd.root, skiplist = boar_dirs)
     write_tree(wd.root, {'newfile.txt': 'nf'}, create_root = False)
     wd.checkin()
     wd = self.createWorkdir(self.repoUrl, offset = u"subdir1")
     wd.checkout()
     subtree = read_tree(wd.root, skiplist = boar_dirs)
     self.assertEqual(subtree, {'subdirfile1.txt': b'fc2',
                                'newfile.txt': b'nf'})
Esempio n. 10
0
 def testOffsetCheckin(self):
     tree1 = {'file.txt': 'fc1',
              'subdir1/subdirfile1.txt': 'fc2'}
     wd = self.createWorkdir(self.repoUrl, tree1)
     wd.checkin()
     wd = self.createWorkdir(self.repoUrl, offset = u"subdir1")
     wd.checkout()
     subtree = read_tree(wd.root, skiplist = boar_dirs)
     write_tree(wd.root, {'newfile.txt': 'nf'}, create_root = False)
     wd.checkin()
     wd = self.createWorkdir(self.repoUrl, offset = u"subdir1")
     wd.checkout()
     subtree = read_tree(wd.root, skiplist = boar_dirs)
     self.assertEqual(subtree, {'subdirfile1.txt': 'fc2',
                                'newfile.txt': 'nf'})
Esempio n. 11
0
    def testIncludeModifications(self):
        """Expected behavior is that modifications of previously
        committed (but now ignored) files should be ignored. But they
        should still be checked out if they exist."""
        tree = {'file.txt': b'f1',
                'file.ignore': b'f2',
                'file-modified.ignore': b'f3'}
        wd = self.createWorkdir(self.repoUrl, tree)
        wd.checkin()

        wd.front.set_session_include_list(u"TestSession", ["*.txt"])
        wd.update_to_latest()
        write_tree(wd.root, {'file-modified.ignore': 'f3 mod'}, False, overwrite=True)
        wd.checkin()

        wd = self.createWorkdir(self.repoUrl)
        wd.checkout()
        co_tree = read_tree(wd.root, skiplist = boar_dirs)
        self.assertEqual(tree, co_tree)
Esempio n. 12
0
    def testIncludeModifications(self):
        """Expected behavior is that modifications of previously
        committed (but now ignored) files should be ignored. But they
        should still be checked out if they exist."""
        tree = {'file.txt': 'f1',
                'file.ignore': 'f2',
                'file-modified.ignore': 'f3'}
        wd = self.createWorkdir(self.repoUrl, tree)
        wd.checkin()

        wd.front.set_session_include_list(u"TestSession", ["*.txt"])
        wd.update_to_latest()
        write_tree(wd.root, {'file-modified.ignore': 'f3 mod'}, False, overwrite=True)
        wd.checkin()

        wd = self.createWorkdir(self.repoUrl)
        wd.checkout()
        co_tree = read_tree(wd.root, skiplist = boar_dirs)
        self.assertEquals(tree, co_tree)