Mercurial > hgsubversion
annotate tests/test_diff.py @ 326:33736e2e25f0
alternate approach for supporting svn schemes for repository paths
We now intercept the operations in the local repo class, and handle
the relevant operation ourselves. This frees us from wrapping all
relevant commands and replicating their functionality.
The implementation is incomplete; only one test has been modified to
use the standard Mercurial API with the changed URLs. Once changed,
those tests will likely reveal bugs or missing features in the new
wrappers. Also, new wrappers will be needed for handling conversion
flags such as -A/--authormap.
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Thu, 07 May 2009 20:50:53 +0200 |
parents | ffccf0080e54 |
children | 75f082b5897e |
rev | line source |
---|---|
153
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
138
diff
changeset
|
1 import unittest |
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
138
diff
changeset
|
2 |
138
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
3 from mercurial import ui |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
4 |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
256
diff
changeset
|
5 import wrappers |
138
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
6 |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
7 import test_util |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
8 |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
9 expected_diff_output = '''Index: alpha |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
10 =================================================================== |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
11 --- alpha\t(revision 3) |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
12 +++ alpha\t(working copy) |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
13 @@ -1,1 +1,3 @@ |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
14 -file: alpha |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
15 +alpha |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
16 + |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
17 +added line |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
18 Index: foo |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
19 =================================================================== |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
20 new file mode 100644 |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
21 --- foo\t(revision 0) |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
22 +++ foo\t(working copy) |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
23 @@ -0,0 +1,1 @@ |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
24 +This is missing a newline. |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
25 \ No newline at end of file |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
26 ''' |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
27 |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
28 class DiffTests(test_util.TestBase): |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
29 def test_diff_output(self): |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
30 self._load_fixture_and_fetch('two_revs.svndump') |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
31 self.commitchanges([('foo', 'foo', 'This is missing a newline.'), |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
32 ('alpha', 'alpha', 'alpha\n\nadded line\n'), |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
33 ]) |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
34 u = ui.ui() |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
256
diff
changeset
|
35 wrappers.diff(lambda x,y,z: None, |
256
7932d098cb5f
Refactor commands to wrap their hg equivalent adding a --svn flag where sane.
Augie Fackler <durin42@gmail.com>
parents:
244
diff
changeset
|
36 u, self.repo, svn=True) |
138
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
37 self.assertEqual(u.stream.getvalue(), expected_diff_output) |
153
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
138
diff
changeset
|
38 |
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
138
diff
changeset
|
39 |
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
138
diff
changeset
|
40 def suite(): |
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
138
diff
changeset
|
41 all = [unittest.TestLoader().loadTestsFromTestCase(DiffTests), |
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
138
diff
changeset
|
42 ] |
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
138
diff
changeset
|
43 return unittest.TestSuite(all) |