Mercurial > hgsubversion
comparison 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 |
comparison
equal
deleted
inserted
replaced
1569:4afe8d7e4602 | 1570:d55c9d0ba350 |
---|---|
46 SkipTest = None | 46 SkipTest = None |
47 | 47 |
48 from hgsubversion import svnwrap | 48 from hgsubversion import svnwrap |
49 from hgsubversion import util | 49 from hgsubversion import util |
50 from hgsubversion import svnwrap | 50 from hgsubversion import svnwrap |
51 | |
52 try: | |
53 revsymbol = scmutil.revsymbol | |
54 except AttributeError: | |
55 # Pre hg 4.6 way of resolving a symbol | |
56 def revsymbol(repo, symbol): | |
57 return repo[symbol] | |
51 | 58 |
52 # Documentation for Subprocess.Popen() says: | 59 # Documentation for Subprocess.Popen() says: |
53 # "Note that on Windows, you cannot set close_fds to true and | 60 # "Note that on Windows, you cannot set close_fds to true and |
54 # also redirect the standard handles by setting stdin, stdout or | 61 # also redirect the standard handles by setting stdin, stdout or |
55 # stderr." | 62 # stderr." |
223 | 230 |
224 if obsolete: | 231 if obsolete: |
225 revs -= obsolete.getrevs(repo, 'obsolete') | 232 revs -= obsolete.getrevs(repo, 'obsolete') |
226 | 233 |
227 if svnonly: | 234 if svnonly: |
228 revs = set(r for r in revs if util.getsvnrev(repo[r])) | 235 revs = set(r for r in revs if util.getsvnrev(revsymbol(repo, r))) |
229 | 236 |
230 return len(revs) | 237 return len(revs) |
231 | 238 |
232 def _makeskip(name, message): | 239 def _makeskip(name, message): |
233 if SkipTest: | 240 if SkipTest: |
695 - (source, dest, data) to set dest content to data, and mark it as copied | 702 - (source, dest, data) to set dest content to data, and mark it as copied |
696 from source. | 703 from source. |
697 - (source, None, None) to remove source. | 704 - (source, None, None) to remove source. |
698 """ | 705 """ |
699 repo = self.repo | 706 repo = self.repo |
700 parentctx = repo[parent] | 707 if isinstance(parent, int): |
708 parentctx = repo[parent] | |
709 else: | |
710 parentctx = revsymbol(repo, parent) | |
701 | 711 |
702 changed, removed = [], [] | 712 changed, removed = [], [] |
703 for source, dest, newdata in changes: | 713 for source, dest, newdata in changes: |
704 if dest is None: | 714 if dest is None: |
705 removed.append(source) | 715 removed.append(source) |