annotate tests/test_fetch_command_regexes.py @ 131:4d42dbbb5127

hg_delta_editor: fix parent revision detection on branch copy Project items copyfrom revisions are irrelevant to parent revision detection, only the project one or those of its ancestors matter. Items copyfrom is useful when retrieving items content. Former code resulted in incorrect converted graph for pyglet repository, especially on the following revision: ------------------------------------------------------------------------ r274 | r1chardj0n3s | 2006-12-21 02:02:14 +0100 (Jeu, 21 Dec 2006) | 2 lines Changed paths: A /branches/richard-glx-version (from /trunk:269) M /branches/richard-glx-version/pyglet/window/xlib/__init__.py R /branches/richard-glx-version/tests/test.py (from /trunk/tests/test.py:270) R /branches/richard-glx-version/tools/info.py (from /trunk/tools/info.py:272) R /branches/richard-glx-version/website/get_involved.php (from /trunk/website/get_involved.php:273) Branching to horribly mangle GLX
author Patrick Mezard <pmezard@gmail.com>
date Wed, 10 Dec 2008 11:03:22 -0600
parents 99f8e4b535e9
children e2214c8fc91f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
1 import fetch_command
16
48a44546c12f Add a basic system for running the hgsubversion tests (although not the svnwrap ones) without requiring Nose. Nose is still the recommended way to run the tests.
Augie Fackler <durin42@gmail.com>
parents: 13
diff changeset
2 import unittest
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
3
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
4 two_empties = """Index: __init__.py
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
5 ===================================================================
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
6 Index: bar/__init__.py
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
7 ===================================================================
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
8 Index: bar/test_muhaha.py
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
9 ===================================================================
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
10 --- bar/test_muhaha.py (revision 0)
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
11 +++ bar/test_muhaha.py (revision 1)
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
12 @@ -0,0 +1,2 @@
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
13 +
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
14 +blah blah blah, I'm a fake patch
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
15 \ No newline at end of file
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
16 """
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
17
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
18 binary_delta = """Index: trunk/functional_tests/doc_tests/test_doctest_fixtures/doctest_fixtures_fixtures.pyc
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
19 ===================================================================
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
20 Cannot display: file marked as a binary type.
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
21 svn:mime-type = application/octet-stream
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
22
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
23 Property changes on: trunk/functional_tests/doc_tests/test_doctest_fixtures/doctest_fixtures_fixtures.pyc
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
24 ___________________________________________________________________
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
25 Added: svn:mime-type
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
26 + application/octet-stream
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
27
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
28 Index: trunk/functional_tests/doc_tests/test_doctest_fixtures/doctest_fixtures.rst
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
29 ===================================================================
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
30 """
16
48a44546c12f Add a basic system for running the hgsubversion tests (although not the svnwrap ones) without requiring Nose. Nose is still the recommended way to run the tests.
Augie Fackler <durin42@gmail.com>
parents: 13
diff changeset
31
25
99f8e4b535e9 svn 1.4 and 1.5 have different ideas of diff output for prop changes.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
32 special_delta = """Index: delta
99f8e4b535e9 svn 1.4 and 1.5 have different ideas of diff output for prop changes.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
33 ===================================================================
99f8e4b535e9 svn 1.4 and 1.5 have different ideas of diff output for prop changes.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
34 --- delta(revision 0)
99f8e4b535e9 svn 1.4 and 1.5 have different ideas of diff output for prop changes.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
35 +++ delta(revision 9)
99f8e4b535e9 svn 1.4 and 1.5 have different ideas of diff output for prop changes.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
36 @@ -0,0 +1 @@
99f8e4b535e9 svn 1.4 and 1.5 have different ideas of diff output for prop changes.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
37 +link alpha
99f8e4b535e9 svn 1.4 and 1.5 have different ideas of diff output for prop changes.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
38 \ No newline at end of file
99f8e4b535e9 svn 1.4 and 1.5 have different ideas of diff output for prop changes.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
39
99f8e4b535e9 svn 1.4 and 1.5 have different ideas of diff output for prop changes.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
40 Property changes on: delta
99f8e4b535e9 svn 1.4 and 1.5 have different ideas of diff output for prop changes.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
41 ___________________________________________________________________
99f8e4b535e9 svn 1.4 and 1.5 have different ideas of diff output for prop changes.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
42 Name: svn:special
99f8e4b535e9 svn 1.4 and 1.5 have different ideas of diff output for prop changes.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
43 + *
99f8e4b535e9 svn 1.4 and 1.5 have different ideas of diff output for prop changes.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
44
99f8e4b535e9 svn 1.4 and 1.5 have different ideas of diff output for prop changes.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
45 """
99f8e4b535e9 svn 1.4 and 1.5 have different ideas of diff output for prop changes.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
46
16
48a44546c12f Add a basic system for running the hgsubversion tests (although not the svnwrap ones) without requiring Nose. Nose is still the recommended way to run the tests.
Augie Fackler <durin42@gmail.com>
parents: 13
diff changeset
47 class RegexTests(unittest.TestCase):
48a44546c12f Add a basic system for running the hgsubversion tests (although not the svnwrap ones) without requiring Nose. Nose is still the recommended way to run the tests.
Augie Fackler <durin42@gmail.com>
parents: 13
diff changeset
48 def test_empty_file_re(self):
48a44546c12f Add a basic system for running the hgsubversion tests (although not the svnwrap ones) without requiring Nose. Nose is still the recommended way to run the tests.
Augie Fackler <durin42@gmail.com>
parents: 13
diff changeset
49 matches = fetch_command.empty_file_patch_wont_make_re.findall(two_empties)
48a44546c12f Add a basic system for running the hgsubversion tests (although not the svnwrap ones) without requiring Nose. Nose is still the recommended way to run the tests.
Augie Fackler <durin42@gmail.com>
parents: 13
diff changeset
50 assert sorted(matches) == ['__init__.py', 'bar/__init__.py']
25
99f8e4b535e9 svn 1.4 and 1.5 have different ideas of diff output for prop changes.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
51
16
48a44546c12f Add a basic system for running the hgsubversion tests (although not the svnwrap ones) without requiring Nose. Nose is still the recommended way to run the tests.
Augie Fackler <durin42@gmail.com>
parents: 13
diff changeset
52 def test_any_matches_just_one(self):
48a44546c12f Add a basic system for running the hgsubversion tests (although not the svnwrap ones) without requiring Nose. Nose is still the recommended way to run the tests.
Augie Fackler <durin42@gmail.com>
parents: 13
diff changeset
53 pat = '''Index: trunk/django/contrib/admin/urls/__init__.py
48a44546c12f Add a basic system for running the hgsubversion tests (although not the svnwrap ones) without requiring Nose. Nose is still the recommended way to run the tests.
Augie Fackler <durin42@gmail.com>
parents: 13
diff changeset
54 ===================================================================
48a44546c12f Add a basic system for running the hgsubversion tests (although not the svnwrap ones) without requiring Nose. Nose is still the recommended way to run the tests.
Augie Fackler <durin42@gmail.com>
parents: 13
diff changeset
55 '''
48a44546c12f Add a basic system for running the hgsubversion tests (although not the svnwrap ones) without requiring Nose. Nose is still the recommended way to run the tests.
Augie Fackler <durin42@gmail.com>
parents: 13
diff changeset
56 matches = fetch_command.any_file_re.findall(pat)
48a44546c12f Add a basic system for running the hgsubversion tests (although not the svnwrap ones) without requiring Nose. Nose is still the recommended way to run the tests.
Augie Fackler <durin42@gmail.com>
parents: 13
diff changeset
57 assert len(matches) == 1
25
99f8e4b535e9 svn 1.4 and 1.5 have different ideas of diff output for prop changes.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
58
99f8e4b535e9 svn 1.4 and 1.5 have different ideas of diff output for prop changes.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
59 def test_special_re(self):
99f8e4b535e9 svn 1.4 and 1.5 have different ideas of diff output for prop changes.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
60 matches = fetch_command.property_special_set_re.findall(special_delta)
99f8e4b535e9 svn 1.4 and 1.5 have different ideas of diff output for prop changes.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
61 assert len(matches) == 1
99f8e4b535e9 svn 1.4 and 1.5 have different ideas of diff output for prop changes.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
62
16
48a44546c12f Add a basic system for running the hgsubversion tests (although not the svnwrap ones) without requiring Nose. Nose is still the recommended way to run the tests.
Augie Fackler <durin42@gmail.com>
parents: 13
diff changeset
63 def test_any_file_re(self):
48a44546c12f Add a basic system for running the hgsubversion tests (although not the svnwrap ones) without requiring Nose. Nose is still the recommended way to run the tests.
Augie Fackler <durin42@gmail.com>
parents: 13
diff changeset
64 matches = fetch_command.any_file_re.findall(two_empties)
48a44546c12f Add a basic system for running the hgsubversion tests (although not the svnwrap ones) without requiring Nose. Nose is still the recommended way to run the tests.
Augie Fackler <durin42@gmail.com>
parents: 13
diff changeset
65 assert sorted(matches) == ['__init__.py', 'bar/__init__.py',
48a44546c12f Add a basic system for running the hgsubversion tests (although not the svnwrap ones) without requiring Nose. Nose is still the recommended way to run the tests.
Augie Fackler <durin42@gmail.com>
parents: 13
diff changeset
66 'bar/test_muhaha.py']
48a44546c12f Add a basic system for running the hgsubversion tests (although not the svnwrap ones) without requiring Nose. Nose is still the recommended way to run the tests.
Augie Fackler <durin42@gmail.com>
parents: 13
diff changeset
67
48a44546c12f Add a basic system for running the hgsubversion tests (although not the svnwrap ones) without requiring Nose. Nose is still the recommended way to run the tests.
Augie Fackler <durin42@gmail.com>
parents: 13
diff changeset
68 def test_binary_file_re(self):
48a44546c12f Add a basic system for running the hgsubversion tests (although not the svnwrap ones) without requiring Nose. Nose is still the recommended way to run the tests.
Augie Fackler <durin42@gmail.com>
parents: 13
diff changeset
69 matches = fetch_command.binary_file_re.findall(binary_delta)
48a44546c12f Add a basic system for running the hgsubversion tests (although not the svnwrap ones) without requiring Nose. Nose is still the recommended way to run the tests.
Augie Fackler <durin42@gmail.com>
parents: 13
diff changeset
70 assert matches == ['trunk/functional_tests/doc_tests/test_doctest_fixtures/doctest_fixtures_fixtures.pyc']
48a44546c12f Add a basic system for running the hgsubversion tests (although not the svnwrap ones) without requiring Nose. Nose is still the recommended way to run the tests.
Augie Fackler <durin42@gmail.com>
parents: 13
diff changeset
71
48a44546c12f Add a basic system for running the hgsubversion tests (although not the svnwrap ones) without requiring Nose. Nose is still the recommended way to run the tests.
Augie Fackler <durin42@gmail.com>
parents: 13
diff changeset
72 def suite():
48a44546c12f Add a basic system for running the hgsubversion tests (although not the svnwrap ones) without requiring Nose. Nose is still the recommended way to run the tests.
Augie Fackler <durin42@gmail.com>
parents: 13
diff changeset
73 return unittest.TestLoader().loadTestsFromTestCase(RegexTests)