Exemplo n.º 1
0
 def test_connect_local_repository(self, mock_tempfile, mock_hg):
     mock_tempfile.mkdtemp.return_value = 'destination'
     repository = hg.open_repository(self.repository_path)
     repository.cleanup = False
     mock.call.clone.assert_called_with(source=self.repository_path,
                                        dest="destination"),
     self.assertTrue(mock.call.clone.open.called)
Exemplo n.º 2
0
 def test_connect_remote_repository(self, mock_tempfile, mock_hg):
     mock_tempfile.mkdtemp.return_value = 'destination'
     repository = hg.open_repository(
         "https://www.mercurial-scm.org/repo/hello")
     repository.cleanup = False
     mock.call.clone.assert_called_with(
         source="https://www.mercurial-scm.org/repo/hello",
         dest="destination"),
     self.assertTrue(mock.call.clone.open.called)
Exemplo n.º 3
0
 def test_get_remove_change(self):
     sut = hg.open_repository(self.repository_path)
     changeset = sut.get_changeset('4').changes
     self.assertEqual(changeset[0].action, change.ChangeType.remove)
Exemplo n.º 4
0
 def test_get_rename_change(self):
     sut = hg.open_repository(self.repository_path)
     changeset = sut.get_changeset('3')
     changeset.optimize()
     self.assertEqual(changeset.changes[0].action, change.ChangeType.move)
Exemplo n.º 5
0
 def test_get_changeset(self):
     sut = hg.open_repository(self.repository_path)
     changeset = sut.get_changeset('0')
     self.assertEqual(changeset.changes, [
         change.Change(sut, None, None, "a.txt", '0', change.ChangeType.add)
     ])
Exemplo n.º 6
0
 def test_get_object_at_revision(self):
     sut = hg.open_repository(self.repository_path)
     file_object = sut.get_file_contents("a.txt", revision=0)
     self.assertEqual(file_object.read(), b"a")
Exemplo n.º 7
0
 def test_get_object_at_tip(self):
     sut = hg.open_repository(self.repository_path)
     file_object = sut.get_file_contents("b.txt")
     self.assertEqual(file_object.read(), b"b")
Exemplo n.º 8
0
 def test_walk_history(self):
     sut = hg.open_repository(self.repository_path)
     self.assertEqual(len([x for x in sut.walk_history()]), 6)