Example #1
0
 def test_content_from_index_read_without_git_add(self):
     ctx = FileCtx(self.repo, self.changectx, self.file_name, True)
     self.assertEqual(ctx.content, 'test\n')
     with codecs.open(self.file_path, 'a', encoding='utf-8') as fp:
         fp.write('lol\n')  # change file without git add
     ctx = FileCtx(self.repo, self.changectx, self.file_name, True)
     self.assertEqual(ctx.content, 'test\nlol\n')
Example #2
0
 def test_date_and_mdate(self):
     ctx = FileCtx(self.repo, self.changectx, self.file_name)
     time.sleep(1)
     self.assertTrue(ctx.date < time.time())
     self.assertTrue(ctx.mdate is None)
     old_date = ctx.date
     time.sleep(1)
     with codecs.open(self.file_path, 'a', encoding='utf-8') as fp:
         fp.write('foo\n')
     git_commit(self.repo, self.tree, [self.file_name], [self.last_commit])
     ctx = FileCtx(self.repo, self.changectx, self.file_name)
     self.assertEqual(ctx.date, old_date)
     self.assertTrue(ctx.mdate > old_date)
Example #3
0
 def get_filectx(self, path):
     return FileCtx(self._repo, self._ctx, path)
Example #4
0
 def get_filectx(self, path):
     return FileCtx(self._repo, self._ctx, path, use_index=True)
Example #5
0
 def test_author(self):
     ctx = FileCtx(self.repo, self.changectx, self.file_name)
     self.assertEqual(ctx.author, 'foo <*****@*****.**>')
Example #6
0
 def test_path(self):
     ctx = FileCtx(self.repo, self.changectx, self.file_name)
     self.assertEqual(ctx.path, 'foo.rst')