annotate tests/test_push_command.py @ 35:ef5d7a7aabb0

I meant ambiguous.
author Augie Fackler <durin42@gmail.com>
date Fri, 17 Oct 2008 22:48:40 -0500
parents b66ed66c82e4
children d87b57c719f0
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
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
3 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
4 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
5
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 from mercurial import context
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 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
8 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
9 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
10 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
11
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 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
13 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
14 import test_util
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
15 # 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
16 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
17 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
18 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
19 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
20 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
21 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
22 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
23 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
24
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
25 if push_works:
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 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
27 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
28 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
29 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
30 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
31 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
32 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
33 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
34 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
35 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
36
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
37 # 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
38 @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
39 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
40 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
41
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
42 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
43 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
44 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
45
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
46 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
47 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
48 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
49 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
50 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
51 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
52 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
53 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
54 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
55 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
56 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
57 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
58 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
59 (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
60 '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
61 ['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
62 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
63 '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
64 '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
65 {'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
66 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
67 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
68 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
69 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
70 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
71 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
72 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
73 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
74 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
75 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
76 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
77 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
78
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
79 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
80 # 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
81 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
82 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
83 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
84 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
85 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
86 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
87 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
88 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
89 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
90 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
91 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
92 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
93 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
94 (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
95 '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
96 ['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
97 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
98 '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
99 '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
100 {'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
101 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
102 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
103 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
104 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
105 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
106 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
107 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
108 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
109 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
110 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
111 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
112 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
113 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
114 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
115 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
116 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
117 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
118 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
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 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
121 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
122 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
123 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
124 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
125 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
126 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
127 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
128 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
129 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
130 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
131 (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
132 '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
133 ['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
134 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
135 '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
136 '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
137 {'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
138 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
139 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
140 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
141 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
142 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
143 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
144 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
145
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
146 #
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
147 # def test_delete_file(self):
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 # assert False
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
149 #
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
150 # def test_push_executable_file(self):
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
151 # assert False
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
152 #
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
153 # def test_push_symlink_file(self):
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
154 # assert False
27
b66ed66c82e4 Fix this so the tests can still be run without nose.
Augie Fackler <durin42@gmail.com>
parents: 24
diff changeset
155 else:
b66ed66c82e4 Fix this so the tests can still be run without nose.
Augie Fackler <durin42@gmail.com>
parents: 24
diff changeset
156 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
157 """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
158 """
b66ed66c82e4 Fix this so the tests can still be run without nose.
Augie Fackler <durin42@gmail.com>
parents: 24
diff changeset
159 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
160
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
161 def suite():
27
b66ed66c82e4 Fix this so the tests can still be run without nose.
Augie Fackler <durin42@gmail.com>
parents: 24
diff changeset
162 return unittest.TestLoader().loadTestsFromTestCase(PushTests)
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
163