annotate tests/test_push_command.py @ 337:46e69be8e2c8

Reorganize to have a more conventional module structure. This means that hgsubversion now uses absolute imports instead of relative ones, which makes the tests more reliable.
author Augie Fackler <durin42@gmail.com>
date Wed, 13 May 2009 21:39:39 -0500
parents c0b943cef0c3
children 88ba55ad58c0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
331
75f082b5897e Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 277
diff changeset
1 import atexit
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
2 import os
331
75f082b5897e Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 277
diff changeset
3 import random
48
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
4 import socket
78
072010a271c6 Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 65
diff changeset
5 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
6 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
7
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 context
331
75f082b5897e Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 277
diff changeset
9 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
10 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
11 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
12 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
13 from mercurial import revlog
277
3848a7f9b983 push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents: 257
diff changeset
14 from mercurial import util as hgutil
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
15
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
82
71de43e9f614 Extract PushTest common code into test_util.TestBase
Patrick Mezard <pmezard@gmail.com>
parents: 80
diff changeset
20 class PushTests(test_util.TestBase):
50
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
21 def setUp(self):
82
71de43e9f614 Extract PushTest common code into test_util.TestBase
Patrick Mezard <pmezard@gmail.com>
parents: 80
diff changeset
22 test_util.TestBase.setUp(self)
78
072010a271c6 Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 65
diff changeset
23 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
24 self.repo_path,
072010a271c6 Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 65
diff changeset
25 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
26
220
06eb60f9a026 push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents: 150
diff changeset
27 def test_cant_push_empty_ctx(self):
06eb60f9a026 push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents: 150
diff changeset
28 repo = self.repo
06eb60f9a026 push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents: 150
diff changeset
29 def file_callback(repo, memctx, path):
06eb60f9a026 push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents: 150
diff changeset
30 if path == 'adding_file':
06eb60f9a026 push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents: 150
diff changeset
31 return context.memfilectx(path=path,
06eb60f9a026 push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents: 150
diff changeset
32 data='foo',
06eb60f9a026 push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents: 150
diff changeset
33 islink=False,
06eb60f9a026 push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents: 150
diff changeset
34 isexec=False,
06eb60f9a026 push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents: 150
diff changeset
35 copied=False)
06eb60f9a026 push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents: 150
diff changeset
36 raise IOError()
06eb60f9a026 push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents: 150
diff changeset
37 ctx = context.memctx(repo,
06eb60f9a026 push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents: 150
diff changeset
38 (repo['default'].node(), node.nullid),
06eb60f9a026 push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents: 150
diff changeset
39 'automated test',
06eb60f9a026 push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents: 150
diff changeset
40 [],
06eb60f9a026 push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents: 150
diff changeset
41 file_callback,
06eb60f9a026 push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents: 150
diff changeset
42 'an_author',
06eb60f9a026 push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents: 150
diff changeset
43 '2008-10-07 20:59:48 -0500',
06eb60f9a026 push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents: 150
diff changeset
44 {'branch': 'default',})
06eb60f9a026 push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents: 150
diff changeset
45 new_hash = repo.commitctx(ctx)
06eb60f9a026 push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents: 150
diff changeset
46 hg.update(repo, repo['tip'].node())
06eb60f9a026 push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents: 150
diff changeset
47 old_tip = repo['tip'].node()
06eb60f9a026 push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents: 150
diff changeset
48 self.pushrevisions()
06eb60f9a026 push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents: 150
diff changeset
49 tip = self.repo['tip']
06eb60f9a026 push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents: 150
diff changeset
50 self.assertEqual(tip.node(), old_tip)
06eb60f9a026 push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents: 150
diff changeset
51
336
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
52 def test_push_over_svnserve(self, commit=True):
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
53 test_util.load_svndump_fixture(self.repo_path, 'simple_branch.svndump')
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
54 open(os.path.join(self.repo_path, 'conf', 'svnserve.conf'),
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
55 'w').write('[general]\nanon-access=write\n[sasl]\n')
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
56 self.port = random.randint(socket.IPPORT_USERRESERVED, 65535)
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
57 self.host = 'localhost'
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
58 args = ['svnserve', '--daemon', '--foreground',
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
59 '--listen-port=%d' % self.port,
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
60 '--listen-host=%s' % self.host,
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
61 '--root=%s' % self.repo_path]
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
62
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
63 self.svnserve_pid = subprocess.Popen(args).pid
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
64 try:
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
65 time.sleep(2)
337
46e69be8e2c8 Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents: 336
diff changeset
66 import shutil
46e69be8e2c8 Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents: 336
diff changeset
67 shutil.rmtree(self.wc_path)
336
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
68 commands.clone(ui.ui(), 'svn://%s:%d/' % (self.host, self.port),
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
69 self.wc_path, noupdate=True)
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
70
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
71 repo = self.repo
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
72 old_tip = repo['tip'].node()
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
73 expected_parent = repo['default'].node()
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
74 def file_callback(repo, memctx, path):
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
75 if path == 'adding_file':
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
76 return context.memfilectx(path=path,
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
77 data='foo',
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
78 islink=False,
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
79 isexec=False,
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
80 copied=False)
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
81 raise IOError()
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
82 ctx = context.memctx(repo,
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
83 (repo['default'].node(), node.nullid),
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
84 'automated test',
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
85 ['adding_file'],
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
86 file_callback,
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
87 'an_author',
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
88 '2008-10-07 20:59:48 -0500',
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
89 {'branch': 'default',})
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
90 new_hash = repo.commitctx(ctx)
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
91 if not commit:
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
92 return # some tests use this test as an extended setup.
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
93 hg.update(repo, repo['tip'].node())
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
94 oldauthor = repo['tip'].user()
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
95 commands.push(repo.ui, repo)
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
96 tip = self.repo['tip']
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
97 self.assertNotEqual(oldauthor, tip.user())
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
98 self.assertNotEqual(tip.node(), old_tip)
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
99 self.assertEqual(tip.parents()[0].node(), expected_parent)
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
100 self.assertEqual(tip['adding_file'].data(), 'foo')
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
101 self.assertEqual(tip.branch(), 'default')
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
102 finally:
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
103 os.kill(self.svnserve_pid, 9)
220
06eb60f9a026 push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents: 150
diff changeset
104
50
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
105 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
106 repo = self.repo
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
107 old_tip = repo['tip'].node()
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
108 expected_parent = repo['default'].node()
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
109 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
110 if path == 'adding_file':
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
111 return context.memfilectx(path=path,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
112 data='foo',
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
113 islink=False,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
114 isexec=False,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
115 copied=False)
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
116 raise IOError()
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
117 ctx = context.memctx(repo,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
118 (repo['default'].node(), node.nullid),
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
119 'automated test',
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
120 ['adding_file'],
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
121 file_callback,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
122 'an_author',
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
123 '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
124 {'branch': 'default',})
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
125 new_hash = repo.commitctx(ctx)
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
126 if not commit:
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
127 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
128 hg.update(repo, repo['tip'].node())
78
072010a271c6 Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 65
diff changeset
129 self.pushrevisions()
50
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
130 tip = self.repo['tip']
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
131 self.assertNotEqual(tip.node(), old_tip)
150
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
132 self.assertEqual(node.hex(tip.parents()[0].node()),
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
133 node.hex(expected_parent))
50
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
134 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
135 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
136
150
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
137 def test_push_two_revs_different_local_branch(self):
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
138 def filectxfn(repo, memctx, path):
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
139 return context.memfilectx(path=path,
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
140 data=path,
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
141 islink=False,
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
142 isexec=False,
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
143 copied=False)
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
144 oldtiphash = self.repo['default'].node()
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
145 ctx = context.memctx(self.repo,
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
146 (self.repo[0].node(), revlog.nullid, ),
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
147 'automated test',
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
148 ['gamma', ],
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
149 filectxfn,
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
150 'testy',
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
151 '2008-12-21 16:32:00 -0500',
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
152 {'branch': 'localbranch', })
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
153 newhash = self.repo.commitctx(ctx)
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
154 ctx = context.memctx(self.repo,
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
155 (newhash, revlog.nullid),
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
156 'automated test2',
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
157 ['delta', ],
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
158 filectxfn,
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
159 'testy',
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
160 '2008-12-21 16:32:00 -0500',
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
161 {'branch': 'localbranch', })
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
162 newhash = self.repo.commitctx(ctx)
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
163 repo = self.repo
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
164 hg.update(repo, newhash)
331
75f082b5897e Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 277
diff changeset
165 commands.push(repo.ui, repo)
150
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
166 self.assertEqual(self.repo['tip'].parents()[0].parents()[0].node(), oldtiphash)
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
167 self.assertEqual(self.repo['tip'].files(), ['delta', ])
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
168 self.assertEqual(self.repo['tip'].manifest().keys(),
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
169 ['alpha', 'beta', 'gamma', 'delta'])
58ae90a65f41 push: Improved the rebasing logic for push so that it doesn't break with
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
170
50
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
171 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
172 # 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
173 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
174 repo = self.repo
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
175 old_tip = repo['tip'].node()
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
176 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
177 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
178 if path == 'adding_file2':
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
179 return context.memfilectx(path=path,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
180 data='foo2',
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
181 islink=False,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
182 isexec=False,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
183 copied=False)
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
184 raise IOError()
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
185 ctx = context.memctx(repo,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
186 (repo['default'].node(), node.nullid),
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
187 'automated test',
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
188 ['adding_file2'],
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
189 file_callback,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
190 'an_author',
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
191 '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
192 {'branch': 'default',})
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
193 new_hash = repo.commitctx(ctx)
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
194 hg.update(repo, repo['tip'].node())
78
072010a271c6 Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 65
diff changeset
195 self.pushrevisions()
50
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
196 tip = self.repo['tip']
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
197 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
198 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
199 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
200 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
201 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
202 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
203 try:
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
204 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
205 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
206 except revlog.LookupError, e:
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
207 pass
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
208 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
209
50
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
210 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
211 repo = self.repo
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
212 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
213 if path == 'adding_file':
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
214 return context.memfilectx(path=path,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
215 data='foo',
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
216 islink=False,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
217 isexec=False,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
218 copied=False)
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
219 raise IOError()
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['the_branch'].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 ['adding_file'],
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-07 20:59:48 -0500',
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
227 {'branch': 'the_branch',})
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 #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
230 hg.update(repo, repo['tip'].node())
78
072010a271c6 Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 65
diff changeset
231 self.pushrevisions()
50
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
232 tip = self.repo['tip']
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
233 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
234 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
235 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
236
50
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
237 def test_delete_file(self):
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 raise IOError()
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
241 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
242 ctx = context.memctx(repo,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
243 (repo['default'].node(), node.nullid),
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
244 'automated test',
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
245 ['alpha'],
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
246 file_callback,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
247 'an author',
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
248 '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
249 {'branch': 'default', })
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
250 new_hash = repo.commitctx(ctx)
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
251 hg.update(repo, repo['tip'].node())
78
072010a271c6 Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 65
diff changeset
252 self.pushrevisions()
50
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
253 tip = self.repo['tip']
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
254 self.assertEqual(old_files,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
255 set(tip.manifest().keys() + ['alpha']))
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
256 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
257
50
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
258 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
259 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
260 repo = self.repo
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
261 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
262 if path == 'gamma':
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
263 return context.memfilectx(path=path,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
264 data='foo',
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
265 islink=False,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
266 isexec=True,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
267 copied=False)
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
268 raise IOError()
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
269 ctx = context.memctx(repo,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
270 (repo['tip'].node(), node.nullid),
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
271 'message',
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
272 ['gamma', ],
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
273 file_callback,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
274 'author',
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
275 '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
276 {'branch': 'default', })
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
277 new_hash = repo.commitctx(ctx)
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents: 242
diff changeset
278 hg.clean(repo, repo['tip'].node())
78
072010a271c6 Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 65
diff changeset
279 self.pushrevisions()
50
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
280 tip = self.repo['tip']
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
281 self.assertNotEqual(tip.node(), new_hash)
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents: 242
diff changeset
282 self.assert_('@' in self.repo['tip'].user())
50
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
283 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
284 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
285 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
286 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
287
50
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
288 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
289 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
290 repo = self.repo
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
291 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
292 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
293 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
294 data='foo',
50
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
295 islink=True,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
296 isexec=False,
49
2bc4999a89d3 Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents: 48
diff changeset
297 copied=False)
50
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
298 raise IOError()
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
299 ctx = context.memctx(repo,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
300 (repo['tip'].node(), node.nullid),
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
301 'message',
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
302 ['gamma', ],
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
303 file_callback,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
304 'author',
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
305 '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
306 {'branch': 'default', })
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
307 new_hash = repo.commitctx(ctx)
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
308 hg.update(repo, repo['tip'].node())
78
072010a271c6 Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 65
diff changeset
309 self.pushrevisions()
50
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
310 tip = self.repo['tip']
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
311 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
312 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
313 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
314 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
315 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
316
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
317 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
318 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
319 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
320 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
321
50
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
322 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
323 link=False, expected_flags='x'):
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
324 self.test_push_to_default()
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
325 repo = self.repo
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
326 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
327 return context.memfilectx(path=path,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
328 data='foo',
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
329 islink=link,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
330 isexec=execute,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
331 copied=False)
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
332 ctx = context.memctx(repo,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
333 (repo['default'].node(), node.nullid),
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
334 'message',
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
335 ['alpha', ],
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
336 file_callback,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
337 'author',
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
338 '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
339 {'branch': 'default', })
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
340 new_hash = repo.commitctx(ctx)
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
341 hg.update(repo, repo['tip'].node())
78
072010a271c6 Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 65
diff changeset
342 self.pushrevisions()
50
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
343 tip = self.repo['tip']
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
344 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
345 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
346 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
347 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
348 # 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
349 # works
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
350 repo = self.repo
101
a3b717e4abf5 Cleanups based on pyflakes output.
Augie Fackler <durin42@gmail.com>
parents: 83
diff changeset
351 def file_callback2(repo, memctx, path):
50
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
352 return context.memfilectx(path=path,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
353 data='bar',
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
354 islink=link,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
355 isexec=execute,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
356 copied=False)
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
357 ctx = context.memctx(repo,
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
358 (repo['default'].node(), node.nullid),
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
359 'message',
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
360 ['alpha', ],
101
a3b717e4abf5 Cleanups based on pyflakes output.
Augie Fackler <durin42@gmail.com>
parents: 83
diff changeset
361 file_callback2,
50
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
362 'author',
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
363 '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
364 {'branch': 'default', })
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
365 new_hash = repo.commitctx(ctx)
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
366 hg.update(repo, repo['tip'].node())
78
072010a271c6 Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 65
diff changeset
367 self.pushrevisions()
50
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
368 tip = self.repo['tip']
80b923ab242b Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents: 49
diff changeset
369 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
370 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
371 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
372 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
373 # 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
374 repo = self.repo
101
a3b717e4abf5 Cleanups based on pyflakes output.
Augie Fackler <durin42@gmail.com>
parents: 83
diff changeset
375 def file_callback3(repo, memctx, path):
62
cc5ebdb1e8d4 push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents: 60
diff changeset
376 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
377 data='bar',
cc5ebdb1e8d4 push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents: 60
diff changeset
378 islink=False,
cc5ebdb1e8d4 push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents: 60
diff changeset
379 isexec=False,
cc5ebdb1e8d4 push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents: 60
diff changeset
380 copied=False)
cc5ebdb1e8d4 push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents: 60
diff changeset
381 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
382 (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
383 'message',
cc5ebdb1e8d4 push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents: 60
diff changeset
384 ['alpha', ],
101
a3b717e4abf5 Cleanups based on pyflakes output.
Augie Fackler <durin42@gmail.com>
parents: 83
diff changeset
385 file_callback3,
62
cc5ebdb1e8d4 push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents: 60
diff changeset
386 'author',
cc5ebdb1e8d4 push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents: 60
diff changeset
387 '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
388 {'branch': 'default', })
cc5ebdb1e8d4 push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents: 60
diff changeset
389 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
390 hg.update(repo, repo['tip'].node())
78
072010a271c6 Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 65
diff changeset
391 self.pushrevisions()
62
cc5ebdb1e8d4 push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents: 60
diff changeset
392 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
393 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
394 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
395 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
396 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
397
277
3848a7f9b983 push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents: 257
diff changeset
398 def test_push_outdated_base_text(self):
3848a7f9b983 push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents: 257
diff changeset
399 self.test_push_two_revs()
3848a7f9b983 push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents: 257
diff changeset
400 changes = [('adding_file', 'adding_file', 'different_content', ),
3848a7f9b983 push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents: 257
diff changeset
401 ]
3848a7f9b983 push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents: 257
diff changeset
402 self.commitchanges(changes, parent='tip')
3848a7f9b983 push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents: 257
diff changeset
403 self.pushrevisions()
3848a7f9b983 push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents: 257
diff changeset
404 changes = [('adding_file', 'adding_file',
3848a7f9b983 push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents: 257
diff changeset
405 'even_more different_content', ),
3848a7f9b983 push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents: 257
diff changeset
406 ]
3848a7f9b983 push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents: 257
diff changeset
407 self.commitchanges(changes, parent=3)
3848a7f9b983 push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents: 257
diff changeset
408 try:
3848a7f9b983 push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents: 257
diff changeset
409 self.pushrevisions()
3848a7f9b983 push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents: 257
diff changeset
410 assert False, 'This should have aborted!'
3848a7f9b983 push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents: 257
diff changeset
411 except hgutil.Abort, e:
3848a7f9b983 push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents: 257
diff changeset
412 self.assertEqual(e.args[0],
3848a7f9b983 push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents: 257
diff changeset
413 'Base text was out of date, maybe rebase?')
3848a7f9b983 push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents: 257
diff changeset
414
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
415
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
416 def suite():
336
c0b943cef0c3 Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
417 test_classes = [PushTests, ]
48
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
418 tests = []
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
419 # 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
420 # 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
421 # dependencies.
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
422 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
423 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
424 if attr.startswith('test_'):
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
425 tests.append(tc(attr))
d87b57c719f0 Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents: 27
diff changeset
426 return unittest.TestSuite(tests)