annotate tests/test_push_command.py @ 78:072010a271c6

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