Mercurial > hgsubversion
changeset 1489:9a6bb3657861
Merge with stable.
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Sun, 26 Jun 2016 21:10:36 -0400 |
parents | 797c7b58a735 (current diff) 8d8fc10d0d0a (diff) |
children | bc73b80baf98 |
files | hgsubversion/editor.py tests/test_fetch_mappings.py tests/test_tags.py |
diffstat | 9 files changed, 61 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore +++ b/.hgignore @@ -1,21 +1,22 @@ syntax:glob -build +*.egg-info +*.orig +*.py,cover *.pyc *.pyo -.DS_Store *.swp *~ +.DS_Store .coverage -cover -*.py,cover +.noseids +.project +.pydevproject +.settings +.tox MANIFEST +build +cover dist -*.egg-info hgsubversion/__version__.py nbproject -.project -.pydevproject -.settings -*.orig -.noseids tests/fixtures/temp
--- a/hgsubversion/__init__.py +++ b/hgsubversion/__init__.py @@ -269,6 +269,8 @@ def svnuuidkw(**args): """:svnuuid: String. Converted subversion revision repository identifier.""" return _templatehelper(args['ctx'], 'svnuuid') +loadkeyword(templatekeyword) + def listsvnkeys(repo): keys = {} repo = repo.local()
--- a/hgsubversion/editor.py +++ b/hgsubversion/editor.py @@ -106,6 +106,9 @@ class RevisionData(object): self.clear() def clear(self): + oldstore = getattr(self, 'store', None) + if oldstore is not None: + oldstore.close() self.store = FileStore(util.getfilestoresize(self.ui)) self.added = set() self.deleted = {}
--- a/tests/test_fetch_branches.py +++ b/tests/test_fetch_branches.py @@ -41,7 +41,8 @@ class TestFetchBranches(test_util.TestBa heads = dict([(ctx.branch(), ctx) for ctx in heads]) # Let these tests disabled yet as the fix is not obvious self.assertEqual(heads['branch1'].manifest().keys(), ['b']) - self.assertEqual(heads['branch2'].manifest().keys(), ['a', 'b']) + self.assertEqual(sorted(heads['branch2'].manifest().keys()), + ['a', 'b']) def test_unorderedbranch(self): repo = self._load_fixture_and_fetch('unorderedbranch.svndump')
--- a/tests/test_fetch_mappings.py +++ b/tests/test_fetch_mappings.py @@ -161,9 +161,9 @@ class MapTests(test_util.TestBase): # The exclusion of alpha is overridden by the later rule to # include all of '.', whereas gamma should remain excluded # because it's excluded after the root directory. - self.assertEqual(self.repo[0].manifest().keys(), + self.assertEqual(sorted(self.repo[0].manifest().keys()), ['alpha', 'beta']) - self.assertEqual(self.repo['default'].manifest().keys(), + self.assertEqual(sorted(self.repo['default'].manifest().keys()), ['alpha', 'beta']) @test_util.requiresreplay
--- a/tests/test_fetch_renames.py +++ b/tests/test_fetch_renames.py @@ -34,12 +34,16 @@ class TestFetchRenames(test_util.TestBas repo = self._load_fixture_and_fetch('renames_with_prefix.svndump', subdir='prefix', config=config) - self._run_assertions(repo) + self._run_assertions(repo, prefix=True) - def _run_assertions(self, repo): + def _run_assertions(self, repo, prefix=False): # Map revnum to mappings of dest name to (source name, dest content) + if prefix: + prefixlen = len('svn:ae30a990-0fd3-493e-b5d7-883bdd606745/prefix') + else: + prefixlen = len('svn:ae30a990-0fd3-493e-b5d7-883bdd606745') copies = { - 4: { + '/trunk@6': { 'a1': ('a', 'a\n'), 'linka1': ('linka', 'a'), 'a2': ('a', 'a\n'), @@ -55,32 +59,35 @@ class TestFetchRenames(test_util.TestBas 'da2/db/dbf': ('da/db/dbf', 'd\n'), 'da2/db/dblink': ('da/db/dblink', '../daf'), }, - 5: { + '/branches/branch1@6': { 'c1': ('c', 'c\nc\n'), 'linkc1': ('linkc', 'cc'), }, - 9: { + '/trunk@10': { 'unchanged2': ('unchanged', 'unchanged\n'), 'unchangedlink2': ('unchangedlink', 'unchanged'), 'unchangeddir2/f': ('unchangeddir/f', 'unchanged2\n'), 'unchangeddir2/link': ('unchangeddir/link', 'f'), }, - 10: { + '/trunk@11': { 'groupdir2/b': ('groupdir/b', 'b\n'), 'groupdir2/linkb': ('groupdir/linkb', 'b'), }, } for rev in repo: ctx = repo[rev] - copymap = copies.get(rev, {}) + copymap = copies.get(ctx.extra()['convert_revision'][prefixlen:], + {}) for f in ctx.manifest(): cp = ctx[f].renamed() - self.assertEqual(bool(cp), bool(copymap.get(f)), - 'copy records differ for %s in %d' % (f, rev)) - if not cp: - continue - self.assertEqual(cp[0], copymap[f][0]) - self.assertEqual(ctx[f].data(), copymap[f][1]) + want = copymap.get(f) + self.assertEqual( + bool(cp), bool(want), + 'copy records differ for %s in %d (want %r, got %r)' % ( + f, rev, want, cp)) + if cp: + self.assertEqual(cp[0], want[0]) + self.assertEqual(ctx[f].data(), want[1]) self.assertEqual(repo['tip']['changed3'].data(), 'changed\nchanged3\n')
--- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -30,3 +30,4 @@ class TestHelpers(unittest.TestCase): fs.popfile('bb') self.assertEqual([], os.listdir(fs._tempdir)) self.assertRaises(editor.EditingError, lambda: fs.getfile('bb')) + fs.close()
--- a/tests/test_tags.py +++ b/tests/test_tags.py @@ -129,10 +129,8 @@ rename a tag 'branch': 'magic', 'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/tags/will-edit@19'}) self.assertEqual(willedit, repo.tags()['will-edit']) - self.assertEqual(repo['will-edit'].manifest().keys(), ['alpha', - 'beta', - 'gamma', - ]) + self.assertEqual(sorted(repo['will-edit'].manifest().keys()), + ['alpha', 'beta', 'gamma']) self.assertEqual( repo[alsoedit].extra(), {'close': '1',
new file mode 100644 --- /dev/null +++ b/tox.ini @@ -0,0 +1,18 @@ +[tox] +envlist = hg28,hg30,hg31,hg32,hg33,hg34,hg35,hg36,hg37,hg38 + +[testenv] +deps= + nose + hg28: Mercurial==2.8.2 + hg30: Mercurial==3.0.1 + hg31: Mercurial==3.1.2 + hg32: Mercurial==3.2.4 + hg33: Mercurial==3.3.3 + hg34: Mercurial==3.4.2 + hg35: Mercurial==3.5.2 + hg36: Mercurial==3.6.3 + hg37: Mercurial==3.7.3 + hg38: Mercurial==3.8.3 + subvertpy +commands=nosetests {posargs}