Mercurial > hgsubversion
diff tests/test_util.py @ 1570:d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
author | Paul Morelle <paul.morelle@octobus.net> |
---|---|
date | Fri, 25 May 2018 11:52:03 +0200 |
parents | 4afe8d7e4602 |
children |
line wrap: on
line diff
--- a/tests/test_util.py +++ b/tests/test_util.py @@ -49,6 +49,13 @@ from hgsubversion import svnwrap from hgsubversion import util from hgsubversion import svnwrap +try: + revsymbol = scmutil.revsymbol +except AttributeError: + # Pre hg 4.6 way of resolving a symbol + def revsymbol(repo, symbol): + return repo[symbol] + # Documentation for Subprocess.Popen() says: # "Note that on Windows, you cannot set close_fds to true and # also redirect the standard handles by setting stdin, stdout or @@ -225,7 +232,7 @@ def repolen(repo, svnonly=False): revs -= obsolete.getrevs(repo, 'obsolete') if svnonly: - revs = set(r for r in revs if util.getsvnrev(repo[r])) + revs = set(r for r in revs if util.getsvnrev(revsymbol(repo, r))) return len(revs) @@ -697,7 +704,10 @@ class TestBase(unittest.TestCase): - (source, None, None) to remove source. """ repo = self.repo - parentctx = repo[parent] + if isinstance(parent, int): + parentctx = repo[parent] + else: + parentctx = revsymbol(repo, parent) changed, removed = [], [] for source, dest, newdata in changes: