annotate tests/test_unaffected_core.py @ 790:3173f418079c

editor: rename add_directory() cp_f* variable into from*
author Patrick Mezard <pmezard@gmail.com>
date Wed, 09 Mar 2011 22:07:05 +0100
parents 69c0e7c4faf9
children f07bfd66db13
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
713
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
1 import test_util
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
2
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
3 import os
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
4 import unittest
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
5
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
6 from mercurial import commands
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
7 from mercurial import dispatch
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
8 from mercurial import error
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
9 from mercurial import hg
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
10 from mercurial import node
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
11 from mercurial import ui
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
12
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
13 class TestMercurialCore(test_util.TestBase):
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
14 '''
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
15 Test that the core Mercurial operations aren't broken by hgsubversion.
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
16 '''
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
17
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
18 @test_util.requiresoption('updaterev')
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
19 def test_update(self):
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
20 ''' Test 'clone --updaterev' '''
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
21 ui = self.ui()
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
22 dispatch._dispatch(ui, ['init', self.wc_path])
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
23 repo = self.repo
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
24 repo.ui.setconfig('ui', 'username', 'anonymous')
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
25
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
26 fpath = os.path.join(self.wc_path, 'it')
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
27 f = file(fpath, 'w')
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
28 f.write('C1')
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
29 f.flush()
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
30 commands.add(ui, repo)
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
31 commands.commit(ui, repo, message="C1")
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
32 f.write('C2')
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
33 f.flush()
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
34 commands.commit(ui, repo, message="C2")
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
35 f.write('C3')
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
36 f.flush()
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
37 commands.commit(ui, repo, message="C3")
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
38
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
39 self.assertEqual(len(repo), 3)
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
40
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
41 updaterev = 1
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
42 dispatch._dispatch(ui, ['clone', self.wc_path, self.wc_path + '2',
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
43 '--updaterev=%s' % updaterev])
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
44
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
45 repo2 = hg.repository(ui, self.wc_path + '2')
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
46
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
47 self.assertEqual(str(repo[updaterev]), str(repo2['.']))
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
48
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
49 @test_util.requiresoption('branch')
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
50 def test_branch(self):
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
51 ''' Test 'clone --branch' '''
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
52 ui = self.ui()
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
53 dispatch._dispatch(ui, ['init', self.wc_path])
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
54 repo = self.repo
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
55 repo.ui.setconfig('ui', 'username', 'anonymous')
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
56
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
57 fpath = os.path.join(self.wc_path, 'it')
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
58 f = file(fpath, 'w')
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
59 f.write('C1')
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
60 f.flush()
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
61 commands.add(ui, repo)
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
62 commands.branch(ui, repo, label="B1")
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
63 commands.commit(ui, repo, message="C1")
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
64 f.write('C2')
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
65 f.flush()
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
66 commands.branch(ui, repo, label="default")
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
67 commands.commit(ui, repo, message="C2")
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
68 f.write('C3')
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
69 f.flush()
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
70 commands.branch(ui, repo, label="B2")
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
71 commands.commit(ui, repo, message="C3")
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
72
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
73 self.assertEqual(len(repo), 3)
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
74
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
75 branch = 'B1'
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
76 dispatch._dispatch(ui, ['clone', self.wc_path, self.wc_path + '2',
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
77 '--branch', branch])
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
78
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
79 repo2 = hg.repository(ui, self.wc_path + '2')
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
80
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
81 self.assertEqual(repo[branch].hex(), repo2['.'].hex())
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
82
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
83 def suite():
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
84 all = [unittest.TestLoader().loadTestsFromTestCase(TestMercurialCore)]
69c0e7c4faf9 clone: call the wrapped function (fixes #181)
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
85 return unittest.TestSuite(all)