From: zuber Date: Fri, 27 Nov 2009 10:46:22 +0000 (+0100) Subject: Dodanie większej ilości testów i usunięcie zbędnego kodu. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/f24caa48eedfb9d4f7218892bc7070316ac553f2?hp=3bcc03862b46d25ec0c81cfa49c0d1596ba0c271 Dodanie większej ilości testów i usunięcie zbędnego kodu. --- diff --git a/lib/tests/test_vstorage.py b/lib/tests/test_vstorage.py index bcaf9162..0d87f0a8 100644 --- a/lib/tests/test_vstorage.py +++ b/lib/tests/test_vstorage.py @@ -55,7 +55,7 @@ class TestMercurialStorage(object): self.repo.save_text(title, text, author, comment, parent=-1) saved = self.repo.open_page(title).read() assert saved == text - + def test_save_merge_line_conflict(self): text = u"test\ntest\n" text1 = u"test\ntext\n" @@ -91,4 +91,10 @@ text def test_document_not_found(self): self.repo.open_page(u'unknown entity') + def test_open_existing_repository(self): + self.repo.save_text(u'Python!', u'ham and spam') + current_repo_revision = self.repo.repo_revision() + same_repo = vstorage.VersionedStorage(self.repo_path) + assert same_repo.repo_revision() == current_repo_revision + diff --git a/lib/vstorage/__init__.py b/lib/vstorage/__init__.py index 88005da3..e1db0c13 100644 --- a/lib/vstorage/__init__.py +++ b/lib/vstorage/__init__.py @@ -5,8 +5,6 @@ import datetime import mimetypes import urllib -import sys - # Note: we have to set these before importing Mercurial os.environ['HGENCODING'] = 'utf-8' os.environ['HGMERGE'] = "internal:merge" @@ -137,11 +135,8 @@ class VersionedStorage(object): if p1 == p2: return text - try: - unresolved = mercurial.merge.update(self.repo, tip_node, True, False, partial) - except mercurial.util.Abort: - raise - unresolved = 1, 1, 1, 1 + # TODO: Check if merge was successful + mercurial.merge.update(self.repo, tip_node, True, False, partial) self.repo.dirstate.setparents(tip_node, node) # Mercurial 1.1 and later need updating the merge state