annotate tests/test_push_command.py @ 49:2bc4999a89d3

Add tests for a bunch more cases in pushing to svn.
author Augie Fackler <durin42@gmail.com>
date Wed, 29 Oct 2008 22:58:52 -0500
parents d87b57c719f0
children 80b923ab242b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
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:
diff changeset
1 import os
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:
diff changeset
2 import shutil
48
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
3 import socket
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:
diff changeset
4 import tempfile
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:
diff changeset
5 import unittest
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:
diff changeset
6
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:
diff changeset
7 from mercurial import context
48
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
8 from mercurial import commands
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:
diff changeset
9 from mercurial import hg
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:
diff changeset
10 from mercurial import node
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:
diff changeset
11 from mercurial import ui
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:
diff changeset
12 from mercurial import revlog
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:
diff changeset
13
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:
diff changeset
14 import fetch_command
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:
diff changeset
15 import push_cmd
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:
diff changeset
16 import test_util
48
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
17 import time
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
18
24
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
19 # push fails in 1.4-SWIG-land.
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
20 push_works = False
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
21 try:
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
22 import csvn
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
23 push_works = True
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
24 except ImportError:
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
25 from svn import core
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
26 if (core.SVN_VER_MAJOR, core.SVN_VER_MINOR, core.SVN_VER_MICRO) >= (1, 5, 0):
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
27 push_works = True
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:
diff changeset
28
24
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
29 if push_works:
48
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
30 class PushOverSvnserveTests(unittest.TestCase):
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
31 def setUp(self):
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
32 self.oldwd = os.getcwd()
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
33 self.tmpdir = tempfile.mkdtemp('svnwrap_test')
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
34 self.repo_path = '%s/testrepo' % self.tmpdir
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
35 self.wc_path = '%s/testrepo_wc' % self.tmpdir
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
36 test_util.load_svndump_fixture(self.repo_path, 'simple_branch.svndump')
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
37 open(os.path.join(self.repo_path, 'conf', 'svnserve.conf'),
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
38 'w').write('[general]\nanon-access=write\n[sasl]\n')
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
39 # Paranoia: we try and connect to localhost on 3689 before we start
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
40 # svnserve. If it is running, we force the test to fail early.
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
41 user_has_own_svnserve = False
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
42 try:
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
43 s = socket.socket()
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
44 s.settimeout(0.3)
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
45 s.connect(('localhost', 3690))
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
46 s.close()
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
47 user_has_own_svnserve = True
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
48 except:
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
49 pass
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
50 if user_has_own_svnserve:
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
51 assert False, ('You appear to be running your own svnserve!'
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
52 ' You can probably ignore this test failure.')
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
53 args = ['svnserve', '-d', '--foreground', '-r', self.repo_path]
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
54 self.svnserve_pid = os.spawnvp(os.P_NOWAIT, 'svnserve', args)
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
55 time.sleep(2)
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
56 fetch_command.fetch_revisions(ui.ui(),
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
57 svn_url='svn://localhost/',
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
58 hg_repo_path=self.wc_path)
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
59
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
60 def tearDown(self):
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
61 shutil.rmtree(self.tmpdir)
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
62 os.chdir(self.oldwd)
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
63 os.system('kill -9 %d' % self.svnserve_pid)
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
64
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
65 # define this as a property so that it reloads anytime we need it
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
66 @property
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
67 def repo(self):
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
68 return hg.repository(ui.ui(), self.wc_path)
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
69
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
70 def test_push_to_default(self, commit=True):
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
71 repo = self.repo
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
72 old_tip = repo['tip'].node()
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
73 expected_parent = repo['default'].node()
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
74 def file_callback(repo, memctx, path):
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
75 if path == 'adding_file':
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
76 return context.memfilectx(path=path,
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
77 data='foo',
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
78 islink=False,
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
79 isexec=False,
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
80 copied=False)
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
81 raise IOError()
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
82 ctx = context.memctx(repo,
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
83 (repo['default'].node(), node.nullid),
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
84 'automated test',
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
85 ['adding_file'],
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
86 file_callback,
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
87 'an_author',
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
88 '2008-10-07 20:59:48 -0500',
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
89 {'branch': 'default',})
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
90 new_hash = repo.commitctx(ctx)
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
91 if not commit:
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
92 return # some tests use this test as an extended setup.
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
93 hg.update(repo, repo['tip'].node())
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
94 push_cmd.push_revisions_to_subversion(ui.ui(), repo=self.repo,
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
95 hg_repo_path=self.wc_path,
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
96 svn_url='svn://localhost/')
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
97 tip = self.repo['tip']
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
98 self.assertNotEqual(tip.node(), old_tip)
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
99 self.assertEqual(tip.parents()[0].node(), expected_parent)
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
100 self.assertEqual(tip['adding_file'].data(), 'foo')
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
101 self.assertEqual(tip.branch(), 'default')
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
102
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
103
24
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
104 class PushTests(unittest.TestCase):
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
105 def setUp(self):
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
106 self.oldwd = os.getcwd()
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
107 self.tmpdir = tempfile.mkdtemp('svnwrap_test')
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
108 self.repo_path = '%s/testrepo' % self.tmpdir
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
109 self.wc_path = '%s/testrepo_wc' % self.tmpdir
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
110 test_util.load_svndump_fixture(self.repo_path, 'simple_branch.svndump')
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
111 fetch_command.fetch_revisions(ui.ui(),
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
112 svn_url='file://%s' % self.repo_path,
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
113 hg_repo_path=self.wc_path)
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:
diff changeset
114
24
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
115 # define this as a property so that it reloads anytime we need it
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
116 @property
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
117 def repo(self):
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
118 return hg.repository(ui.ui(), self.wc_path)
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:
diff changeset
119
24
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
120 def tearDown(self):
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
121 shutil.rmtree(self.tmpdir)
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
122 os.chdir(self.oldwd)
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:
diff changeset
123
24
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
124 def test_push_to_default(self, commit=True):
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
125 repo = self.repo
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
126 old_tip = repo['tip'].node()
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
127 expected_parent = repo['default'].node()
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
128 def file_callback(repo, memctx, path):
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
129 if path == 'adding_file':
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
130 return context.memfilectx(path=path,
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
131 data='foo',
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
132 islink=False,
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
133 isexec=False,
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
134 copied=False)
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
135 raise IOError()
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
136 ctx = context.memctx(repo,
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
137 (repo['default'].node(), node.nullid),
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
138 'automated test',
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
139 ['adding_file'],
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
140 file_callback,
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
141 'an_author',
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
142 '2008-10-07 20:59:48 -0500',
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
143 {'branch': 'default',})
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
144 new_hash = repo.commitctx(ctx)
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
145 if not commit:
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
146 return # some tests use this test as an extended setup.
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
147 hg.update(repo, repo['tip'].node())
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
148 push_cmd.push_revisions_to_subversion(ui.ui(), repo=self.repo,
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
149 hg_repo_path=self.wc_path,
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
150 svn_url='file://'+self.repo_path)
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
151 tip = self.repo['tip']
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
152 self.assertNotEqual(tip.node(), old_tip)
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
153 self.assertEqual(tip.parents()[0].node(), expected_parent)
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
154 self.assertEqual(tip['adding_file'].data(), 'foo')
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
155 self.assertEqual(tip.branch(), 'default')
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:
diff changeset
156
24
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
157 def test_push_two_revs(self):
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
158 # set up some work for us
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
159 self.test_push_to_default(commit=False)
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
160 repo = self.repo
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
161 old_tip = repo['tip'].node()
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
162 expected_parent = repo['tip'].parents()[0].node()
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
163 def file_callback(repo, memctx, path):
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
164 if path == 'adding_file2':
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
165 return context.memfilectx(path=path,
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
166 data='foo2',
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
167 islink=False,
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
168 isexec=False,
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
169 copied=False)
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
170 raise IOError()
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
171 ctx = context.memctx(repo,
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
172 (repo['default'].node(), node.nullid),
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
173 'automated test',
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
174 ['adding_file2'],
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
175 file_callback,
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
176 'an_author',
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
177 '2008-10-07 20:59:48 -0500',
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
178 {'branch': 'default',})
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
179 new_hash = repo.commitctx(ctx)
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
180 hg.update(repo, repo['tip'].node())
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
181 push_cmd.push_revisions_to_subversion(ui.ui(), repo=self.repo,
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
182 hg_repo_path=self.wc_path,
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
183 svn_url='file://'+self.repo_path)
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
184 tip = self.repo['tip']
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
185 self.assertNotEqual(tip.node(), old_tip)
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
186 self.assertNotEqual(tip.parents()[0].node(), old_tip)
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
187 self.assertEqual(tip.parents()[0].parents()[0].node(), expected_parent)
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
188 self.assertEqual(tip['adding_file2'].data(), 'foo2')
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
189 self.assertEqual(tip['adding_file'].data(), 'foo')
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
190 self.assertEqual(tip.parents()[0]['adding_file'].data(), 'foo')
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
191 try:
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
192 self.assertEqual(tip.parents()[0]['adding_file2'].data(), 'foo')
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
193 assert False, "this is impossible, adding_file2 should not be in this manifest."
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
194 except revlog.LookupError, e:
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
195 pass
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
196 self.assertEqual(tip.branch(), 'default')
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:
diff changeset
197
24
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
198 def test_push_to_branch(self):
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
199 repo = self.repo
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
200 def file_callback(repo, memctx, path):
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
201 if path == 'adding_file':
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
202 return context.memfilectx(path=path,
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
203 data='foo',
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
204 islink=False,
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
205 isexec=False,
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
206 copied=False)
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
207 raise IOError()
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
208 ctx = context.memctx(repo,
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
209 (repo['the_branch'].node(), node.nullid),
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
210 'automated test',
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
211 ['adding_file'],
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
212 file_callback,
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
213 'an_author',
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
214 '2008-10-07 20:59:48 -0500',
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
215 {'branch': 'the_branch',})
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
216 new_hash = repo.commitctx(ctx)
48
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
217 #commands.update(ui.ui(), self.repo, node='tip')
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
218 hg.update(repo, repo['tip'].node())
24
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
219 push_cmd.push_revisions_to_subversion(ui.ui(), repo=self.repo,
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
220 hg_repo_path=self.wc_path,
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
221 svn_url='file://'+self.repo_path)
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
222 tip = self.repo['tip']
48
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
223 self.assertNotEqual(tip.node(), new_hash)
24
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
224 self.assertEqual(tip['adding_file'].data(), 'foo')
5954a514ae26 Pushing fails in 1.4's SWIG bindings, so double check for that in the test.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
225 self.assertEqual(tip.branch(), 'the_branch')
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:
diff changeset
226
48
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
227 def test_delete_file(self):
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
228 repo = self.repo
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
229 def file_callback(repo, memctx, path):
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
230 raise IOError()
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
231 old_files = set(repo['default'].manifest().keys())
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
232 ctx = context.memctx(repo,
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
233 (repo['default'].node(), node.nullid),
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
234 'automated test',
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
235 ['alpha'],
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
236 file_callback,
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
237 'an author',
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
238 '2008-10-29 21:26:00 -0500',
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
239 {'branch': 'default', })
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
240 new_hash = repo.commitctx(ctx)
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
241 hg.update(repo, repo['tip'].node())
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
242 push_cmd.push_revisions_to_subversion(ui.ui(), repo=self.repo,
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
243 hg_repo_path=self.wc_path,
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
244 svn_url='file://' + self.repo_path)
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
245 tip = self.repo['tip']
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
246 self.assertEqual(old_files,
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
247 set(tip.manifest().keys() + ['alpha']))
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
248 self.assert_('alpha' not in tip.manifest())
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
249
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
250 def test_push_executable_file(self):
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
251 self.test_push_to_default(commit=True)
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
252 repo = self.repo
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
253 def file_callback(repo, memctx, path):
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
254 if path == 'gamma':
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
255 return context.memfilectx(path=path,
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
256 data='foo',
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
257 islink=False,
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
258 isexec=True,
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
259 copied=False)
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
260 raise IOError()
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
261 ctx = context.memctx(repo,
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
262 (repo['tip'].node(), node.nullid),
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
263 'message',
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
264 ['gamma', ],
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
265 file_callback,
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
266 'author',
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
267 '2008-10-29 21:26:00 -0500',
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
268 {'branch': 'default', })
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
269 new_hash = repo.commitctx(ctx)
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
270 hg.update(repo, repo['tip'].node())
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
271 push_cmd.push_revisions_to_subversion(ui.ui(), repo=self.repo,
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
272 hg_repo_path=self.wc_path,
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
273 svn_url='file://' + self.repo_path)
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
274 tip = self.repo['tip']
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
275 self.assertNotEqual(tip.node(), new_hash)
49
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
276 self.assert_('@' in tip.user())
48
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
277 self.assertEqual(tip['gamma'].flags(), 'x')
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
278 self.assertEqual(tip['gamma'].data(), 'foo')
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
279 self.assertEqual([x for x in tip.manifest().keys() if 'x' not in
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
280 tip[x].flags()], ['alpha', 'beta', 'adding_file', ])
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
281
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
282 def test_push_symlink_file(self):
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
283 self.test_push_to_default(commit=True)
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
284 repo = self.repo
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
285 def file_callback(repo, memctx, path):
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
286 if path == 'gamma':
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
287 return context.memfilectx(path=path,
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
288 data='foo',
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
289 islink=True,
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
290 isexec=False,
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
291 copied=False)
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
292 raise IOError()
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
293 ctx = context.memctx(repo,
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
294 (repo['tip'].node(), node.nullid),
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
295 'message',
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
296 ['gamma', ],
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
297 file_callback,
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
298 'author',
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
299 '2008-10-29 21:26:00 -0500',
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
300 {'branch': 'default', })
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
301 new_hash = repo.commitctx(ctx)
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
302 hg.update(repo, repo['tip'].node())
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
303 push_cmd.push_revisions_to_subversion(ui.ui(), repo=self.repo,
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
304 hg_repo_path=self.wc_path,
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
305 svn_url='file://' + self.repo_path)
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
306 tip = self.repo['tip']
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
307 self.assertNotEqual(tip.node(), new_hash)
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
308 self.assertEqual(tip['gamma'].flags(), 'l')
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
309 self.assertEqual(tip['gamma'].data(), 'foo')
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
310 self.assertEqual([x for x in tip.manifest().keys() if 'l' not in
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
311 tip[x].flags()], ['alpha', 'beta', 'adding_file', ])
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
312
49
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
313 def test_push_with_new_dir(self):
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
314 self.test_push_to_default(commit=True)
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
315 repo = self.repo
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
316 def file_callback(repo, memctx, path):
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
317 if path == 'newdir/gamma':
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
318 return context.memfilectx(path=path,
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
319 data='foo',
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
320 islink=False,
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
321 isexec=False,
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
322 copied=False)
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
323 raise IOError()
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
324 ctx = context.memctx(repo,
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
325 (repo['tip'].node(), node.nullid),
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
326 'message',
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
327 ['newdir/gamma', ],
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
328 file_callback,
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
329 'author',
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
330 '2008-10-29 21:26:00 -0500',
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
331 {'branch': 'default', })
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
332 new_hash = repo.commitctx(ctx)
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
333 hg.update(repo, repo['tip'].node())
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
334 push_cmd.push_revisions_to_subversion(ui.ui(), repo=self.repo,
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
335 hg_repo_path=self.wc_path,
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
336 svn_url='file://' + self.repo_path)
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
337 tip = self.repo['tip']
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
338 self.assertNotEqual(tip.node(), new_hash)
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
339 self.assertEqual(tip['newdir/gamma'].data(), 'foo')
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
340
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
341 def test_push_existing_file_newly_execute(self, execute=True,
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
342 link=False, expected_flags='x'):
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
343 self.test_push_to_default()
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
344 repo = self.repo
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
345 def file_callback(repo, memctx, path):
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
346 return context.memfilectx(path=path,
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
347 data='foo',
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
348 islink=link,
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
349 isexec=execute,
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
350 copied=False)
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
351 ctx = context.memctx(repo,
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
352 (repo['default'].node(), node.nullid),
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
353 'message',
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
354 ['alpha', ],
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
355 file_callback,
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
356 'author',
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
357 '2008-1-1 00:00:00 -0500',
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
358 {'branch': 'default', })
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
359 new_hash = repo.commitctx(ctx)
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
360 hg.update(repo, repo['tip'].node())
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
361 push_cmd.push_revisions_to_subversion(ui.ui(), repo=self.repo,
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
362 hg_repo_path=self.wc_path,
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
363 svn_url='file://' + self.repo_path)
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
364 tip = self.repo['tip']
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
365 self.assertNotEqual(tip.node(), new_hash)
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
366 self.assertEqual(tip['alpha'].data(), 'foo')
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
367 self.assertEqual(tip.parents()[0]['alpha'].flags(), '')
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
368 self.assertEqual(tip['alpha'].flags(), expected_flags)
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
369 # while we're here, double check pushing an already-executable file
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
370 # works
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
371 repo = self.repo
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
372 def file_callback(repo, memctx, path):
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
373 return context.memfilectx(path=path,
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
374 data='bar',
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
375 islink=link,
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
376 isexec=execute,
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
377 copied=False)
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
378 ctx = context.memctx(repo,
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
379 (repo['default'].node(), node.nullid),
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
380 'message',
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
381 ['alpha', ],
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
382 file_callback,
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
383 'author',
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
384 '2008-1-1 00:00:00 -0500',
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
385 {'branch': 'default', })
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
386 new_hash = repo.commitctx(ctx)
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
387 hg.update(repo, repo['tip'].node())
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
388 push_cmd.push_revisions_to_subversion(ui.ui(), repo=self.repo,
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
389 hg_repo_path=self.wc_path,
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
390 svn_url='file://' + self.repo_path)
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
391 tip = self.repo['tip']
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
392 self.assertNotEqual(tip.node(), new_hash)
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
393 self.assertEqual(tip['alpha'].data(), 'bar')
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
394 self.assertEqual(tip.parents()[0]['alpha'].flags(), expected_flags)
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
395 self.assertEqual(tip['alpha'].flags(), expected_flags)
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
396
27
b66ed66c82e4 Fix this so the tests can still be run without nose.
Augie Fackler <durin42@gmail.com>
parents: 24
diff changeset
397 else:
b66ed66c82e4 Fix this so the tests can still be run without nose.
Augie Fackler <durin42@gmail.com>
parents: 24
diff changeset
398 class PushTests(unittest.TestCase):
b66ed66c82e4 Fix this so the tests can still be run without nose.
Augie Fackler <durin42@gmail.com>
parents: 24
diff changeset
399 """Dummy so the test runner doesn't get upset.
b66ed66c82e4 Fix this so the tests can still be run without nose.
Augie Fackler <durin42@gmail.com>
parents: 24
diff changeset
400 """
b66ed66c82e4 Fix this so the tests can still be run without nose.
Augie Fackler <durin42@gmail.com>
parents: 24
diff changeset
401 pass
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:
diff changeset
402
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:
diff changeset
403 def suite():
48
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
404 test_classes = [PushTests, PushOverSvnserveTests]
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
405 tests = []
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
406 # This is the quickest hack I could come up with to load all the tests from
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
407 # both classes. Would love a patch that simplifies this without adding
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
408 # dependencies.
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
409 for tc in test_classes:
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
410 for attr in dir(tc):
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
411 if attr.startswith('test_'):
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
412 tests.append(tc(attr))
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
413 return unittest.TestSuite(tests)