annotate tests/test_push_renames.py @ 92:7486c6f6cccc

svnwrap: Fix handling of auth providers so cached credentials can work. Also fixed things so that svn 1.6 should enable platform-specific auth providers.
author Augie Fackler <durin42@gmail.com>
date Wed, 19 Nov 2008 09:41:09 -0600
parents 01e747937d35
children 9b5e528f67f8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
70
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
1 import sys
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
2 import unittest
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
3
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
4 import test_util
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
5
82
71de43e9f614 Extract PushTest common code into test_util.TestBase
Patrick Mezard <pmezard@gmail.com>
parents: 78
diff changeset
6 class TestPushRenames(test_util.TestBase):
70
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
7 def setUp(self):
82
71de43e9f614 Extract PushTest common code into test_util.TestBase
Patrick Mezard <pmezard@gmail.com>
parents: 78
diff changeset
8 test_util.TestBase.setUp(self)
78
072010a271c6 Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 70
diff changeset
9 test_util.load_fixture_and_fetch('pushrenames.svndump',
072010a271c6 Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 70
diff changeset
10 self.repo_path,
072010a271c6 Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 70
diff changeset
11 self.wc_path,
072010a271c6 Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 70
diff changeset
12 True)
70
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
13
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
14 def _debug_print_copies(self, ctx):
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
15 w = sys.stderr.write
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
16 for f in ctx.files():
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
17 if f not in ctx:
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
18 w('R %s\n' % f)
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
19 else:
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
20 w('U %s %r\n' % (f, ctx[f].data()))
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
21 if ctx[f].renamed():
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
22 w('%s copied from %s\n' % (f, ctx[f].renamed()[0]))
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
23
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
24 def assertchanges(self, changes, ctx):
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
25 for source, dest, data in changes:
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
26 if dest is None:
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
27 self.assertTrue(source not in ctx)
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
28 else:
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
29 self.assertTrue(dest in ctx)
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
30 if data is None:
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
31 data = ctx.parents()[0][source].data()
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
32 self.assertEqual(data, ctx[dest].data())
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
33 if dest != source:
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
34 copy = ctx[dest].renamed()
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
35 self.assertEqual(copy[0], source)
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
36
84
01e747937d35 test_util: add commitchanges() to TestBase
Patrick Mezard <pmezard@gmail.com>
parents: 82
diff changeset
37 def test_push_renames(self):
70
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
38 repo = self.repo
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
39
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
40 changes = [
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
41 # Regular copy of a single file
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
42 ('a', 'a2', None),
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
43 # Copy and update of target
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
44 ('a', 'a3', 'aa\n'),
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
45 # Regular move of a single file
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
46 ('b', 'b2', None),
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
47 ('b', None, None),
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
48 # Regular move and update of target
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
49 ('c', 'c2', 'c\nc\n'),
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
50 ('c', None, None),
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
51 # Copy and update of source and targets
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
52 ('d', 'd2', 'd\nd2\n'),
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
53 ('d', 'd', 'd\nd\n'),
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
54 # Double copy and removal (aka copy and move)
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
55 ('e', 'e2', 'e\ne2\n'),
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
56 ('e', 'e3', 'e\ne3\n'),
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
57 ('e', None, None),
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
58 ]
84
01e747937d35 test_util: add commitchanges() to TestBase
Patrick Mezard <pmezard@gmail.com>
parents: 82
diff changeset
59 self.commitchanges(changes)
01e747937d35 test_util: add commitchanges() to TestBase
Patrick Mezard <pmezard@gmail.com>
parents: 82
diff changeset
60 self.pushrevisions()
70
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
61 tip = self.repo['tip']
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
62 # self._debug_print_copies(tip)
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
63 self.assertchanges(changes, tip)
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
64
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
65 def suite():
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
66 all = [unittest.TestLoader().loadTestsFromTestCase(TestPushRenames),
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
67 ]
49b7cbe4c8e3 push_cmd: handle copies at file level
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
68 return unittest.TestSuite(all)