Beispiel #1
0
 def testInternF(self):
     data = 'CoolBobcatsBro'
     data_hash = self._intern_data(data)
     self.assertEqual(git_test_utils.git_hash_data(data.encode()),
                      data_hash)
     self.assertEqual(data,
                      self.repo.git('cat-file', 'blob', data_hash).stdout)
Beispiel #2
0
 def testTreeRecursive(self):
     tree = self.repo.run(self.gc.tree, 'master:some', recurse=True)
     file1 = self.COMMIT_A['some/files/file1']['data']
     file2 = self.COMMIT_D['some/files/file2']['data']
     file3 = self.COMMIT_A['some/files/file3']['data']
     other = self.COMMIT_A['some/other/file']['data']
     self.assertEquals(
         tree['files/file1'],
         ('100644', 'blob', git_test_utils.git_hash_data(file1)))
     self.assertEquals(
         tree['files/file2'],
         ('100755', 'blob', git_test_utils.git_hash_data(file2)))
     self.assertEquals(
         tree['files/file3'],
         ('100644', 'blob', git_test_utils.git_hash_data(file3)))
     self.assertEquals(
         tree['other/file'],
         ('100644', 'blob', git_test_utils.git_hash_data(other)))
 def testTreeRecursive(self):
   tree = self.repo.run(self.gc.tree, 'master:some', recurse=True)
   file1 = self.COMMIT_A['some/files/file1']['data']
   file2 = self.COMMIT_D['some/files/file2']['data']
   file3 = self.COMMIT_A['some/files/file3']['data']
   other = self.COMMIT_A['some/other/file']['data']
   self.assertEquals(
       tree['files/file1'],
       ('100644', 'blob', git_test_utils.git_hash_data(file1)))
   self.assertEquals(
       tree['files/file2'],
       ('100755', 'blob', git_test_utils.git_hash_data(file2)))
   self.assertEquals(
       tree['files/file3'],
       ('100644', 'blob', git_test_utils.git_hash_data(file3)))
   self.assertEquals(
       tree['other/file'],
       ('100644', 'blob', git_test_utils.git_hash_data(other)))
Beispiel #4
0
    def testTree(self):
        tree = self.repo.run(self.gc.tree, 'master:some/files')
        file1 = self.COMMIT_A['some/files/file1']['data']
        file2 = self.COMMIT_D['some/files/file2']['data']
        file3 = self.COMMIT_A['some/files/file3']['data']
        self.assertEquals(
            tree['file1'],
            ('100644', 'blob', git_test_utils.git_hash_data(file1)))
        self.assertEquals(
            tree['file2'],
            ('100755', 'blob', git_test_utils.git_hash_data(file2)))
        self.assertEquals(
            tree['file3'],
            ('100644', 'blob', git_test_utils.git_hash_data(file3)))

        tree = self.repo.run(self.gc.tree, 'master:some')
        self.assertEquals(len(tree), 2)
        # Don't check the tree hash because we're lazy :)
        self.assertEquals(tree['files'][:2], ('040000', 'tree'))

        tree = self.repo.run(self.gc.tree, 'master:wat')
        self.assertEqual(tree, None)
  def testTree(self):
    tree = self.repo.run(self.gc.tree, 'master:some/files')
    file1 = self.COMMIT_A['some/files/file1']['data']
    file2 = self.COMMIT_D['some/files/file2']['data']
    file3 = self.COMMIT_A['some/files/file3']['data']
    self.assertEquals(
        tree['file1'],
        ('100644', 'blob', git_test_utils.git_hash_data(file1)))
    self.assertEquals(
        tree['file2'],
        ('100755', 'blob', git_test_utils.git_hash_data(file2)))
    self.assertEquals(
        tree['file3'],
        ('100644', 'blob', git_test_utils.git_hash_data(file3)))

    tree = self.repo.run(self.gc.tree, 'master:some')
    self.assertEquals(len(tree), 2)
    # Don't check the tree hash because we're lazy :)
    self.assertEquals(tree['files'][:2], ('040000', 'tree'))

    tree = self.repo.run(self.gc.tree, 'master:wat')
    self.assertEqual(tree, None)
 def testInternF(self):
   data = 'CoolBobcatsBro'
   data_hash = self._intern_data(data)
   self.assertEquals(git_test_utils.git_hash_data(data), data_hash)
   self.assertEquals(data, self.repo.git('cat-file', 'blob', data_hash).stdout)