Dulwich.io dulwich / master
Fix test, style error. Jelmer Vernooń≥ 9 hours ago
2 changed file(s) with 18 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
662662 if f is None:
663663 return []
664664 with f:
665 return f.splitlines()
665 return [l.strip() for l in f.readlines() if l.strip()]
666666
667667 def do_commit(self, message=None, committer=None,
668668 author=None, commit_timestamp=None,
699699
700700 def test_update_shallow(self):
701701 self._repo.update_shallow(None, None) # no op
702 self.assertEquals(set(), self._repo.get_shallow())
702 self.assertEqual(set(), self._repo.get_shallow())
703703 self._repo.update_shallow(
704704 [b'a90fa2d900a17e99b433217e988c4eb4a2e9a097'],
705705 None)
753753 self.assertTrue(stat.S_ISLNK(b_mode))
754754 self.assertEqual(b'a', r[b_id].data)
755755
756 def test_commit_merge_heads(self):
757 r = self._repo
758 with open('a', 'w') as f:
756 def test_commit_merge_heads_file(self):
757 tmp_dir = tempfile.mkdtemp()
758 self.addCleanup(shutil.rmtree, tmp_dir)
759 r = Repo.init(tmp_dir)
760 with open(os.path.join(r.path, 'a'), 'w') as f:
761 f.write('initial text')
762 c1 = r.do_commit(
763 b'initial commit',
764 committer=b'Test Committer <test@nodomain.com>',
765 author=b'Test Author <test@nodomain.com>',
766 commit_timestamp=12395, commit_timezone=0,
767 author_timestamp=12395, author_timezone=0)
768 with open(os.path.join(r.path, 'a'), 'w') as f:
759769 f.write('merged text')
760 with open('.git/MERGE_HEADS', 'w') as f:
761 f.write('c27a2d21dd136312d7fa9e8baabb82561a1727d0')
770 with open(os.path.join(r.path, '.git', 'MERGE_HEADS'), 'w') as f:
771 f.write('c27a2d21dd136312d7fa9e8baabb82561a1727d0\n')
762772 r.stage(['a'])
763773 commit_sha = r.do_commit(
764774 b'deleted a',
767777 commit_timestamp=12395, commit_timezone=0,
768778 author_timestamp=12395, author_timezone=0)
769779 self.assertEqual([
770 self._root_commit,
780 c1,
771781 b'c27a2d21dd136312d7fa9e8baabb82561a1727d0'],
772782 r[commit_sha].parents)
773 self.assertEqual([], list(r.open_index()))
774 tree = r[r[commit_sha].tree]
775 self.assertEqual([], list(tree.iteritems()))
776783
777784 def test_commit_deleted(self):
778785 r = self._repo