annotate tests/test_fetch_mappings.py @ 820:09f7c1c09207

authormap: only append new or changed authors Previously, specifying an extra authormap with the hgsubversion.authormap configuration variable would cause the entirety of the other authormap to be appended to the one in '.hg/svn/authors' on each subversion access (e.g. hg in/out/pull/push). This also changes the authormap to preserve comments and the like in the authormap file.
author maugustin <maugustin@gmx.net>
date Sat, 23 Jul 2011 19:33:50 -0500
parents 86d124a8768e
children 033b86e0f56d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
168
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
1 """Tests for author maps and file maps.
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
2 """
643
d2ef7220a079 tests: import test_util as the first module in all relevant tests
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 641
diff changeset
3 import test_util
d2ef7220a079 tests: import test_util as the first module in all relevant tests
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 641
diff changeset
4
168
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
5 import os
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
6 import unittest
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
7
331
75f082b5897e Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 257
diff changeset
8 from mercurial import commands
641
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
9 from mercurial import hg
179
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
10 from mercurial import node
636
d4f433ee709a branchmap: reject empty mappings
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 635
diff changeset
11 from mercurial import util as hgutil
168
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
12
430
2851b81c65ce maps: make sure AuthorMaps don't overwrite themselves, fix overriding
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 360
diff changeset
13 from hgsubversion import maps
641
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
14 from hgsubversion import svncommands
769
cc1d4aa3ba41 configurable substitution for empty commit message (fixes #195)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 768
diff changeset
15 from hgsubversion import util
430
2851b81c65ce maps: make sure AuthorMaps don't overwrite themselves, fix overriding
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 360
diff changeset
16
168
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
17 class MapTests(test_util.TestBase):
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
18 @property
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
19 def authors(self):
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
20 return os.path.join(self.tmpdir, 'authormap')
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
21
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
22 @property
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
23 def filemap(self):
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
24 return os.path.join(self.tmpdir, 'filemap')
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
25
574
8e025a6f0db4 add basic branchmap functionality, to rename branches
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 430
diff changeset
26 @property
8e025a6f0db4 add basic branchmap functionality, to rename branches
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 430
diff changeset
27 def branchmap(self):
8e025a6f0db4 add basic branchmap functionality, to rename branches
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 430
diff changeset
28 return os.path.join(self.tmpdir, 'branchmap')
729
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
29
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
30 @property
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
31 def tagmap(self):
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
32 return os.path.join(self.tmpdir, 'tagmap')
574
8e025a6f0db4 add basic branchmap functionality, to rename branches
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 430
diff changeset
33
168
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
34 def test_author_map(self, stupid=False):
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
35 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump')
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
36 authormap = open(self.authors, 'w')
360
27e9fea5d114 Author maps: strip comments.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 358
diff changeset
37 authormap.write('Augie=Augie Fackler <durin42@gmail.com> # stuffy\n')
358
2c0649064455 Author maps: handle lines without = gracefully.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 331
diff changeset
38 authormap.write("Augie Fackler <durin42@gmail.com>\n")
168
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
39 authormap.close()
576
d96aa92d9ad9 tests: silence test suite by using quiet UIs everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 574
diff changeset
40 ui = self.ui(stupid)
d96aa92d9ad9 tests: silence test suite by using quiet UIs everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 574
diff changeset
41 ui.setconfig('hgsubversion', 'authormap', self.authors)
d96aa92d9ad9 tests: silence test suite by using quiet UIs everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 574
diff changeset
42 commands.clone(ui, test_util.fileurl(self.repo_path),
331
75f082b5897e Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 257
diff changeset
43 self.wc_path, authors=self.authors)
168
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
44 self.assertEqual(self.repo[0].user(),
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
45 'Augie Fackler <durin42@gmail.com>')
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
46 self.assertEqual(self.repo['tip'].user(),
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
47 'evil@5b65bade-98f3-4993-a01f-b7a6710da339')
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
48
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
49 def test_author_map_stupid(self):
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
50 self.test_author_map(True)
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
51
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
52 def test_author_map_closing_author(self, stupid=False):
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
53 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump')
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
54 authormap = open(self.authors, 'w')
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
55 authormap.write("evil=Testy <test@test>")
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
56 authormap.close()
576
d96aa92d9ad9 tests: silence test suite by using quiet UIs everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 574
diff changeset
57 ui = self.ui(stupid)
d96aa92d9ad9 tests: silence test suite by using quiet UIs everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 574
diff changeset
58 ui.setconfig('hgsubversion', 'authormap', self.authors)
d96aa92d9ad9 tests: silence test suite by using quiet UIs everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 574
diff changeset
59 commands.clone(ui, test_util.fileurl(self.repo_path),
331
75f082b5897e Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 257
diff changeset
60 self.wc_path, authors=self.authors)
168
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
61 self.assertEqual(self.repo[0].user(),
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
62 'Augie@5b65bade-98f3-4993-a01f-b7a6710da339')
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
63 self.assertEqual(self.repo['tip'].user(),
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
64 'Testy <test@test>')
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
65
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
66 def test_author_map_closing_author_stupid(self):
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
67 self.test_author_map_closing_author(True)
203
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 179
diff changeset
68
735
c2b9e08ecf10 maps: map a missing author to '(no author)'
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 729
diff changeset
69 def test_author_map_no_author(self, stupid=False):
768
13a2137d3c15 test_fetch_mappings: actually test stupid mode in test_author_map_no_author()
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 735
diff changeset
70 self._load_fixture_and_fetch('no-author.svndump', stupid=stupid)
735
c2b9e08ecf10 maps: map a missing author to '(no author)'
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 729
diff changeset
71 users = set(self.repo[r].user() for r in self.repo)
c2b9e08ecf10 maps: map a missing author to '(no author)'
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 729
diff changeset
72 expected_users = ['(no author)@%s' % self.repo.svnmeta().uuid]
c2b9e08ecf10 maps: map a missing author to '(no author)'
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 729
diff changeset
73 self.assertEqual(sorted(users), expected_users)
c2b9e08ecf10 maps: map a missing author to '(no author)'
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 729
diff changeset
74 test_util.rmtree(self.wc_path)
c2b9e08ecf10 maps: map a missing author to '(no author)'
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 729
diff changeset
75
c2b9e08ecf10 maps: map a missing author to '(no author)'
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 729
diff changeset
76 authormap = open(self.authors, 'w')
c2b9e08ecf10 maps: map a missing author to '(no author)'
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 729
diff changeset
77 authormap.write("(no author)=Testy <test@example.com>")
c2b9e08ecf10 maps: map a missing author to '(no author)'
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 729
diff changeset
78 authormap.close()
c2b9e08ecf10 maps: map a missing author to '(no author)'
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 729
diff changeset
79 ui = self.ui(stupid)
c2b9e08ecf10 maps: map a missing author to '(no author)'
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 729
diff changeset
80 ui.setconfig('hgsubversion', 'authormap', self.authors)
c2b9e08ecf10 maps: map a missing author to '(no author)'
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 729
diff changeset
81 commands.clone(ui, test_util.fileurl(self.repo_path),
c2b9e08ecf10 maps: map a missing author to '(no author)'
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 729
diff changeset
82 self.wc_path, authors=self.authors)
c2b9e08ecf10 maps: map a missing author to '(no author)'
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 729
diff changeset
83 users = set(self.repo[r].user() for r in self.repo)
c2b9e08ecf10 maps: map a missing author to '(no author)'
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 729
diff changeset
84 expected_users = ['Testy <test@example.com>']
c2b9e08ecf10 maps: map a missing author to '(no author)'
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 729
diff changeset
85 self.assertEqual(sorted(users), expected_users)
c2b9e08ecf10 maps: map a missing author to '(no author)'
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 729
diff changeset
86
c2b9e08ecf10 maps: map a missing author to '(no author)'
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 729
diff changeset
87 def test_author_map_no_author_stupid(self):
c2b9e08ecf10 maps: map a missing author to '(no author)'
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 729
diff changeset
88 self.test_author_map_no_author(True)
c2b9e08ecf10 maps: map a missing author to '(no author)'
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 729
diff changeset
89
430
2851b81c65ce maps: make sure AuthorMaps don't overwrite themselves, fix overriding
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 360
diff changeset
90 def test_author_map_no_overwrite(self):
2851b81c65ce maps: make sure AuthorMaps don't overwrite themselves, fix overriding
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 360
diff changeset
91 cwd = os.path.dirname(__file__)
2851b81c65ce maps: make sure AuthorMaps don't overwrite themselves, fix overriding
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 360
diff changeset
92 orig = os.path.join(cwd, 'fixtures', 'author-map-test.txt')
2851b81c65ce maps: make sure AuthorMaps don't overwrite themselves, fix overriding
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 360
diff changeset
93 new = open(self.authors, 'w')
2851b81c65ce maps: make sure AuthorMaps don't overwrite themselves, fix overriding
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 360
diff changeset
94 new.write(open(orig).read())
2851b81c65ce maps: make sure AuthorMaps don't overwrite themselves, fix overriding
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 360
diff changeset
95 new.close()
576
d96aa92d9ad9 tests: silence test suite by using quiet UIs everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 574
diff changeset
96 test = maps.AuthorMap(self.ui(), self.authors)
430
2851b81c65ce maps: make sure AuthorMaps don't overwrite themselves, fix overriding
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 360
diff changeset
97 fromself = set(test)
2851b81c65ce maps: make sure AuthorMaps don't overwrite themselves, fix overriding
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 360
diff changeset
98 test.load(orig)
2851b81c65ce maps: make sure AuthorMaps don't overwrite themselves, fix overriding
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 360
diff changeset
99 all = set(test)
2851b81c65ce maps: make sure AuthorMaps don't overwrite themselves, fix overriding
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 360
diff changeset
100 self.assertEqual(fromself.symmetric_difference(all), set())
2851b81c65ce maps: make sure AuthorMaps don't overwrite themselves, fix overriding
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 360
diff changeset
101
179
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
102 def test_file_map(self, stupid=False):
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
103 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump')
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
104 filemap = open(self.filemap, 'w')
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
105 filemap.write("include alpha\n")
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
106 filemap.close()
576
d96aa92d9ad9 tests: silence test suite by using quiet UIs everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 574
diff changeset
107 ui = self.ui(stupid)
d96aa92d9ad9 tests: silence test suite by using quiet UIs everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 574
diff changeset
108 ui.setconfig('hgsubversion', 'filemap', self.filemap)
d96aa92d9ad9 tests: silence test suite by using quiet UIs everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 574
diff changeset
109 commands.clone(ui, test_util.fileurl(self.repo_path),
331
75f082b5897e Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 257
diff changeset
110 self.wc_path, filemap=self.filemap)
179
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
111 self.assertEqual(node.hex(self.repo[0].node()), '88e2c7492d83e4bf30fbb2dcbf6aa24d60ac688d')
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
112 self.assertEqual(node.hex(self.repo['default'].node()), 'e524296152246b3837fe9503c83b727075835155')
203
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 179
diff changeset
113
179
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
114 def test_file_map_stupid(self):
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
115 self.test_file_map(True)
203
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 179
diff changeset
116
179
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
117 def test_file_map_exclude(self, stupid=False):
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
118 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump')
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
119 filemap = open(self.filemap, 'w')
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
120 filemap.write("exclude alpha\n")
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
121 filemap.close()
576
d96aa92d9ad9 tests: silence test suite by using quiet UIs everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 574
diff changeset
122 ui = self.ui(stupid)
d96aa92d9ad9 tests: silence test suite by using quiet UIs everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 574
diff changeset
123 ui.setconfig('hgsubversion', 'filemap', self.filemap)
d96aa92d9ad9 tests: silence test suite by using quiet UIs everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 574
diff changeset
124 commands.clone(ui, test_util.fileurl(self.repo_path),
331
75f082b5897e Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 257
diff changeset
125 self.wc_path, filemap=self.filemap)
179
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
126 self.assertEqual(node.hex(self.repo[0].node()), '2c48f3525926ab6c8b8424bcf5eb34b149b61841')
203
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 179
diff changeset
127 self.assertEqual(node.hex(self.repo['default'].node()), 'b37a3c0297b71f989064d9b545b5a478bbed7cc1')
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 179
diff changeset
128
179
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
129 def test_file_map_exclude_stupid(self):
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
130 self.test_file_map_exclude(True)
168
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
131
574
8e025a6f0db4 add basic branchmap functionality, to rename branches
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 430
diff changeset
132 def test_branchmap(self, stupid=False):
8e025a6f0db4 add basic branchmap functionality, to rename branches
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 430
diff changeset
133 test_util.load_svndump_fixture(self.repo_path, 'branchmap.svndump')
8e025a6f0db4 add basic branchmap functionality, to rename branches
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 430
diff changeset
134 branchmap = open(self.branchmap, 'w')
8e025a6f0db4 add basic branchmap functionality, to rename branches
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 430
diff changeset
135 branchmap.write("badname = good-name # stuffy\n")
8e025a6f0db4 add basic branchmap functionality, to rename branches
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 430
diff changeset
136 branchmap.write("feature = default\n")
8e025a6f0db4 add basic branchmap functionality, to rename branches
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 430
diff changeset
137 branchmap.close()
576
d96aa92d9ad9 tests: silence test suite by using quiet UIs everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 574
diff changeset
138 ui = self.ui(stupid)
d96aa92d9ad9 tests: silence test suite by using quiet UIs everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 574
diff changeset
139 ui.setconfig('hgsubversion', 'branchmap', self.branchmap)
d96aa92d9ad9 tests: silence test suite by using quiet UIs everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 574
diff changeset
140 commands.clone(ui, test_util.fileurl(self.repo_path),
574
8e025a6f0db4 add basic branchmap functionality, to rename branches
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 430
diff changeset
141 self.wc_path, branchmap=self.branchmap)
8e025a6f0db4 add basic branchmap functionality, to rename branches
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 430
diff changeset
142 branches = set(self.repo[i].branch() for i in self.repo)
8e025a6f0db4 add basic branchmap functionality, to rename branches
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 430
diff changeset
143 self.assert_('badname' not in branches)
8e025a6f0db4 add basic branchmap functionality, to rename branches
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 430
diff changeset
144 self.assert_('good-name' in branches)
8e025a6f0db4 add basic branchmap functionality, to rename branches
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 430
diff changeset
145 self.assertEquals(self.repo[2].branch(), 'default')
8e025a6f0db4 add basic branchmap functionality, to rename branches
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 430
diff changeset
146
8e025a6f0db4 add basic branchmap functionality, to rename branches
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 430
diff changeset
147 def test_branchmap_stupid(self):
8e025a6f0db4 add basic branchmap functionality, to rename branches
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 430
diff changeset
148 self.test_branchmap(True)
8e025a6f0db4 add basic branchmap functionality, to rename branches
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 430
diff changeset
149
634
a400f3bf5611 replay/stupid: fix tagging on a branch renamed using a branch map
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 576
diff changeset
150 def test_branchmap_tagging(self, stupid=False):
a400f3bf5611 replay/stupid: fix tagging on a branch renamed using a branch map
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 576
diff changeset
151 '''test tagging a renamed branch, which used to raise an exception'''
a400f3bf5611 replay/stupid: fix tagging on a branch renamed using a branch map
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 576
diff changeset
152 test_util.load_svndump_fixture(self.repo_path, 'commit-to-tag.svndump')
a400f3bf5611 replay/stupid: fix tagging on a branch renamed using a branch map
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 576
diff changeset
153 branchmap = open(self.branchmap, 'w')
a400f3bf5611 replay/stupid: fix tagging on a branch renamed using a branch map
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 576
diff changeset
154 branchmap.write("magic = art\n")
a400f3bf5611 replay/stupid: fix tagging on a branch renamed using a branch map
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 576
diff changeset
155 branchmap.close()
a400f3bf5611 replay/stupid: fix tagging on a branch renamed using a branch map
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 576
diff changeset
156 ui = self.ui(stupid)
a400f3bf5611 replay/stupid: fix tagging on a branch renamed using a branch map
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 576
diff changeset
157 ui.setconfig('hgsubversion', 'branchmap', self.branchmap)
a400f3bf5611 replay/stupid: fix tagging on a branch renamed using a branch map
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 576
diff changeset
158 commands.clone(ui, test_util.fileurl(self.repo_path),
a400f3bf5611 replay/stupid: fix tagging on a branch renamed using a branch map
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 576
diff changeset
159 self.wc_path, branchmap=self.branchmap)
a400f3bf5611 replay/stupid: fix tagging on a branch renamed using a branch map
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 576
diff changeset
160 branches = set(self.repo[i].branch() for i in self.repo)
a400f3bf5611 replay/stupid: fix tagging on a branch renamed using a branch map
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 576
diff changeset
161 self.assertEquals(sorted(branches), ['art', 'closeme'])
a400f3bf5611 replay/stupid: fix tagging on a branch renamed using a branch map
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 576
diff changeset
162
a400f3bf5611 replay/stupid: fix tagging on a branch renamed using a branch map
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 576
diff changeset
163 def test_branchmap_tagging_stupid(self):
a400f3bf5611 replay/stupid: fix tagging on a branch renamed using a branch map
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 576
diff changeset
164 self.test_branchmap_tagging(True)
168
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
165
635
e2c3349b2cca branchmap: map empty commits in replay mode.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 634
diff changeset
166 def test_branchmap_empty_commit(self, stupid=False):
e2c3349b2cca branchmap: map empty commits in replay mode.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 634
diff changeset
167 '''test mapping an empty commit on a renamed branch'''
e2c3349b2cca branchmap: map empty commits in replay mode.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 634
diff changeset
168 test_util.load_svndump_fixture(self.repo_path, 'propset-branch.svndump')
e2c3349b2cca branchmap: map empty commits in replay mode.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 634
diff changeset
169 branchmap = open(self.branchmap, 'w')
e2c3349b2cca branchmap: map empty commits in replay mode.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 634
diff changeset
170 branchmap.write("the-branch = bob\n")
e2c3349b2cca branchmap: map empty commits in replay mode.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 634
diff changeset
171 branchmap.close()
e2c3349b2cca branchmap: map empty commits in replay mode.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 634
diff changeset
172 ui = self.ui(stupid)
e2c3349b2cca branchmap: map empty commits in replay mode.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 634
diff changeset
173 ui.setconfig('hgsubversion', 'branchmap', self.branchmap)
e2c3349b2cca branchmap: map empty commits in replay mode.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 634
diff changeset
174 commands.clone(ui, test_util.fileurl(self.repo_path),
e2c3349b2cca branchmap: map empty commits in replay mode.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 634
diff changeset
175 self.wc_path, branchmap=self.branchmap)
e2c3349b2cca branchmap: map empty commits in replay mode.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 634
diff changeset
176 branches = set(self.repo[i].branch() for i in self.repo)
e2c3349b2cca branchmap: map empty commits in replay mode.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 634
diff changeset
177 self.assertEquals(sorted(branches), ['bob', 'default'])
e2c3349b2cca branchmap: map empty commits in replay mode.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 634
diff changeset
178
e2c3349b2cca branchmap: map empty commits in replay mode.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 634
diff changeset
179 def test_branchmap_empty_commit_stupid(self):
e2c3349b2cca branchmap: map empty commits in replay mode.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 634
diff changeset
180 '''test mapping an empty commit on a renamed branch (stupid)'''
e2c3349b2cca branchmap: map empty commits in replay mode.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 634
diff changeset
181 self.test_branchmap_empty_commit(True)
e2c3349b2cca branchmap: map empty commits in replay mode.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 634
diff changeset
182
639
b2c8c2079822 tests: add test for combining two branches using the branchmap
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 636
diff changeset
183 def test_branchmap_combine(self, stupid=False):
b2c8c2079822 tests: add test for combining two branches using the branchmap
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 636
diff changeset
184 '''test combining two branches, but retaining heads'''
b2c8c2079822 tests: add test for combining two branches using the branchmap
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 636
diff changeset
185 test_util.load_svndump_fixture(self.repo_path, 'branchmap.svndump')
b2c8c2079822 tests: add test for combining two branches using the branchmap
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 636
diff changeset
186 branchmap = open(self.branchmap, 'w')
b2c8c2079822 tests: add test for combining two branches using the branchmap
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 636
diff changeset
187 branchmap.write("badname = default\n")
b2c8c2079822 tests: add test for combining two branches using the branchmap
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 636
diff changeset
188 branchmap.write("feature = default\n")
b2c8c2079822 tests: add test for combining two branches using the branchmap
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 636
diff changeset
189 branchmap.close()
b2c8c2079822 tests: add test for combining two branches using the branchmap
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 636
diff changeset
190 ui = self.ui(stupid)
b2c8c2079822 tests: add test for combining two branches using the branchmap
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 636
diff changeset
191 ui.setconfig('hgsubversion', 'branchmap', self.branchmap)
b2c8c2079822 tests: add test for combining two branches using the branchmap
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 636
diff changeset
192 commands.clone(ui, test_util.fileurl(self.repo_path),
b2c8c2079822 tests: add test for combining two branches using the branchmap
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 636
diff changeset
193 self.wc_path, branchmap=self.branchmap)
b2c8c2079822 tests: add test for combining two branches using the branchmap
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 636
diff changeset
194 branches = set(self.repo[i].branch() for i in self.repo)
b2c8c2079822 tests: add test for combining two branches using the branchmap
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 636
diff changeset
195 self.assertEquals(sorted(branches), ['default'])
b2c8c2079822 tests: add test for combining two branches using the branchmap
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 636
diff changeset
196 self.assertEquals(len(self.repo.heads()), 2)
b2c8c2079822 tests: add test for combining two branches using the branchmap
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 636
diff changeset
197 self.assertEquals(len(self.repo.branchheads('default')), 2)
b2c8c2079822 tests: add test for combining two branches using the branchmap
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 636
diff changeset
198
b2c8c2079822 tests: add test for combining two branches using the branchmap
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 636
diff changeset
199 # test that the mapping does not affect branch info
b2c8c2079822 tests: add test for combining two branches using the branchmap
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 636
diff changeset
200 branches = self.repo.svnmeta().branches
b2c8c2079822 tests: add test for combining two branches using the branchmap
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 636
diff changeset
201 self.assertEquals(sorted(branches.keys()),
b2c8c2079822 tests: add test for combining two branches using the branchmap
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 636
diff changeset
202 [None, 'badname', 'feature'])
b2c8c2079822 tests: add test for combining two branches using the branchmap
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 636
diff changeset
203
b2c8c2079822 tests: add test for combining two branches using the branchmap
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 636
diff changeset
204 def test_branchmap_combine_stupid(self):
b2c8c2079822 tests: add test for combining two branches using the branchmap
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 636
diff changeset
205 '''test combining two branches, but retaining heads (stupid)'''
b2c8c2079822 tests: add test for combining two branches using the branchmap
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 636
diff changeset
206 self.test_branchmap_combine(True)
b2c8c2079822 tests: add test for combining two branches using the branchmap
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 636
diff changeset
207
641
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
208 def test_branchmap_rebuildmeta(self, stupid=False):
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
209 '''test rebuildmeta on a branchmapped clone'''
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
210 test_util.load_svndump_fixture(self.repo_path, 'branchmap.svndump')
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
211 branchmap = open(self.branchmap, 'w')
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
212 branchmap.write("badname = dit\n")
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
213 branchmap.write("feature = dah\n")
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
214 branchmap.close()
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
215 ui = self.ui(stupid)
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
216 ui.setconfig('hgsubversion', 'branchmap', self.branchmap)
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
217 commands.clone(ui, test_util.fileurl(self.repo_path),
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
218 self.wc_path, branchmap=self.branchmap)
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
219 originfo = self.repo.svnmeta().branches
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
220
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
221 # clone & rebuild
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
222 ui = self.ui(stupid)
816
86d124a8768e Fix hg.clone() calls changed by d976542986d2
Patrick Mezard <pmezard@gmail.com>
parents: 770
diff changeset
223 src, dest = test_util.hgclone(ui, self.wc_path, self.wc_path + '_clone',
86d124a8768e Fix hg.clone() calls changed by d976542986d2
Patrick Mezard <pmezard@gmail.com>
parents: 770
diff changeset
224 update=False)
641
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
225 svncommands.rebuildmeta(ui, dest,
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
226 args=[test_util.fileurl(self.repo_path)])
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
227
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
228 # just check the keys; assume the contents are unaffected by the branch
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
229 # map and thus properly tested by other tests
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
230 self.assertEquals(sorted(src.svnmeta().branches),
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
231 sorted(dest.svnmeta().branches))
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
232
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
233 def test_branchmap_rebuildmeta_stupid(self):
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
234 '''test rebuildmeta on a branchmapped clone (stupid)'''
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
235 self.test_branchmap_rebuildmeta(True)
67513cca972f rebuildmeta: handle mapped branch names.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 639
diff changeset
236
702
841399d10c79 verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 643
diff changeset
237 def test_branchmap_verify(self, stupid=False):
841399d10c79 verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 643
diff changeset
238 '''test verify on a branchmapped clone'''
841399d10c79 verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 643
diff changeset
239 test_util.load_svndump_fixture(self.repo_path, 'branchmap.svndump')
841399d10c79 verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 643
diff changeset
240 branchmap = open(self.branchmap, 'w')
841399d10c79 verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 643
diff changeset
241 branchmap.write("badname = dit\n")
841399d10c79 verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 643
diff changeset
242 branchmap.write("feature = dah\n")
841399d10c79 verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 643
diff changeset
243 branchmap.close()
841399d10c79 verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 643
diff changeset
244 ui = self.ui(stupid)
841399d10c79 verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 643
diff changeset
245 ui.setconfig('hgsubversion', 'branchmap', self.branchmap)
841399d10c79 verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 643
diff changeset
246 commands.clone(ui, test_util.fileurl(self.repo_path),
841399d10c79 verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 643
diff changeset
247 self.wc_path, branchmap=self.branchmap)
841399d10c79 verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 643
diff changeset
248 repo = self.repo
841399d10c79 verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 643
diff changeset
249
841399d10c79 verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 643
diff changeset
250 for r in repo:
841399d10c79 verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 643
diff changeset
251 self.assertEquals(svncommands.verify(ui, repo, rev=r), 0)
841399d10c79 verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 643
diff changeset
252
841399d10c79 verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 643
diff changeset
253 def test_branchmap_verify_stupid(self):
841399d10c79 verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 643
diff changeset
254 '''test verify on a branchmapped clone (stupid)'''
841399d10c79 verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 643
diff changeset
255 self.test_branchmap_verify(True)
841399d10c79 verify: fix verifying mapped branches.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 643
diff changeset
256
636
d4f433ee709a branchmap: reject empty mappings
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 635
diff changeset
257 def test_branchmap_no_replacement(self):
d4f433ee709a branchmap: reject empty mappings
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 635
diff changeset
258 '''
d4f433ee709a branchmap: reject empty mappings
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 635
diff changeset
259 test that empty mappings are rejected
d4f433ee709a branchmap: reject empty mappings
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 635
diff changeset
260
d4f433ee709a branchmap: reject empty mappings
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 635
diff changeset
261 Empty mappings are lines like 'this ='. The most sensible thing to do
d4f433ee709a branchmap: reject empty mappings
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 635
diff changeset
262 is to not convert the 'this' branches. Until we can do that, we settle
d4f433ee709a branchmap: reject empty mappings
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 635
diff changeset
263 with aborting.
d4f433ee709a branchmap: reject empty mappings
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 635
diff changeset
264 '''
d4f433ee709a branchmap: reject empty mappings
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 635
diff changeset
265 test_util.load_svndump_fixture(self.repo_path, 'propset-branch.svndump')
d4f433ee709a branchmap: reject empty mappings
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 635
diff changeset
266 branchmap = open(self.branchmap, 'w')
d4f433ee709a branchmap: reject empty mappings
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 635
diff changeset
267 branchmap.write("closeme =\n")
d4f433ee709a branchmap: reject empty mappings
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 635
diff changeset
268 branchmap.close()
d4f433ee709a branchmap: reject empty mappings
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 635
diff changeset
269 self.assertRaises(hgutil.Abort,
d4f433ee709a branchmap: reject empty mappings
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 635
diff changeset
270 maps.BranchMap, self.ui(), self.branchmap)
d4f433ee709a branchmap: reject empty mappings
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 635
diff changeset
271
729
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
272 def test_tagmap(self, stupid=False):
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
273 test_util.load_svndump_fixture(self.repo_path,
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
274 'basic_tag_tests.svndump')
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
275 tagmap = open(self.tagmap, 'w')
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
276 tagmap.write("tag_r3 = 3.x # stuffy\n")
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
277 tagmap.write("copied_tag = \n")
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
278 tagmap.close()
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
279
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
280 ui = self.ui(stupid)
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
281 ui.setconfig('hgsubversion', 'tagmap', self.tagmap)
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
282 commands.clone(ui, test_util.fileurl(self.repo_path),
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
283 self.wc_path, tagmap=self.tagmap)
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
284 tags = self.repo.tags()
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
285 assert 'tag_r3' not in tags
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
286 assert '3.x' in tags
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
287 assert 'copied_tag' not in tags
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
288
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
289 def test_tagmap_stupid(self):
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
290 self.test_tagmap(True)
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
291
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
292 def test_tagren_changed(self, stupid=False):
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
293 test_util.load_svndump_fixture(self.repo_path,
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
294 'commit-to-tag.svndump')
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
295 tagmap = open(self.tagmap, 'w')
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
296 tagmap.write("edit-at-create = edit-past\n")
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
297 tagmap.write("also-edit = \n")
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
298 tagmap.write("will-edit = edit-future\n")
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
299 tagmap.close()
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
300
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
301 ui = self.ui(stupid)
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
302 ui.setconfig('hgsubversion', 'tagmap', self.tagmap)
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
303 commands.clone(ui, test_util.fileurl(self.repo_path),
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
304 self.wc_path, tagmap=self.tagmap)
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
305 tags = self.repo.tags()
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
306
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
307 def test_tagren_changed_stupid(self):
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
308 self.test_tagren_changed(True)
467b95348e6a implement tag renames
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 702
diff changeset
309
769
cc1d4aa3ba41 configurable substitution for empty commit message (fixes #195)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 768
diff changeset
310 def test_empty_log_message(self, stupid=False):
cc1d4aa3ba41 configurable substitution for empty commit message (fixes #195)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 768
diff changeset
311 repo = self._load_fixture_and_fetch('empty-log-message.svndump',
cc1d4aa3ba41 configurable substitution for empty commit message (fixes #195)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 768
diff changeset
312 stupid=stupid)
cc1d4aa3ba41 configurable substitution for empty commit message (fixes #195)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 768
diff changeset
313
770
4dfc41b15d9a make the default substition for an empty commit description the empty string
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 769
diff changeset
314 self.assertEqual(repo['tip'].description(), '')
769
cc1d4aa3ba41 configurable substitution for empty commit message (fixes #195)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 768
diff changeset
315
cc1d4aa3ba41 configurable substitution for empty commit message (fixes #195)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 768
diff changeset
316 test_util.rmtree(self.wc_path)
cc1d4aa3ba41 configurable substitution for empty commit message (fixes #195)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 768
diff changeset
317
cc1d4aa3ba41 configurable substitution for empty commit message (fixes #195)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 768
diff changeset
318 ui = self.ui(stupid)
cc1d4aa3ba41 configurable substitution for empty commit message (fixes #195)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 768
diff changeset
319 ui.setconfig('hgsubversion', 'defaultmessage', 'blyf')
cc1d4aa3ba41 configurable substitution for empty commit message (fixes #195)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 768
diff changeset
320 commands.clone(ui, test_util.fileurl(self.repo_path), self.wc_path)
cc1d4aa3ba41 configurable substitution for empty commit message (fixes #195)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 768
diff changeset
321
cc1d4aa3ba41 configurable substitution for empty commit message (fixes #195)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 768
diff changeset
322 self.assertEqual(self.repo['tip'].description(), 'blyf')
cc1d4aa3ba41 configurable substitution for empty commit message (fixes #195)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 768
diff changeset
323
cc1d4aa3ba41 configurable substitution for empty commit message (fixes #195)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 768
diff changeset
324
cc1d4aa3ba41 configurable substitution for empty commit message (fixes #195)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 768
diff changeset
325 def test_empty_log_message_stupid(self):
cc1d4aa3ba41 configurable substitution for empty commit message (fixes #195)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 768
diff changeset
326 self.test_empty_log_message(True)
cc1d4aa3ba41 configurable substitution for empty commit message (fixes #195)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 768
diff changeset
327
168
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
328 def suite():
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
329 return unittest.TestLoader().loadTestsFromTestCase(MapTests)