Mercurial > hgsubversion
annotate tests/test_push_command.py @ 336:c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Wed, 13 May 2009 10:22:18 -0500 |
parents | 75f082b5897e |
children | 46e69be8e2c8 |
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) |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
66 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
|
67 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
|
68 |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
69 repo = self.repo |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
70 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
|
71 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
|
72 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
|
73 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
|
74 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
|
75 data='foo', |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
76 islink=False, |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
77 isexec=False, |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
78 copied=False) |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
79 raise IOError() |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
80 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
|
81 (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
|
82 'automated test', |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
83 ['adding_file'], |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
84 file_callback, |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
85 'an_author', |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
86 '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
|
87 {'branch': 'default',}) |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
88 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
|
89 if not commit: |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
90 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
|
91 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
|
92 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
|
93 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
|
94 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
|
95 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
|
96 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
|
97 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
|
98 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
|
99 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
|
100 finally: |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
101 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
|
102 |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
103 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
|
104 repo = self.repo |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
105 old_tip = repo['tip'].node() |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
106 expected_parent = repo['default'].node() |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
107 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
|
108 if path == 'adding_file': |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
109 return context.memfilectx(path=path, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
110 data='foo', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
111 islink=False, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
112 isexec=False, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
113 copied=False) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
114 raise IOError() |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
115 ctx = context.memctx(repo, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
116 (repo['default'].node(), node.nullid), |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
117 'automated test', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
118 ['adding_file'], |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
119 file_callback, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
120 'an_author', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
121 '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
|
122 {'branch': 'default',}) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
123 new_hash = repo.commitctx(ctx) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
124 if not commit: |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
125 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
|
126 hg.update(repo, repo['tip'].node()) |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
127 self.pushrevisions() |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
128 tip = self.repo['tip'] |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
129 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
|
130 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
|
131 node.hex(expected_parent)) |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
132 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
|
133 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
|
134 |
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
|
135 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
|
136 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
|
137 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
|
138 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
|
139 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
|
140 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
|
141 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
|
142 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
|
143 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
|
144 (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
|
145 '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
|
146 ['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
|
147 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
|
148 '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
|
149 '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
|
150 {'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
|
151 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
|
152 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
|
153 (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
|
154 '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
|
155 ['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
|
156 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
|
157 '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
|
158 '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
|
159 {'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
|
160 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
|
161 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
|
162 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
|
163 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
|
164 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
|
165 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
|
166 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
|
167 ['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
|
168 |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
169 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
|
170 # 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
|
171 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
|
172 repo = self.repo |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
173 old_tip = repo['tip'].node() |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
174 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
|
175 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
|
176 if path == 'adding_file2': |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
177 return context.memfilectx(path=path, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
178 data='foo2', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
179 islink=False, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
180 isexec=False, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
181 copied=False) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
182 raise IOError() |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
183 ctx = context.memctx(repo, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
184 (repo['default'].node(), node.nullid), |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
185 'automated test', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
186 ['adding_file2'], |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
187 file_callback, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
188 'an_author', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
189 '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
|
190 {'branch': 'default',}) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
191 new_hash = repo.commitctx(ctx) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
192 hg.update(repo, repo['tip'].node()) |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
193 self.pushrevisions() |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
194 tip = self.repo['tip'] |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
195 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
|
196 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
|
197 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
|
198 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
|
199 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
|
200 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
|
201 try: |
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_file2'].data(), 'foo') |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
203 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
|
204 except revlog.LookupError, e: |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
205 pass |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
206 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
|
207 |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
208 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
|
209 repo = self.repo |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
210 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
|
211 if path == 'adding_file': |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
212 return context.memfilectx(path=path, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
213 data='foo', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
214 islink=False, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
215 isexec=False, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
216 copied=False) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
217 raise IOError() |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
218 ctx = context.memctx(repo, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
219 (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
|
220 'automated test', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
221 ['adding_file'], |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
222 file_callback, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
223 'an_author', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
224 '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
|
225 {'branch': 'the_branch',}) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
226 new_hash = repo.commitctx(ctx) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
227 #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
|
228 hg.update(repo, repo['tip'].node()) |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
229 self.pushrevisions() |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
230 tip = self.repo['tip'] |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
231 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
|
232 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
|
233 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
|
234 |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
235 def test_delete_file(self): |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
236 repo = self.repo |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
237 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
|
238 raise IOError() |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
239 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
|
240 ctx = context.memctx(repo, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
241 (repo['default'].node(), node.nullid), |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
242 'automated test', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
243 ['alpha'], |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
244 file_callback, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
245 'an author', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
246 '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
|
247 {'branch': 'default', }) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
248 new_hash = repo.commitctx(ctx) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
249 hg.update(repo, repo['tip'].node()) |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
250 self.pushrevisions() |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
251 tip = self.repo['tip'] |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
252 self.assertEqual(old_files, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
253 set(tip.manifest().keys() + ['alpha'])) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
254 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
|
255 |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
256 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
|
257 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
|
258 repo = self.repo |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
259 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
|
260 if path == 'gamma': |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
261 return context.memfilectx(path=path, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
262 data='foo', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
263 islink=False, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
264 isexec=True, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
265 copied=False) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
266 raise IOError() |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
267 ctx = context.memctx(repo, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
268 (repo['tip'].node(), node.nullid), |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
269 'message', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
270 ['gamma', ], |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
271 file_callback, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
272 'author', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
273 '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
|
274 {'branch': 'default', }) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
275 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
|
276 hg.clean(repo, repo['tip'].node()) |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
277 self.pushrevisions() |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
278 tip = self.repo['tip'] |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
279 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
|
280 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
|
281 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
|
282 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
|
283 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
|
284 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
|
285 |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
286 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
|
287 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
|
288 repo = self.repo |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
289 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
|
290 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
|
291 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
|
292 data='foo', |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
293 islink=True, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
294 isexec=False, |
49
2bc4999a89d3
Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents:
48
diff
changeset
|
295 copied=False) |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
296 raise IOError() |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
297 ctx = context.memctx(repo, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
298 (repo['tip'].node(), node.nullid), |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
299 'message', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
300 ['gamma', ], |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
301 file_callback, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
302 'author', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
303 '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
|
304 {'branch': 'default', }) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
305 new_hash = repo.commitctx(ctx) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
306 hg.update(repo, repo['tip'].node()) |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
307 self.pushrevisions() |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
308 tip = self.repo['tip'] |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
309 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
|
310 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
|
311 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
|
312 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
|
313 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
|
314 |
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
|
315 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
|
316 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
|
317 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
|
318 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
|
319 |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
320 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
|
321 link=False, expected_flags='x'): |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
322 self.test_push_to_default() |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
323 repo = self.repo |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
324 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
|
325 return context.memfilectx(path=path, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
326 data='foo', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
327 islink=link, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
328 isexec=execute, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
329 copied=False) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
330 ctx = context.memctx(repo, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
331 (repo['default'].node(), node.nullid), |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
332 'message', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
333 ['alpha', ], |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
334 file_callback, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
335 'author', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
336 '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
|
337 {'branch': 'default', }) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
338 new_hash = repo.commitctx(ctx) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
339 hg.update(repo, repo['tip'].node()) |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
340 self.pushrevisions() |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
341 tip = self.repo['tip'] |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
342 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
|
343 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
|
344 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
|
345 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
|
346 # 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
|
347 # works |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
348 repo = self.repo |
101
a3b717e4abf5
Cleanups based on pyflakes output.
Augie Fackler <durin42@gmail.com>
parents:
83
diff
changeset
|
349 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
|
350 return context.memfilectx(path=path, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
351 data='bar', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
352 islink=link, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
353 isexec=execute, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
354 copied=False) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
355 ctx = context.memctx(repo, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
356 (repo['default'].node(), node.nullid), |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
357 'message', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
358 ['alpha', ], |
101
a3b717e4abf5
Cleanups based on pyflakes output.
Augie Fackler <durin42@gmail.com>
parents:
83
diff
changeset
|
359 file_callback2, |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
360 'author', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
361 '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
|
362 {'branch': 'default', }) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
363 new_hash = repo.commitctx(ctx) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
364 hg.update(repo, repo['tip'].node()) |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
365 self.pushrevisions() |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
366 tip = self.repo['tip'] |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
367 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
|
368 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
|
369 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
|
370 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
|
371 # 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
|
372 repo = self.repo |
101
a3b717e4abf5
Cleanups based on pyflakes output.
Augie Fackler <durin42@gmail.com>
parents:
83
diff
changeset
|
373 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
|
374 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
|
375 data='bar', |
cc5ebdb1e8d4
push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents:
60
diff
changeset
|
376 islink=False, |
cc5ebdb1e8d4
push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents:
60
diff
changeset
|
377 isexec=False, |
cc5ebdb1e8d4
push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents:
60
diff
changeset
|
378 copied=False) |
cc5ebdb1e8d4
push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents:
60
diff
changeset
|
379 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
|
380 (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
|
381 'message', |
cc5ebdb1e8d4
push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents:
60
diff
changeset
|
382 ['alpha', ], |
101
a3b717e4abf5
Cleanups based on pyflakes output.
Augie Fackler <durin42@gmail.com>
parents:
83
diff
changeset
|
383 file_callback3, |
62
cc5ebdb1e8d4
push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents:
60
diff
changeset
|
384 'author', |
cc5ebdb1e8d4
push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents:
60
diff
changeset
|
385 '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
|
386 {'branch': 'default', }) |
cc5ebdb1e8d4
push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents:
60
diff
changeset
|
387 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
|
388 hg.update(repo, repo['tip'].node()) |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
389 self.pushrevisions() |
62
cc5ebdb1e8d4
push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents:
60
diff
changeset
|
390 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
|
391 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
|
392 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
|
393 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
|
394 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
|
395 |
277
3848a7f9b983
push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
396 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
|
397 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
|
398 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
|
399 ] |
3848a7f9b983
push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
400 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
|
401 self.pushrevisions() |
3848a7f9b983
push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
402 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
|
403 'even_more different_content', ), |
3848a7f9b983
push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
404 ] |
3848a7f9b983
push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
405 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
|
406 try: |
3848a7f9b983
push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
407 self.pushrevisions() |
3848a7f9b983
push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
408 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
|
409 except hgutil.Abort, e: |
3848a7f9b983
push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
410 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
|
411 '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
|
412 |
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
|
413 |
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
|
414 def suite(): |
336
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
415 test_classes = [PushTests, ] |
48
d87b57c719f0
Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents:
27
diff
changeset
|
416 tests = [] |
d87b57c719f0
Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents:
27
diff
changeset
|
417 # 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
|
418 # 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
|
419 # dependencies. |
d87b57c719f0
Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents:
27
diff
changeset
|
420 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
|
421 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
|
422 if attr.startswith('test_'): |
d87b57c719f0
Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents:
27
diff
changeset
|
423 tests.append(tc(attr)) |
d87b57c719f0
Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents:
27
diff
changeset
|
424 return unittest.TestSuite(tests) |