Mercurial > hgsubversion
annotate tests/comprehensive/test_verify.py @ 467:3941d73c262e
svnwrappers: override svn+ssh credentials with supplied ones if any
svn+ssh URLs are special because the authentication layer is not handled by
svn, so they must contain the username to be resolved seamlessly. Until now,
credentials supplied from the command line were ignored when rewriting those
URLs. Fix that.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sat, 18 Jul 2009 20:44:33 -0500 |
parents | de085126dbd4 |
children | 1fd3cfa47c5e |
rev | line source |
---|---|
395
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
1 import os |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
2 import pickle |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
3 import unittest |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
4 |
426
72e63999722f
tests: make comprehensive tests work properly with nose and run.py
Augie Fackler <durin42@gmail.com>
parents:
395
diff
changeset
|
5 # wrapped in a try/except because of weirdness in how |
72e63999722f
tests: make comprehensive tests work properly with nose and run.py
Augie Fackler <durin42@gmail.com>
parents:
395
diff
changeset
|
6 # run.py works as compared to nose. |
72e63999722f
tests: make comprehensive tests work properly with nose and run.py
Augie Fackler <durin42@gmail.com>
parents:
395
diff
changeset
|
7 try: |
72e63999722f
tests: make comprehensive tests work properly with nose and run.py
Augie Fackler <durin42@gmail.com>
parents:
395
diff
changeset
|
8 import test_util |
72e63999722f
tests: make comprehensive tests work properly with nose and run.py
Augie Fackler <durin42@gmail.com>
parents:
395
diff
changeset
|
9 except ImportError: |
72e63999722f
tests: make comprehensive tests work properly with nose and run.py
Augie Fackler <durin42@gmail.com>
parents:
395
diff
changeset
|
10 from tests import test_util |
395
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
11 |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
12 from mercurial import hg |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
13 from mercurial import ui |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
14 |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
15 from hgsubversion import svncommands |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
16 |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
17 def _do_case(self, name, stupid): |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
18 subdir = test_util.subdir.get(name, '') |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
19 repo = self._load_fixture_and_fetch(name, subdir=subdir, stupid=stupid) |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
20 assert len(self.repo) > 0 |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
21 for i in repo: |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
22 ctx = repo[i] |
441
de085126dbd4
svncommands: use rev instead of verifynode -- should not have to be a node
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
427
diff
changeset
|
23 self.assertEqual(svncommands.verify(repo.ui, repo, rev=ctx.node()), 0) |
395
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
24 |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
25 def buildmethod(case, name, stupid): |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
26 m = lambda self: self._do_case(case, stupid) |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
27 m.__name__ = name |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
28 bits = case, stupid and 'stupid' or 'real' |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
29 m.__doc__ = 'Test verify on %s with %s replay.' % bits |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
30 return m |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
31 |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
32 attrs = {'_do_case': _do_case} |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
33 fixtures = [f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')] |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
34 for case in fixtures: |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
35 # this fixture results in an empty repository, don't use it |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
36 if case == 'project_root_not_repo_root.svndump': |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
37 continue |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
38 name = 'test_' + case[:-len('.svndump')] |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
39 attrs[name] = buildmethod(case, name, False) |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
40 name += '_stupid' |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
41 attrs[name] = buildmethod(case, name, True) |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
42 |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
43 VerifyTests = type('VerifyTests', (test_util.TestBase,), attrs) |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
44 |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
45 def suite(): |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
46 all = [unittest.TestLoader().loadTestsFromTestCase(VerifyTests)] |
636e9bf5d49c
svncommands: add verify command
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
47 return unittest.TestSuite(all) |