Mercurial > hgsubversion
annotate tests/test_push_command.py @ 469:5567af673f83
Revive svn+http(s) URLs support (issue94)
Telling svn from mercurial repository automatically is not always possible, or
at least not seamlessly. Let 'http://repo.com/svn' be an svn repository,
protected with basic authentication. Trying to clone it directly does something
like:
1- Open it like a mercurial repository:
* send between command, ask for credentials, fail
* fallback to static-http, ask for crendentials two times, fail
2- Open it like an svn repository
Mercurial [auth] facility is helpful here, but few people know about it, and it
may seem weird to store svn credentials in mercurial configuration. An svn-like
password manager would not help either because all connections attempts in [1]
fail and it's unlikely we would store credentials in this situation. Instead,
we can clone 'svn+http://repo.com/svn', which will skip step [1].
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sat, 18 Jul 2009 20:44:33 -0500 |
parents | db3a53a2cd76 |
children | c2d0e738c899 |
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 |
356
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
4 import shutil |
48
d87b57c719f0
Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents:
27
diff
changeset
|
5 import socket |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
6 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
|
7 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
|
8 |
48a44546c12f
Add a basic system for running the hgsubversion tests (although not the svnwrap ones) without requiring Nose. Nose is still the recommended way to run the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
9 from mercurial import 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
|
10 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
|
11 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
|
12 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
|
13 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
|
14 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
|
15 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
|
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
|
17 import test_util |
48
d87b57c719f0
Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents:
27
diff
changeset
|
18 import time |
d87b57c719f0
Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents:
27
diff
changeset
|
19 |
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
|
20 |
82
71de43e9f614
Extract PushTest common code into test_util.TestBase
Patrick Mezard <pmezard@gmail.com>
parents:
80
diff
changeset
|
21 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
|
22 def setUp(self): |
82
71de43e9f614
Extract PushTest common code into test_util.TestBase
Patrick Mezard <pmezard@gmail.com>
parents:
80
diff
changeset
|
23 test_util.TestBase.setUp(self) |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
24 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
|
25 self.repo_path, |
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
26 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
|
27 |
220
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
28 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
|
29 repo = self.repo |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
30 def file_callback(repo, memctx, path): |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
31 if path == 'adding_file': |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
32 return context.memfilectx(path=path, |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
33 data='foo', |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
34 islink=False, |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
35 isexec=False, |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
36 copied=False) |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
37 raise IOError() |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
38 ctx = context.memctx(repo, |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
39 (repo['default'].node(), node.nullid), |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
40 'automated test', |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
41 [], |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
42 file_callback, |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
43 'an_author', |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
44 '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
|
45 {'branch': 'default',}) |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
46 new_hash = repo.commitctx(ctx) |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
47 hg.update(repo, repo['tip'].node()) |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
48 old_tip = repo['tip'].node() |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
49 self.pushrevisions() |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
50 tip = self.repo['tip'] |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
51 self.assertEqual(tip.node(), old_tip) |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
52 |
461
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
53 def test_cant_push_with_changes(self): |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
54 repo = self.repo |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
55 def file_callback(repo, memctx, path): |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
56 return context.memfilectx( |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
57 path=path, data='foo', islink=False, |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
58 isexec=False, copied=False) |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
59 ctx = context.memctx(repo, |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
60 (repo['default'].node(), node.nullid), |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
61 'automated test', |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
62 ['adding_file'], |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
63 file_callback, |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
64 'an_author', |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
65 '2008-10-07 20:59:48 -0500', |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
66 {'branch': 'default',}) |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
67 new_hash = repo.commitctx(ctx) |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
68 hg.update(repo, repo['tip'].node()) |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
69 # Touch an existing file |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
70 repo.wwrite('beta', 'something else', '') |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
71 try: |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
72 self.pushrevisions() |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
73 except hgutil.Abort: |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
74 pass |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
75 tip = self.repo['tip'] |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
76 self.assertEqual(new_hash, tip.node()) |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
77 |
336
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
78 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
|
79 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
|
80 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
|
81 '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
|
82 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
|
83 self.host = 'localhost' |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
84 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
|
85 '--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
|
86 '--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
|
87 '--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
|
88 |
340
88ba55ad58c0
Minor tweaks to wrapper documentation.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
337
diff
changeset
|
89 svnserve = subprocess.Popen(args, stdout=subprocess.PIPE, |
88ba55ad58c0
Minor tweaks to wrapper documentation.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
337
diff
changeset
|
90 stderr=subprocess.STDOUT) |
88ba55ad58c0
Minor tweaks to wrapper documentation.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
337
diff
changeset
|
91 self.svnserve_pid = svnserve.pid |
336
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
92 try: |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
93 time.sleep(2) |
337
46e69be8e2c8
Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents:
336
diff
changeset
|
94 import shutil |
46e69be8e2c8
Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents:
336
diff
changeset
|
95 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
|
96 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
|
97 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
|
98 |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
99 repo = self.repo |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
100 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
|
101 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
|
102 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
|
103 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
|
104 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
|
105 data='foo', |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
106 islink=False, |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
107 isexec=False, |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
108 copied=False) |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
109 raise IOError() |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
110 ctx = context.memctx(repo, |
348
af1508b7ad54
test_push_command: improve readability a bit.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
340
diff
changeset
|
111 parents=(repo['default'].node(), node.nullid), |
af1508b7ad54
test_push_command: improve readability a bit.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
340
diff
changeset
|
112 text='automated test', |
af1508b7ad54
test_push_command: improve readability a bit.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
340
diff
changeset
|
113 files=['adding_file'], |
af1508b7ad54
test_push_command: improve readability a bit.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
340
diff
changeset
|
114 filectxfn=file_callback, |
af1508b7ad54
test_push_command: improve readability a bit.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
340
diff
changeset
|
115 user='an_author', |
af1508b7ad54
test_push_command: improve readability a bit.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
340
diff
changeset
|
116 date='2008-10-07 20:59:48 -0500', |
af1508b7ad54
test_push_command: improve readability a bit.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
340
diff
changeset
|
117 extra={'branch': 'default',}) |
336
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
118 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
|
119 if not commit: |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
120 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
|
121 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
|
122 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
|
123 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
|
124 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
|
125 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
|
126 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
|
127 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
|
128 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
|
129 self.assertEqual(tip.branch(), 'default') |
349
5d0d9424913f
test_push_command: this test causes an author of None.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
348
diff
changeset
|
130 # unintended behaviour: |
5d0d9424913f
test_push_command: this test causes an author of None.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
348
diff
changeset
|
131 self.assertNotEqual('an_author', tip.user()) |
5d0d9424913f
test_push_command: this test causes an author of None.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
348
diff
changeset
|
132 self.assertEqual('None', tip.user().rsplit('@', 1)[0]) |
336
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
133 finally: |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
134 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
|
135 |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
136 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
|
137 repo = self.repo |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
138 old_tip = repo['tip'].node() |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
139 expected_parent = repo['default'].node() |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
140 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
|
141 if path == 'adding_file': |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
142 return context.memfilectx(path=path, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
143 data='foo', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
144 islink=False, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
145 isexec=False, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
146 copied=False) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
147 raise IOError() |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
148 ctx = context.memctx(repo, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
149 (repo['default'].node(), node.nullid), |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
150 'automated test', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
151 ['adding_file'], |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
152 file_callback, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
153 'an_author', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
154 '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
|
155 {'branch': 'default',}) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
156 new_hash = repo.commitctx(ctx) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
157 if not commit: |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
158 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
|
159 hg.update(repo, repo['tip'].node()) |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
160 self.pushrevisions() |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
161 tip = self.repo['tip'] |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
162 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
|
163 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
|
164 node.hex(expected_parent)) |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
165 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
|
166 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
|
167 |
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
|
168 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
|
169 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
|
170 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
|
171 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
|
172 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
|
173 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
|
174 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
|
175 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
|
176 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
|
177 (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
|
178 '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
|
179 ['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
|
180 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
|
181 '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
|
182 '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
|
183 {'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
|
184 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
|
185 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
|
186 (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
|
187 '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
|
188 ['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
|
189 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
|
190 '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
|
191 '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
|
192 {'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
|
193 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
|
194 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
|
195 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
|
196 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
|
197 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
|
198 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
|
199 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
|
200 ['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
|
201 |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
202 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
|
203 # 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
|
204 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
|
205 repo = self.repo |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
206 old_tip = repo['tip'].node() |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
207 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
|
208 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
|
209 if path == 'adding_file2': |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
210 return context.memfilectx(path=path, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
211 data='foo2', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
212 islink=False, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
213 isexec=False, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
214 copied=False) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
215 raise IOError() |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
216 ctx = context.memctx(repo, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
217 (repo['default'].node(), node.nullid), |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
218 'automated test', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
219 ['adding_file2'], |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
220 file_callback, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
221 'an_author', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
222 '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
|
223 {'branch': 'default',}) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
224 new_hash = repo.commitctx(ctx) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
225 hg.update(repo, repo['tip'].node()) |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
226 self.pushrevisions() |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
227 tip = self.repo['tip'] |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
228 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
|
229 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
|
230 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
|
231 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
|
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.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
|
234 try: |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
235 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
|
236 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
|
237 except revlog.LookupError, e: |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
238 pass |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
239 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
|
240 |
356
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
241 def test_push_to_branch(self, push=True): |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
242 repo = self.repo |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
243 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
|
244 if path == 'adding_file': |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
245 return context.memfilectx(path=path, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
246 data='foo', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
247 islink=False, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
248 isexec=False, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
249 copied=False) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
250 raise IOError() |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
251 ctx = context.memctx(repo, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
252 (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
|
253 'automated test', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
254 ['adding_file'], |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
255 file_callback, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
256 'an_author', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
257 '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
|
258 {'branch': 'the_branch',}) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
259 new_hash = repo.commitctx(ctx) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
260 hg.update(repo, repo['tip'].node()) |
356
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
261 if push: |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
262 self.pushrevisions() |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
263 tip = self.repo['tip'] |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
264 self.assertNotEqual(tip.node(), new_hash) |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
265 self.assertEqual(tip['adding_file'].data(), 'foo') |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
266 self.assertEqual(tip.branch(), 'the_branch') |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
267 |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
268 def push_to_non_tip(self): |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
269 self.test_push_to_branch(push=False) |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
270 wc2path = self.wc_path + '_clone' |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
271 u = self.repo.ui |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
272 hg.clone(self.repo.ui, self.wc_path, wc2path, update=False) |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
273 self.pushrevisions() |
356
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
274 oldf = open(os.path.join(self.wc_path, '.hg', 'hgrc')) |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
275 hgrc = oldf.read() |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
276 oldf.close() |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
277 shutil.rmtree(self.wc_path) |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
278 hg.clone(u, wc2path, self.wc_path, update=False) |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
279 oldf = open(os.path.join(self.wc_path, '.hg', 'hgrc'), 'w') |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
280 oldf.write(hgrc) |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
281 oldf.close() |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
282 |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
283 # do a commit here |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
284 self.commitchanges([('foobaz', 'foobaz', 'This file is added on default.', ), |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
285 ], |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
286 parent='default', |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
287 message='commit to default') |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
288 from hgsubversion import svncommands |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
289 svncommands.rebuildmeta(u, |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
290 self.repo, |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
291 os.path.dirname(self.repo.path), |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
292 args=[test_util.fileurl(self.repo_path)]) |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
293 |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
294 |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
295 hg.update(self.repo, self.repo['tip'].node()) |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
296 oldnode = self.repo['tip'].hex() |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
297 self.pushrevisions(expected_extra_back=1) |
62f90781eb10
push: don't refuse to push if it looks like we haven't pulled all changes.
Augie Fackler <durin42@gmail.com>
parents:
349
diff
changeset
|
298 self.assertNotEqual(oldnode, self.repo['tip'].hex(), 'Revision was not pushed.') |
48
d87b57c719f0
Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents:
27
diff
changeset
|
299 |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
300 def test_delete_file(self): |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
301 repo = self.repo |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
302 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
|
303 raise IOError() |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
304 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
|
305 ctx = context.memctx(repo, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
306 (repo['default'].node(), node.nullid), |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
307 'automated test', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
308 ['alpha'], |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
309 file_callback, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
310 'an author', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
311 '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
|
312 {'branch': 'default', }) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
313 new_hash = repo.commitctx(ctx) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
314 hg.update(repo, repo['tip'].node()) |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
315 self.pushrevisions() |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
316 tip = self.repo['tip'] |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
317 self.assertEqual(old_files, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
318 set(tip.manifest().keys() + ['alpha'])) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
319 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
|
320 |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
321 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
|
322 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
|
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 if path == 'gamma': |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
326 return context.memfilectx(path=path, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
327 data='foo', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
328 islink=False, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
329 isexec=True, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
330 copied=False) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
331 raise IOError() |
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['tip'].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 ['gamma', ], |
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-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
|
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) |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
242
diff
changeset
|
341 hg.clean(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) |
257
ffccf0080e54
Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents:
242
diff
changeset
|
345 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
|
346 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
|
347 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
|
348 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
|
349 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
|
350 |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
351 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
|
352 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
|
353 repo = self.repo |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
354 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
|
355 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
|
356 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
|
357 data='foo', |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
358 islink=True, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
359 isexec=False, |
49
2bc4999a89d3
Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents:
48
diff
changeset
|
360 copied=False) |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
361 raise IOError() |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
362 ctx = context.memctx(repo, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
363 (repo['tip'].node(), node.nullid), |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
364 'message', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
365 ['gamma', ], |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
366 file_callback, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
367 'author', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
368 '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
|
369 {'branch': 'default', }) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
370 new_hash = repo.commitctx(ctx) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
371 hg.update(repo, repo['tip'].node()) |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
372 self.pushrevisions() |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
373 tip = self.repo['tip'] |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
374 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
|
375 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
|
376 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
|
377 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
|
378 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
|
379 |
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
|
380 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
|
381 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
|
382 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
|
383 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
|
384 |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
385 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
|
386 link=False, expected_flags='x'): |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
387 self.test_push_to_default() |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
388 repo = self.repo |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
389 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
|
390 return context.memfilectx(path=path, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
391 data='foo', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
392 islink=link, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
393 isexec=execute, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
394 copied=False) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
395 ctx = context.memctx(repo, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
396 (repo['default'].node(), node.nullid), |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
397 'message', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
398 ['alpha', ], |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
399 file_callback, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
400 'author', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
401 '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
|
402 {'branch': 'default', }) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
403 new_hash = repo.commitctx(ctx) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
404 hg.update(repo, repo['tip'].node()) |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
405 self.pushrevisions() |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
406 tip = self.repo['tip'] |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
407 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
|
408 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
|
409 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
|
410 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
|
411 # 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
|
412 # works |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
413 repo = self.repo |
101
a3b717e4abf5
Cleanups based on pyflakes output.
Augie Fackler <durin42@gmail.com>
parents:
83
diff
changeset
|
414 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
|
415 return context.memfilectx(path=path, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
416 data='bar', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
417 islink=link, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
418 isexec=execute, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
419 copied=False) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
420 ctx = context.memctx(repo, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
421 (repo['default'].node(), node.nullid), |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
422 'message', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
423 ['alpha', ], |
101
a3b717e4abf5
Cleanups based on pyflakes output.
Augie Fackler <durin42@gmail.com>
parents:
83
diff
changeset
|
424 file_callback2, |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
425 'author', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
426 '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
|
427 {'branch': 'default', }) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
428 new_hash = repo.commitctx(ctx) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
429 hg.update(repo, repo['tip'].node()) |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
430 self.pushrevisions() |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
431 tip = self.repo['tip'] |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
432 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
|
433 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
|
434 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
|
435 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
|
436 # 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
|
437 repo = self.repo |
101
a3b717e4abf5
Cleanups based on pyflakes output.
Augie Fackler <durin42@gmail.com>
parents:
83
diff
changeset
|
438 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
|
439 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
|
440 data='bar', |
cc5ebdb1e8d4
push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents:
60
diff
changeset
|
441 islink=False, |
cc5ebdb1e8d4
push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents:
60
diff
changeset
|
442 isexec=False, |
cc5ebdb1e8d4
push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents:
60
diff
changeset
|
443 copied=False) |
cc5ebdb1e8d4
push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents:
60
diff
changeset
|
444 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
|
445 (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
|
446 'message', |
cc5ebdb1e8d4
push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents:
60
diff
changeset
|
447 ['alpha', ], |
101
a3b717e4abf5
Cleanups based on pyflakes output.
Augie Fackler <durin42@gmail.com>
parents:
83
diff
changeset
|
448 file_callback3, |
62
cc5ebdb1e8d4
push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents:
60
diff
changeset
|
449 'author', |
cc5ebdb1e8d4
push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents:
60
diff
changeset
|
450 '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
|
451 {'branch': 'default', }) |
cc5ebdb1e8d4
push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents:
60
diff
changeset
|
452 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
|
453 hg.update(repo, repo['tip'].node()) |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
454 self.pushrevisions() |
62
cc5ebdb1e8d4
push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents:
60
diff
changeset
|
455 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
|
456 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
|
457 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
|
458 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
|
459 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
|
460 |
277
3848a7f9b983
push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
461 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
|
462 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
|
463 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
|
464 ] |
3848a7f9b983
push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
465 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
|
466 self.pushrevisions() |
3848a7f9b983
push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
467 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
|
468 'even_more different_content', ), |
3848a7f9b983
push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
469 ] |
3848a7f9b983
push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
470 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
|
471 try: |
3848a7f9b983
push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
472 self.pushrevisions() |
3848a7f9b983
push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
473 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
|
474 except hgutil.Abort, e: |
3848a7f9b983
push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
475 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
|
476 '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
|
477 |
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
|
478 |
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
|
479 def suite(): |
336
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
480 test_classes = [PushTests, ] |
48
d87b57c719f0
Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents:
27
diff
changeset
|
481 tests = [] |
d87b57c719f0
Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents:
27
diff
changeset
|
482 # 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
|
483 # 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
|
484 # dependencies. |
d87b57c719f0
Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents:
27
diff
changeset
|
485 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
|
486 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
|
487 if attr.startswith('test_'): |
d87b57c719f0
Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents:
27
diff
changeset
|
488 tests.append(tc(attr)) |
d87b57c719f0
Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents:
27
diff
changeset
|
489 return unittest.TestSuite(tests) |