Mercurial > hgsubversion
diff tests/test_fetch_mappings.py @ 430:2851b81c65ce
maps: make sure AuthorMaps don't overwrite themselves, fix overriding
Author maps for the Python repo got truncated because of the author map stupidly
writing upon itself. This patch implements a better and faster scenario, where
entries will only be written to the saved author map if they're not coming from that
file. They're also now streamed into the file directly, instead of having to re-open
the file on every entry, and formatting is preserved.
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Mon, 15 Jun 2009 16:09:27 +0200 |
parents | 27e9fea5d114 |
children | 8e025a6f0db4 |
line wrap: on
line diff
--- a/tests/test_fetch_mappings.py +++ b/tests/test_fetch_mappings.py @@ -9,6 +9,8 @@ from mercurial import node import test_util +from hgsubversion import maps + class MapTests(test_util.TestBase): @property def authors(self): @@ -55,6 +57,18 @@ class MapTests(test_util.TestBase): def test_author_map_closing_author_stupid(self): self.test_author_map_closing_author(True) + def test_author_map_no_overwrite(self): + cwd = os.path.dirname(__file__) + orig = os.path.join(cwd, 'fixtures', 'author-map-test.txt') + new = open(self.authors, 'w') + new.write(open(orig).read()) + new.close() + test = maps.AuthorMap(ui.ui(), self.authors) + fromself = set(test) + test.load(orig) + all = set(test) + self.assertEqual(fromself.symmetric_difference(all), set()) + def test_file_map(self, stupid=False): test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump') filemap = open(self.filemap, 'w')