Mercurial > hgsubversion
annotate tests/test_push_command.py @ 1600:6f5b296c01dd
verify: use ui.write() instead of ui.warn()
Looks like ui.warn() is being written to output directly and it's not pushed to
buffer which ui objects maintain. Let's use ui.write() instead which is used in
the other instance of same error messages too.
This fixes test_utility_commands.py which was failing for me on tip of default
branch.
author | Pulkit Goyal <pulkit@yandex-team.ru> |
---|---|
date | Wed, 26 Dec 2018 18:40:12 +0300 |
parents | 2b342625a92a |
children |
rev | line source |
---|---|
643
d2ef7220a079
tests: import test_util as the first module in all relevant tests
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
626
diff
changeset
|
1 import test_util |
d2ef7220a079
tests: import test_util as the first module in all relevant tests
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
626
diff
changeset
|
2 |
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 atexit |
531
cf4fe45bf8fd
Change all instantiations of IOError to set both errno and strerror.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
484
diff
changeset
|
4 import errno |
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
|
5 import os |
854
50a09999dce3
tests: push_command: use svnserve.kill() in Python >=2.6
Arne Babenhauserheide <arne.babenhauserheide@fzk.de>
parents:
834
diff
changeset
|
6 import sys |
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
|
7 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
|
8 import shutil |
48
d87b57c719f0
Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents:
27
diff
changeset
|
9 import socket |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
10 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
|
11 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
|
12 |
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 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
|
14 from mercurial import commands |
1555
cff81f35b31e
cleanup: reference Abort from mercurial.error instead of mercurial.util
Augie Fackler <raf@durin42.com>
parents:
1549
diff
changeset
|
15 from mercurial import error as hgerror |
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 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
|
17 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
|
18 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
|
19 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
|
20 |
1040
ada2400241c4
fixes for running under Mercurial 2.0
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1036
diff
changeset
|
21 from hgsubversion import util |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
22 from hgsubversion import compathacks |
1040
ada2400241c4
fixes for running under Mercurial 2.0
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1036
diff
changeset
|
23 |
48
d87b57c719f0
Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents:
27
diff
changeset
|
24 import time |
d87b57c719f0
Add a test that verifies push works to svn:// servers.
Augie Fackler <durin42@gmail.com>
parents:
27
diff
changeset
|
25 |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
26 revsymbol = test_util.revsymbol |
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
27 |
1584
2b342625a92a
test: add compat code for removed revlog.LookupError in test_push_command.py
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
1570
diff
changeset
|
28 try: |
2b342625a92a
test: add compat code for removed revlog.LookupError in test_push_command.py
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
1570
diff
changeset
|
29 lookuperror = revlog.LookupError |
2b342625a92a
test: add compat code for removed revlog.LookupError in test_push_command.py
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
1570
diff
changeset
|
30 except AttributeError: |
2b342625a92a
test: add compat code for removed revlog.LookupError in test_push_command.py
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
1570
diff
changeset
|
31 lookuperror = hgerror.LookupError |
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
|
32 |
82
71de43e9f614
Extract PushTest common code into test_util.TestBase
Patrick Mezard <pmezard@gmail.com>
parents:
80
diff
changeset
|
33 class PushTests(test_util.TestBase): |
1055
2d7398fffd0d
push: obsolete rather than rebase & strip when enabled
Dan Villiom Podlaski Christiansen <dan@cabo.dk>
parents:
1048
diff
changeset
|
34 obsolete_mode_tests = True |
2d7398fffd0d
push: obsolete rather than rebase & strip when enabled
Dan Villiom Podlaski Christiansen <dan@cabo.dk>
parents:
1048
diff
changeset
|
35 |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
36 def setUp(self): |
82
71de43e9f614
Extract PushTest common code into test_util.TestBase
Patrick Mezard <pmezard@gmail.com>
parents:
80
diff
changeset
|
37 test_util.TestBase.setUp(self) |
872
a279b5838aaf
test_util: remove self.repo_path, generate new paths each time
Patrick Mezard <patrick@mezard.eu>
parents:
866
diff
changeset
|
38 self.repo_path = self.load_and_fetch('simple_branch.svndump')[1] |
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
|
39 |
220
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
40 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
|
41 repo = self.repo |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
42 def file_callback(repo, memctx, path): |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
43 if path == 'adding_file': |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
44 return compathacks.makememfilectx(repo, |
1549
8410a978c650
compathacks: be compatible with upstream 8a0cac20a1ad memfilectx change
Jun Wu <quark@fb.com>
parents:
1539
diff
changeset
|
45 memctx=memctx, |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
46 path=path, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
47 data='foo', |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
48 islink=False, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
49 isexec=False, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
50 copied=False) |
220
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
51 raise IOError() |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
52 ctx = context.memctx(repo, |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
53 (revsymbol(repo, 'default').node(), node.nullid), |
220
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
54 'automated test', |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
55 [], |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
56 file_callback, |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
57 'an_author', |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
58 '2008-10-07 20:59:48 -0500', |
832
e9af7eba88db
globally: clean up whitespace around operators and commas to conform with PEP8
Yonggang Luo <luoyonggang@gmail.com>
parents:
816
diff
changeset
|
59 {'branch': 'default', }) |
220
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
60 new_hash = repo.commitctx(ctx) |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
61 hg.update(repo, revsymbol(repo, 'tip').node()) |
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
62 old_tip = revsymbol(repo, 'tip').node() |
220
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
63 self.pushrevisions() |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
64 tip = revsymbol(self.repo, 'tip') |
220
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
65 self.assertEqual(tip.node(), old_tip) |
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
66 |
1036
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
67 def test_push_add_of_added_upstream_gives_sane_error(self): |
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
68 repo = self.repo |
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
69 def file_callback(repo, memctx, path): |
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
70 if path == 'adding_file': |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
71 return compathacks.makememfilectx(repo, |
1549
8410a978c650
compathacks: be compatible with upstream 8a0cac20a1ad memfilectx change
Jun Wu <quark@fb.com>
parents:
1539
diff
changeset
|
72 memctx=memctx, |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
73 path=path, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
74 data='foo', |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
75 islink=False, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
76 isexec=False, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
77 copied=False) |
1036
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
78 raise IOError() |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
79 p1 = revsymbol(repo, 'default').node() |
1036
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
80 ctx = context.memctx(repo, |
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
81 (p1, node.nullid), |
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
82 'automated test', |
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
83 ['adding_file'], |
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
84 file_callback, |
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
85 'an_author', |
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
86 '2008-10-07 20:59:48 -0500', |
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
87 {'branch': 'default', }) |
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
88 new_hash = repo.commitctx(ctx) |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
89 hg.update(repo, revsymbol(repo, 'tip').node()) |
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
90 old_tip = revsymbol(repo, 'tip').node() |
1036
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
91 self.pushrevisions() |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
92 tip = revsymbol(self.repo, 'tip') |
1036
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
93 self.assertNotEqual(tip.node(), old_tip) |
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
94 |
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
95 # This node adds the same file as the first one we added, and |
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
96 # will be refused by the server for adding a file that already |
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
97 # exists. We should respond with an error suggesting the user |
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
98 # rebase. |
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
99 ctx = context.memctx(repo, |
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
100 (p1, node.nullid), |
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
101 'automated test', |
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
102 ['adding_file'], |
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
103 file_callback, |
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
104 'an_author', |
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
105 '2008-10-07 20:59:48 -0500', |
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
106 {'branch': 'default', }) |
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
107 new_hash = repo.commitctx(ctx) |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
108 hg.update(repo, revsymbol(repo, 'tip').node()) |
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
109 old_tip = revsymbol(repo, 'tip').node() |
1036
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
110 try: |
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
111 self.pushrevisions() |
1555
cff81f35b31e
cleanup: reference Abort from mercurial.error instead of mercurial.util
Augie Fackler <raf@durin42.com>
parents:
1549
diff
changeset
|
112 except hgerror.Abort, e: |
1036
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
113 assert "pull again and rebase" in str(e) |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
114 tip = revsymbol(self.repo, 'tip') |
1036
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
115 self.assertEqual(tip.node(), old_tip) |
e775ffbcb359
push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS
Augie Fackler <raf@durin42.com>
parents:
992
diff
changeset
|
116 |
461
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
117 def test_cant_push_with_changes(self): |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
118 repo = self.repo |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
119 def file_callback(repo, memctx, path): |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
120 return compathacks.makememfilectx(repo, |
1549
8410a978c650
compathacks: be compatible with upstream 8a0cac20a1ad memfilectx change
Jun Wu <quark@fb.com>
parents:
1539
diff
changeset
|
121 memctx=memctx, |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
122 path=path, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
123 data='foo', |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
124 islink=False, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
125 isexec=False, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
126 copied=False) |
461
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
127 ctx = context.memctx(repo, |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
128 (revsymbol(repo, 'default').node(), node.nullid), |
461
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
129 'automated test', |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
130 ['adding_file'], |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
131 file_callback, |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
132 'an_author', |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
133 '2008-10-07 20:59:48 -0500', |
832
e9af7eba88db
globally: clean up whitespace around operators and commas to conform with PEP8
Yonggang Luo <luoyonggang@gmail.com>
parents:
816
diff
changeset
|
134 {'branch': 'default', }) |
461
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
135 new_hash = repo.commitctx(ctx) |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
136 hg.update(repo, revsymbol(repo, 'tip').node()) |
461
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
137 # Touch an existing file |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
138 repo.wwrite('beta', 'something else', '') |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
139 try: |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
140 self.pushrevisions() |
1555
cff81f35b31e
cleanup: reference Abort from mercurial.error instead of mercurial.util
Augie Fackler <raf@durin42.com>
parents:
1549
diff
changeset
|
141 except hgerror.Abort: |
461
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
142 pass |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
143 tip = revsymbol(self.repo, 'tip') |
461
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
144 self.assertEqual(new_hash, tip.node()) |
db3a53a2cd76
wrappers: make push aborts if uncommitted changes
Patrick Mezard <pmezard@gmail.com>
parents:
356
diff
changeset
|
145 |
671
e910e3ebd23b
svnmeta: strip all repeated slashes from subdir
Peter Arrenbrecht <peter.arrenbre...@gmail.com>
parents:
643
diff
changeset
|
146 def internal_push_over_svnserve(self, subdir='', commit=True): |
866
20e73b5ab6f7
test_util: merge load_svndump_fixture() into TestBase
Patrick Mezard <patrick@mezard.eu>
parents:
865
diff
changeset
|
147 repo_path = self.load_svndump('simple_branch.svndump') |
20e73b5ab6f7
test_util: merge load_svndump_fixture() into TestBase
Patrick Mezard <patrick@mezard.eu>
parents:
865
diff
changeset
|
148 open(os.path.join(repo_path, 'conf', 'svnserve.conf'), |
336
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
149 '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
|
150 self.port = random.randint(socket.IPPORT_USERRESERVED, 65535) |
1451
945700dac237
tests: use hostname instead of localhost
Durham Goode <durham@fb.com>
parents:
1321
diff
changeset
|
151 self.host = socket.gethostname() |
1501
6e3f48d8002f
tests: fix ipv6 support in test_push_command.py
Arun Kulshreshtha <kulshrax@fb.com>
parents:
1451
diff
changeset
|
152 |
6e3f48d8002f
tests: fix ipv6 support in test_push_command.py
Arun Kulshreshtha <kulshrax@fb.com>
parents:
1451
diff
changeset
|
153 # The `svnserve` binary appears to use the obsolete `gethostbyname(3)` |
6e3f48d8002f
tests: fix ipv6 support in test_push_command.py
Arun Kulshreshtha <kulshrax@fb.com>
parents:
1451
diff
changeset
|
154 # function, which always returns an IPv4 address, even on hosts that |
6e3f48d8002f
tests: fix ipv6 support in test_push_command.py
Arun Kulshreshtha <kulshrax@fb.com>
parents:
1451
diff
changeset
|
155 # support and expect IPv6. As a workaround, resolve the hostname |
6e3f48d8002f
tests: fix ipv6 support in test_push_command.py
Arun Kulshreshtha <kulshrax@fb.com>
parents:
1451
diff
changeset
|
156 # within the test harness with `getaddrinfo(3)` to ensure that the |
6e3f48d8002f
tests: fix ipv6 support in test_push_command.py
Arun Kulshreshtha <kulshrax@fb.com>
parents:
1451
diff
changeset
|
157 # client and server both use the same IPv4 or IPv6 address. |
1522
1122a90e329a
test_push_command: deal with gethostname() sometimes returning bad hostnames
Augie Fackler <raf@durin42.com>
parents:
1508
diff
changeset
|
158 try: |
1122a90e329a
test_push_command: deal with gethostname() sometimes returning bad hostnames
Augie Fackler <raf@durin42.com>
parents:
1508
diff
changeset
|
159 addrinfo = socket.getaddrinfo(self.host, self.port) |
1122a90e329a
test_push_command: deal with gethostname() sometimes returning bad hostnames
Augie Fackler <raf@durin42.com>
parents:
1508
diff
changeset
|
160 except socket.gaierror as e: |
1122a90e329a
test_push_command: deal with gethostname() sometimes returning bad hostnames
Augie Fackler <raf@durin42.com>
parents:
1508
diff
changeset
|
161 # gethostname() can give a hostname that doesn't |
1122a90e329a
test_push_command: deal with gethostname() sometimes returning bad hostnames
Augie Fackler <raf@durin42.com>
parents:
1508
diff
changeset
|
162 # resolve. Seems bad, but let's fall back to `localhost` in |
1122a90e329a
test_push_command: deal with gethostname() sometimes returning bad hostnames
Augie Fackler <raf@durin42.com>
parents:
1508
diff
changeset
|
163 # that case and hope for the best. |
1122a90e329a
test_push_command: deal with gethostname() sometimes returning bad hostnames
Augie Fackler <raf@durin42.com>
parents:
1508
diff
changeset
|
164 self.host = 'localhost' |
1122a90e329a
test_push_command: deal with gethostname() sometimes returning bad hostnames
Augie Fackler <raf@durin42.com>
parents:
1508
diff
changeset
|
165 addrinfo = socket.getaddrinfo(self.host, self.port) |
1507
debba0fa822e
test_push_command: bias towards IPv4 to work around gremlins on macOS
Augie Fackler <raf@durin42.com>
parents:
1501
diff
changeset
|
166 # On macOS svn seems to have issues with IPv6 at least some of |
debba0fa822e
test_push_command: bias towards IPv4 to work around gremlins on macOS
Augie Fackler <raf@durin42.com>
parents:
1501
diff
changeset
|
167 # the time, so try and bias towards IPv4. This works because |
debba0fa822e
test_push_command: bias towards IPv4 to work around gremlins on macOS
Augie Fackler <raf@durin42.com>
parents:
1501
diff
changeset
|
168 # AF_INET is less than AF_INET6 on all platforms I've |
debba0fa822e
test_push_command: bias towards IPv4 to work around gremlins on macOS
Augie Fackler <raf@durin42.com>
parents:
1501
diff
changeset
|
169 # checked. Hopefully any platform where that's not true will |
debba0fa822e
test_push_command: bias towards IPv4 to work around gremlins on macOS
Augie Fackler <raf@durin42.com>
parents:
1501
diff
changeset
|
170 # be fine with IPv6 all the time. :) |
debba0fa822e
test_push_command: bias towards IPv4 to work around gremlins on macOS
Augie Fackler <raf@durin42.com>
parents:
1501
diff
changeset
|
171 selected = sorted(addrinfo)[0] |
debba0fa822e
test_push_command: bias towards IPv4 to work around gremlins on macOS
Augie Fackler <raf@durin42.com>
parents:
1501
diff
changeset
|
172 self.host = selected[4][0] |
1501
6e3f48d8002f
tests: fix ipv6 support in test_push_command.py
Arun Kulshreshtha <kulshrax@fb.com>
parents:
1451
diff
changeset
|
173 |
6e3f48d8002f
tests: fix ipv6 support in test_push_command.py
Arun Kulshreshtha <kulshrax@fb.com>
parents:
1451
diff
changeset
|
174 # If we're connecting via IPv6 the need to put brackets around the |
6e3f48d8002f
tests: fix ipv6 support in test_push_command.py
Arun Kulshreshtha <kulshrax@fb.com>
parents:
1451
diff
changeset
|
175 # hostname in the URL. |
1507
debba0fa822e
test_push_command: bias towards IPv4 to work around gremlins on macOS
Augie Fackler <raf@durin42.com>
parents:
1501
diff
changeset
|
176 ipv6 = selected[0] == socket.AF_INET6 |
1508
5441a9d1fd50
test_push_command: avoid letting interface name in IPv6 address
Augie Fackler <raf@durin42.com>
parents:
1507
diff
changeset
|
177 |
5441a9d1fd50
test_push_command: avoid letting interface name in IPv6 address
Augie Fackler <raf@durin42.com>
parents:
1507
diff
changeset
|
178 # Ditch any interface information since that's not helpful in |
5441a9d1fd50
test_push_command: avoid letting interface name in IPv6 address
Augie Fackler <raf@durin42.com>
parents:
1507
diff
changeset
|
179 # a URL |
5441a9d1fd50
test_push_command: avoid letting interface name in IPv6 address
Augie Fackler <raf@durin42.com>
parents:
1507
diff
changeset
|
180 if ipv6 and ':' in self.host and '%' in self.host: |
5441a9d1fd50
test_push_command: avoid letting interface name in IPv6 address
Augie Fackler <raf@durin42.com>
parents:
1507
diff
changeset
|
181 self.host = self.host.rsplit('%', 1)[0] |
5441a9d1fd50
test_push_command: avoid letting interface name in IPv6 address
Augie Fackler <raf@durin42.com>
parents:
1507
diff
changeset
|
182 |
1501
6e3f48d8002f
tests: fix ipv6 support in test_push_command.py
Arun Kulshreshtha <kulshrax@fb.com>
parents:
1451
diff
changeset
|
183 urlfmt = 'svn://[%s]:%d/%s' if ipv6 else 'svn://%s:%d/%s' |
6e3f48d8002f
tests: fix ipv6 support in test_push_command.py
Arun Kulshreshtha <kulshrax@fb.com>
parents:
1451
diff
changeset
|
184 |
336
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
185 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
|
186 '--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
|
187 '--listen-host=%s' % self.host, |
866
20e73b5ab6f7
test_util: merge load_svndump_fixture() into TestBase
Patrick Mezard <patrick@mezard.eu>
parents:
865
diff
changeset
|
188 '--root=%s' % repo_path] |
336
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
189 |
340
88ba55ad58c0
Minor tweaks to wrapper documentation.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
337
diff
changeset
|
190 svnserve = subprocess.Popen(args, stdout=subprocess.PIPE, |
88ba55ad58c0
Minor tweaks to wrapper documentation.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
337
diff
changeset
|
191 stderr=subprocess.STDOUT) |
88ba55ad58c0
Minor tweaks to wrapper documentation.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
337
diff
changeset
|
192 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
|
193 try: |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
194 time.sleep(2) |
337
46e69be8e2c8
Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents:
336
diff
changeset
|
195 import shutil |
46e69be8e2c8
Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents:
336
diff
changeset
|
196 shutil.rmtree(self.wc_path) |
671
e910e3ebd23b
svnmeta: strip all repeated slashes from subdir
Peter Arrenbrecht <peter.arrenbre...@gmail.com>
parents:
643
diff
changeset
|
197 commands.clone(self.ui(), |
1501
6e3f48d8002f
tests: fix ipv6 support in test_push_command.py
Arun Kulshreshtha <kulshrax@fb.com>
parents:
1451
diff
changeset
|
198 urlfmt % (self.host, self.port, subdir), |
336
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
199 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
|
200 |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
201 repo = self.repo |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
202 old_tip = revsymbol(repo, 'tip').node() |
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
203 expected_parent = revsymbol(repo, 'default').node() |
336
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
204 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
|
205 if path == 'adding_file': |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
206 return compathacks.makememfilectx(repo, |
1549
8410a978c650
compathacks: be compatible with upstream 8a0cac20a1ad memfilectx change
Jun Wu <quark@fb.com>
parents:
1539
diff
changeset
|
207 memctx=memctx, |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
208 path=path, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
209 data='foo', |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
210 islink=False, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
211 isexec=False, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
212 copied=False) |
531
cf4fe45bf8fd
Change all instantiations of IOError to set both errno and strerror.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
484
diff
changeset
|
213 raise IOError(errno.EINVAL, 'Invalid operation: ' + path) |
336
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
214 ctx = context.memctx(repo, |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
215 parents=(revsymbol(repo, 'default').node(), node.nullid), |
348
af1508b7ad54
test_push_command: improve readability a bit.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
340
diff
changeset
|
216 text='automated test', |
af1508b7ad54
test_push_command: improve readability a bit.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
340
diff
changeset
|
217 files=['adding_file'], |
af1508b7ad54
test_push_command: improve readability a bit.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
340
diff
changeset
|
218 filectxfn=file_callback, |
af1508b7ad54
test_push_command: improve readability a bit.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
340
diff
changeset
|
219 user='an_author', |
af1508b7ad54
test_push_command: improve readability a bit.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
340
diff
changeset
|
220 date='2008-10-07 20:59:48 -0500', |
832
e9af7eba88db
globally: clean up whitespace around operators and commas to conform with PEP8
Yonggang Luo <luoyonggang@gmail.com>
parents:
816
diff
changeset
|
221 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
|
222 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
|
223 if not commit: |
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
224 return # some tests use this test as an extended setup. |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
225 hg.update(repo, revsymbol(repo, 'tip').node()) |
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
226 oldauthor = revsymbol(repo, 'tip').user() |
336
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
227 commands.push(repo.ui, repo) |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
228 tip = revsymbol(self.repo, 'tip') |
336
c0b943cef0c3
Use try/finally in an attempt to stop leaking svnserve processes.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
229 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
|
230 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
|
231 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
|
232 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
|
233 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
|
234 # unintended behaviour: |
5d0d9424913f
test_push_command: this test causes an author of None.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
348
diff
changeset
|
235 self.assertNotEqual('an_author', tip.user()) |
735
c2b9e08ecf10
maps: map a missing author to '(no author)'
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
690
diff
changeset
|
236 self.assertEqual('(no author)', 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
|
237 finally: |
854
50a09999dce3
tests: push_command: use svnserve.kill() in Python >=2.6
Arne Babenhauserheide <arne.babenhauserheide@fzk.de>
parents:
834
diff
changeset
|
238 if sys.version_info >= (2,6): |
50a09999dce3
tests: push_command: use svnserve.kill() in Python >=2.6
Arne Babenhauserheide <arne.babenhauserheide@fzk.de>
parents:
834
diff
changeset
|
239 svnserve.kill() |
907
173065f9b715
push test: peek inside svn's pending transaction list on abort
Augie Fackler <raf@durin42.com>
parents:
872
diff
changeset
|
240 else: |
854
50a09999dce3
tests: push_command: use svnserve.kill() in Python >=2.6
Arne Babenhauserheide <arne.babenhauserheide@fzk.de>
parents:
834
diff
changeset
|
241 test_util.kill_process(svnserve) |
220
06eb60f9a026
push: Do not attempt to push empty revisions.
Augie Fackler <durin42@gmail.com>
parents:
150
diff
changeset
|
242 |
671
e910e3ebd23b
svnmeta: strip all repeated slashes from subdir
Peter Arrenbrecht <peter.arrenbre...@gmail.com>
parents:
643
diff
changeset
|
243 def test_push_over_svnserve(self): |
e910e3ebd23b
svnmeta: strip all repeated slashes from subdir
Peter Arrenbrecht <peter.arrenbre...@gmail.com>
parents:
643
diff
changeset
|
244 self.internal_push_over_svnserve() |
e910e3ebd23b
svnmeta: strip all repeated slashes from subdir
Peter Arrenbrecht <peter.arrenbre...@gmail.com>
parents:
643
diff
changeset
|
245 |
e910e3ebd23b
svnmeta: strip all repeated slashes from subdir
Peter Arrenbrecht <peter.arrenbre...@gmail.com>
parents:
643
diff
changeset
|
246 def test_push_over_svnserve_with_subdir(self): |
e910e3ebd23b
svnmeta: strip all repeated slashes from subdir
Peter Arrenbrecht <peter.arrenbre...@gmail.com>
parents:
643
diff
changeset
|
247 self.internal_push_over_svnserve(subdir='///branches////the_branch/////') |
e910e3ebd23b
svnmeta: strip all repeated slashes from subdir
Peter Arrenbrecht <peter.arrenbre...@gmail.com>
parents:
643
diff
changeset
|
248 |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
249 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
|
250 repo = self.repo |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
251 old_tip = revsymbol(repo, 'tip').node() |
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
252 expected_parent = revsymbol(repo, 'default').node() |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
253 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
|
254 if path == 'adding_file': |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
255 return compathacks.makememfilectx(repo, |
1549
8410a978c650
compathacks: be compatible with upstream 8a0cac20a1ad memfilectx change
Jun Wu <quark@fb.com>
parents:
1539
diff
changeset
|
256 memctx=memctx, |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
257 path=path, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
258 data='foo', |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
259 islink=False, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
260 isexec=False, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
261 copied=False) |
531
cf4fe45bf8fd
Change all instantiations of IOError to set both errno and strerror.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
484
diff
changeset
|
262 raise IOError(errno.EINVAL, 'Invalid operation: ' + path) |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
263 ctx = context.memctx(repo, |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
264 (revsymbol(repo, 'default').node(), node.nullid), |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
265 'automated test', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
266 ['adding_file'], |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
267 file_callback, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
268 'an_author', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
269 '2008-10-07 20:59:48 -0500', |
832
e9af7eba88db
globally: clean up whitespace around operators and commas to conform with PEP8
Yonggang Luo <luoyonggang@gmail.com>
parents:
816
diff
changeset
|
270 {'branch': 'default', }) |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
271 new_hash = repo.commitctx(ctx) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
272 if not commit: |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
273 return # some tests use this test as an extended setup. |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
274 hg.update(repo, revsymbol(repo, 'tip').node()) |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
275 self.pushrevisions() |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
276 tip = revsymbol(self.repo, 'tip') |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
277 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
|
278 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
|
279 node.hex(expected_parent)) |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
280 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
|
281 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
|
282 |
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
|
283 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
|
284 def filectxfn(repo, memctx, path): |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
285 return compathacks.makememfilectx(repo, |
1549
8410a978c650
compathacks: be compatible with upstream 8a0cac20a1ad memfilectx change
Jun Wu <quark@fb.com>
parents:
1539
diff
changeset
|
286 memctx=memctx, |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
287 path=path, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
288 data=path, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
289 islink=False, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
290 isexec=False, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
291 copied=False) |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
292 oldtiphash = revsymbol(self.repo, 'default').node() |
1539
0ebcc5bbf692
tests: when making a `memctx`, make sure to use a single repo instance
Augie Fackler <raf@durin42.com>
parents:
1522
diff
changeset
|
293 lr = self.repo |
0ebcc5bbf692
tests: when making a `memctx`, make sure to use a single repo instance
Augie Fackler <raf@durin42.com>
parents:
1522
diff
changeset
|
294 ctx = context.memctx(lr, |
0ebcc5bbf692
tests: when making a `memctx`, make sure to use a single repo instance
Augie Fackler <raf@durin42.com>
parents:
1522
diff
changeset
|
295 (lr[0].node(), revlog.nullid,), |
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
|
296 '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
|
297 ['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
|
298 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
|
299 '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
|
300 '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
|
301 {'branch': 'localbranch', }) |
1539
0ebcc5bbf692
tests: when making a `memctx`, make sure to use a single repo instance
Augie Fackler <raf@durin42.com>
parents:
1522
diff
changeset
|
302 newhash = lr.commitctx(ctx) |
0ebcc5bbf692
tests: when making a `memctx`, make sure to use a single repo instance
Augie Fackler <raf@durin42.com>
parents:
1522
diff
changeset
|
303 ctx = context.memctx(lr, |
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
|
304 (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
|
305 '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
|
306 ['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
|
307 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
|
308 '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
|
309 '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
|
310 {'branch': 'localbranch', }) |
1539
0ebcc5bbf692
tests: when making a `memctx`, make sure to use a single repo instance
Augie Fackler <raf@durin42.com>
parents:
1522
diff
changeset
|
311 newhash = lr.commitctx(ctx) |
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
|
312 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
|
313 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
|
314 commands.push(repo.ui, repo) |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
315 self.assertEqual(revsymbol(self.repo, 'tip').parents()[0].parents()[0].node(), oldtiphash) |
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
316 self.assertEqual(revsymbol(self.repo, 'tip').files(), ['delta', ]) |
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
317 self.assertEqual(sorted(revsymbol(self.repo, 'tip').manifest().keys()), |
1321
a36e87ae2380
tests: always compare manifest keys in sorted order
Siddharth Agarwal <sid0@fb.com>
parents:
1239
diff
changeset
|
318 ['alpha', 'beta', 'delta', 'gamma']) |
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
|
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_two_revs(self): |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
321 # 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
|
322 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
|
323 repo = self.repo |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
324 old_tip = revsymbol(repo, 'tip').node() |
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
325 expected_parent = revsymbol(repo, 'tip').parents()[0].node() |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
326 def file_callback(repo, memctx, path): |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
327 if path == 'adding_file2': |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
328 return compathacks.makememfilectx(repo, |
1549
8410a978c650
compathacks: be compatible with upstream 8a0cac20a1ad memfilectx change
Jun Wu <quark@fb.com>
parents:
1539
diff
changeset
|
329 memctx=memctx, |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
330 path=path, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
331 data='foo2', |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
332 islink=False, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
333 isexec=False, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
334 copied=False) |
531
cf4fe45bf8fd
Change all instantiations of IOError to set both errno and strerror.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
484
diff
changeset
|
335 raise IOError(errno.EINVAL, 'Invalid operation: ' + path) |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
336 ctx = context.memctx(repo, |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
337 (revsymbol(repo, 'default').node(), node.nullid), |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
338 'automated test', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
339 ['adding_file2'], |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
340 file_callback, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
341 'an_author', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
342 '2008-10-07 20:59:48 -0500', |
832
e9af7eba88db
globally: clean up whitespace around operators and commas to conform with PEP8
Yonggang Luo <luoyonggang@gmail.com>
parents:
816
diff
changeset
|
343 {'branch': 'default', }) |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
344 new_hash = repo.commitctx(ctx) |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
345 hg.update(repo, revsymbol(repo, 'tip').node()) |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
346 self.pushrevisions() |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
347 tip = revsymbol(self.repo, 'tip') |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
348 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
|
349 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
|
350 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
|
351 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
|
352 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
|
353 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
|
354 try: |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
355 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
|
356 assert False, "this is impossible, adding_file2 should not be in this manifest." |
1584
2b342625a92a
test: add compat code for removed revlog.LookupError in test_push_command.py
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
1570
diff
changeset
|
357 except lookuperror, e: |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
358 pass |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
359 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
|
360 |
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
|
361 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
|
362 repo = self.repo |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
363 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
|
364 if path == 'adding_file': |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
365 return compathacks.makememfilectx(repo, |
1549
8410a978c650
compathacks: be compatible with upstream 8a0cac20a1ad memfilectx change
Jun Wu <quark@fb.com>
parents:
1539
diff
changeset
|
366 memctx=memctx, |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
367 path=path, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
368 data='foo', |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
369 islink=False, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
370 isexec=False, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
371 copied=False) |
531
cf4fe45bf8fd
Change all instantiations of IOError to set both errno and strerror.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
484
diff
changeset
|
372 raise IOError(errno.EINVAL, 'Invalid operation: ' + path) |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
373 ctx = context.memctx(repo, |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
374 (revsymbol(repo, 'the_branch').node(), node.nullid), |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
375 'automated test', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
376 ['adding_file'], |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
377 file_callback, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
378 'an_author', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
379 '2008-10-07 20:59:48 -0500', |
832
e9af7eba88db
globally: clean up whitespace around operators and commas to conform with PEP8
Yonggang Luo <luoyonggang@gmail.com>
parents:
816
diff
changeset
|
380 {'branch': 'the_branch', }) |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
381 new_hash = repo.commitctx(ctx) |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
382 hg.update(repo, revsymbol(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
|
383 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
|
384 self.pushrevisions() |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
385 tip = revsymbol(self.repo, 'tip') |
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
|
386 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
|
387 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
|
388 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
|
389 |
625
96552e855d7e
tests: fix misnamed test caught while hunting unrelated bugs
Augie Fackler <durin42@gmail.com>
parents:
576
diff
changeset
|
390 def test_push_to_non_tip(self): |
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
|
391 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
|
392 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
|
393 u = self.repo.ui |
816
86d124a8768e
Fix hg.clone() calls changed by d976542986d2
Patrick Mezard <pmezard@gmail.com>
parents:
735
diff
changeset
|
394 test_util.hgclone(self.repo.ui, self.wc_path, wc2path, update=False) |
626
8e621dbb82d4
push: return reasonable status codes to the end user
Augie Fackler <durin42@gmail.com>
parents:
625
diff
changeset
|
395 res = self.pushrevisions() |
8e621dbb82d4
push: return reasonable status codes to the end user
Augie Fackler <durin42@gmail.com>
parents:
625
diff
changeset
|
396 self.assertEqual(0, res) |
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
|
397 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
|
398 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
|
399 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
|
400 shutil.rmtree(self.wc_path) |
816
86d124a8768e
Fix hg.clone() calls changed by d976542986d2
Patrick Mezard <pmezard@gmail.com>
parents:
735
diff
changeset
|
401 test_util.hgclone(u, wc2path, self.wc_path, update=False) |
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
|
402 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
|
403 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
|
404 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
|
405 |
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
|
406 # do a commit here |
832
e9af7eba88db
globally: clean up whitespace around operators and commas to conform with PEP8
Yonggang Luo <luoyonggang@gmail.com>
parents:
816
diff
changeset
|
407 self.commitchanges([('foobaz', 'foobaz', 'This file is added on default.',), |
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
|
408 ], |
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
|
409 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
|
410 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
|
411 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
|
412 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
|
413 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
|
414 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
|
415 |
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
|
416 |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
417 hg.update(self.repo, revsymbol(self.repo, 'tip').node()) |
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
418 oldnode = revsymbol(self.repo, 'tip').hex() |
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
|
419 self.pushrevisions(expected_extra_back=1) |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
420 self.assertNotEqual(oldnode, revsymbol(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
|
421 |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
422 def test_delete_file(self): |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
423 repo = self.repo |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
424 def file_callback(repo, memctx, path): |
1239
f96e2495de39
test_push_command: use compat hack for filectxfn for deleted files
Siddharth Agarwal <sid0@fb.com>
parents:
1236
diff
changeset
|
425 return compathacks.filectxfn_deleted(memctx, path) |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
426 old_files = set(revsymbol(repo, 'default').manifest().keys()) |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
427 ctx = context.memctx(repo, |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
428 (revsymbol(repo, 'default').node(), node.nullid), |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
429 'automated test', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
430 ['alpha'], |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
431 file_callback, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
432 'an author', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
433 '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
|
434 {'branch': 'default', }) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
435 new_hash = repo.commitctx(ctx) |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
436 hg.update(repo, revsymbol(repo, 'tip').node()) |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
437 self.pushrevisions() |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
438 tip = revsymbol(self.repo, 'tip') |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
439 self.assertEqual(old_files, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
440 set(tip.manifest().keys() + ['alpha'])) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
441 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
|
442 |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
443 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
|
444 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
|
445 repo = self.repo |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
446 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
|
447 if path == 'gamma': |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
448 return compathacks.makememfilectx(repo, |
1549
8410a978c650
compathacks: be compatible with upstream 8a0cac20a1ad memfilectx change
Jun Wu <quark@fb.com>
parents:
1539
diff
changeset
|
449 memctx=memctx, |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
450 path=path, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
451 data='foo', |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
452 islink=False, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
453 isexec=True, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
454 copied=False) |
531
cf4fe45bf8fd
Change all instantiations of IOError to set both errno and strerror.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
484
diff
changeset
|
455 raise IOError(errno.EINVAL, 'Invalid operation: ' + path) |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
456 ctx = context.memctx(repo, |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
457 (revsymbol(repo, 'tip').node(), node.nullid), |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
458 'message', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
459 ['gamma', ], |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
460 file_callback, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
461 'author', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
462 '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
|
463 {'branch': 'default', }) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
464 new_hash = repo.commitctx(ctx) |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
465 hg.clean(repo, revsymbol(repo, 'tip').node()) |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
466 self.pushrevisions() |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
467 tip = revsymbol(self.repo, 'tip') |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
468 self.assertNotEqual(tip.node(), new_hash) |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
469 self.assert_('@' in revsymbol(self.repo, 'tip').user()) |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
470 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
|
471 self.assertEqual(tip['gamma'].data(), 'foo') |
1321
a36e87ae2380
tests: always compare manifest keys in sorted order
Siddharth Agarwal <sid0@fb.com>
parents:
1239
diff
changeset
|
472 self.assertEqual(sorted([x for x in tip.manifest().keys() if 'x' not in |
a36e87ae2380
tests: always compare manifest keys in sorted order
Siddharth Agarwal <sid0@fb.com>
parents:
1239
diff
changeset
|
473 tip[x].flags()]), |
a36e87ae2380
tests: always compare manifest keys in sorted order
Siddharth Agarwal <sid0@fb.com>
parents:
1239
diff
changeset
|
474 ['adding_file', 'alpha', 'beta', ]) |
49
2bc4999a89d3
Add tests for a bunch more cases in pushing to svn.
Augie Fackler <durin42@gmail.com>
parents:
48
diff
changeset
|
475 |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
476 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
|
477 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
|
478 repo = self.repo |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
479 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
|
480 if path == 'gamma': |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
481 return compathacks.makememfilectx(repo, |
1549
8410a978c650
compathacks: be compatible with upstream 8a0cac20a1ad memfilectx change
Jun Wu <quark@fb.com>
parents:
1539
diff
changeset
|
482 memctx=memctx, |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
483 path=path, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
484 data='foo', |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
485 islink=True, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
486 isexec=False, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
487 copied=False) |
531
cf4fe45bf8fd
Change all instantiations of IOError to set both errno and strerror.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
484
diff
changeset
|
488 raise IOError(errno.EINVAL, 'Invalid operation: ' + path) |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
489 ctx = context.memctx(repo, |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
490 (revsymbol(repo, 'tip').node(), node.nullid), |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
491 'message', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
492 ['gamma', ], |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
493 file_callback, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
494 'author', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
495 '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
|
496 {'branch': 'default', }) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
497 new_hash = repo.commitctx(ctx) |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
498 hg.update(repo, revsymbol(repo, 'tip').node()) |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
499 self.pushrevisions() |
1229
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
500 # grab a new repo instance (self.repo is an @property functions) |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
501 repo = self.repo |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
502 tip = revsymbol(repo, 'tip') |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
503 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
|
504 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
|
505 self.assertEqual(tip['gamma'].data(), 'foo') |
1321
a36e87ae2380
tests: always compare manifest keys in sorted order
Siddharth Agarwal <sid0@fb.com>
parents:
1239
diff
changeset
|
506 self.assertEqual(sorted([x for x in tip.manifest().keys() if 'l' not in |
a36e87ae2380
tests: always compare manifest keys in sorted order
Siddharth Agarwal <sid0@fb.com>
parents:
1239
diff
changeset
|
507 tip[x].flags()]), |
a36e87ae2380
tests: always compare manifest keys in sorted order
Siddharth Agarwal <sid0@fb.com>
parents:
1239
diff
changeset
|
508 ['adding_file', 'alpha', 'beta', ]) |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
509 |
1229
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
510 def file_callback2(repo, memctx, path): |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
511 if path == 'gamma': |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
512 return compathacks.makememfilectx(repo, |
1549
8410a978c650
compathacks: be compatible with upstream 8a0cac20a1ad memfilectx change
Jun Wu <quark@fb.com>
parents:
1539
diff
changeset
|
513 memctx=memctx, |
1229
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
514 path=path, |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
515 data='a' * 129, |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
516 islink=True, |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
517 isexec=False, |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
518 copied=False) |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
519 raise IOError(errno.EINVAL, 'Invalid operation: ' + path) |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
520 |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
521 ctx = context.memctx(repo, |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
522 (revsymbol(repo, 'tip').node(), node.nullid), |
1229
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
523 'message', |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
524 ['gamma', ], |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
525 file_callback2, |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
526 'author', |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
527 '2014-08-08 20:11:41 -0700', |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
528 {'branch': 'default', }) |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
529 repo.commitctx(ctx) |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
530 hg.update(repo, revsymbol(repo, 'tip').node()) |
1229
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
531 self.pushrevisions() |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
532 # grab a new repo instance (self.repo is an @property functions) |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
533 repo = self.repo |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
534 tip = revsymbol(repo, 'tip') |
1229
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
535 self.assertEqual(tip['gamma'].flags(), 'l') |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
536 self.assertEqual(tip['gamma'].data(), 'a'*129) |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
537 |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
538 def file_callback3(repo, memctx, path): |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
539 if path == 'gamma': |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
540 return compathacks.makememfilectx(repo, |
1549
8410a978c650
compathacks: be compatible with upstream 8a0cac20a1ad memfilectx change
Jun Wu <quark@fb.com>
parents:
1539
diff
changeset
|
541 memctx=memctx, |
1229
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
542 path=path, |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
543 data='a' * 64 + 'b' * 65, |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
544 islink=True, |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
545 isexec=False, |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
546 copied=False) |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
547 raise IOError(errno.EINVAL, 'Invalid operation: ' + path) |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
548 |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
549 ctx = context.memctx(repo, |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
550 (revsymbol(repo, 'tip').node(), node.nullid), |
1229
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
551 'message', |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
552 ['gamma', ], |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
553 file_callback3, |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
554 'author', |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
555 '2014-08-08 20:16:25 -0700', |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
556 {'branch': 'default', }) |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
557 repo.commitctx(ctx) |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
558 hg.update(repo, revsymbol(repo, 'tip').node()) |
1229
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
559 self.pushrevisions() |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
560 repo = self.repo |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
561 tip = revsymbol(repo, 'tip') |
1229
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
562 self.assertEqual(tip['gamma'].flags(), 'l') |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
563 self.assertEqual(tip['gamma'].data(), 'a' * 64 + 'b' * 65) |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
564 |
46523cdfd3b0
pushmod: prepend "link " to base text for links
David Schleimer <dschleimer@gmail.com>
parents:
1202
diff
changeset
|
565 |
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
|
566 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
|
567 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
|
568 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
|
569 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
|
570 |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
571 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
|
572 link=False, expected_flags='x'): |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
573 self.test_push_to_default() |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
574 repo = self.repo |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
575 def file_callback(repo, memctx, path): |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
576 return compathacks.makememfilectx(repo, |
1549
8410a978c650
compathacks: be compatible with upstream 8a0cac20a1ad memfilectx change
Jun Wu <quark@fb.com>
parents:
1539
diff
changeset
|
577 memctx=memctx, |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
578 path=path, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
579 data='foo', |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
580 islink=link, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
581 isexec=execute, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
582 copied=False) |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
583 ctx = context.memctx(repo, |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
584 (revsymbol(repo, 'default').node(), node.nullid), |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
585 'message', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
586 ['alpha', ], |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
587 file_callback, |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
588 'author', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
589 '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
|
590 {'branch': 'default', }) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
591 new_hash = repo.commitctx(ctx) |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
592 hg.update(repo, revsymbol(repo, 'tip').node()) |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
593 self.pushrevisions() |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
594 tip = revsymbol(self.repo, 'tip') |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
595 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
|
596 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
|
597 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
|
598 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
|
599 # 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
|
600 # works |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
601 repo = self.repo |
101
a3b717e4abf5
Cleanups based on pyflakes output.
Augie Fackler <durin42@gmail.com>
parents:
83
diff
changeset
|
602 def file_callback2(repo, memctx, path): |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
603 return compathacks.makememfilectx(repo, |
1549
8410a978c650
compathacks: be compatible with upstream 8a0cac20a1ad memfilectx change
Jun Wu <quark@fb.com>
parents:
1539
diff
changeset
|
604 memctx=memctx, |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
605 path=path, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
606 data='bar', |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
607 islink=link, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
608 isexec=execute, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
609 copied=False) |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
610 ctx = context.memctx(repo, |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
611 (revsymbol(repo, 'default').node(), node.nullid), |
1206
aa8b72bd1320
test_push_command: improve commit messages inside test for diagnostics
Augie Fackler <raf@durin42.com>
parents:
1202
diff
changeset
|
612 'mutate already-special file alpha', |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
613 ['alpha', ], |
101
a3b717e4abf5
Cleanups based on pyflakes output.
Augie Fackler <durin42@gmail.com>
parents:
83
diff
changeset
|
614 file_callback2, |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
615 'author', |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
616 '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
|
617 {'branch': 'default', }) |
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
618 new_hash = repo.commitctx(ctx) |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
619 hg.update(repo, revsymbol(repo, 'tip').node()) |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
620 self.pushrevisions() |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
621 tip = revsymbol(self.repo, 'tip') |
50
80b923ab242b
Drop any pretense of supporting svn 1.4.x.
Augie Fackler <durin42@gmail.com>
parents:
49
diff
changeset
|
622 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
|
623 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
|
624 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
|
625 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
|
626 # 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
|
627 repo = self.repo |
101
a3b717e4abf5
Cleanups based on pyflakes output.
Augie Fackler <durin42@gmail.com>
parents:
83
diff
changeset
|
628 def file_callback3(repo, memctx, path): |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
629 return compathacks.makememfilectx(repo, |
1549
8410a978c650
compathacks: be compatible with upstream 8a0cac20a1ad memfilectx change
Jun Wu <quark@fb.com>
parents:
1539
diff
changeset
|
630 memctx=memctx, |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
631 path=path, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
632 data='bar', |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
633 islink=False, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
634 isexec=False, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
635 copied=False) |
62
cc5ebdb1e8d4
push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents:
60
diff
changeset
|
636 ctx = context.memctx(repo, |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
637 (revsymbol(repo, 'default').node(), node.nullid), |
1206
aa8b72bd1320
test_push_command: improve commit messages inside test for diagnostics
Augie Fackler <raf@durin42.com>
parents:
1202
diff
changeset
|
638 'convert alpha back to regular file', |
62
cc5ebdb1e8d4
push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents:
60
diff
changeset
|
639 ['alpha', ], |
101
a3b717e4abf5
Cleanups based on pyflakes output.
Augie Fackler <durin42@gmail.com>
parents:
83
diff
changeset
|
640 file_callback3, |
62
cc5ebdb1e8d4
push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents:
60
diff
changeset
|
641 'author', |
cc5ebdb1e8d4
push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents:
60
diff
changeset
|
642 '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
|
643 {'branch': 'default', }) |
cc5ebdb1e8d4
push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents:
60
diff
changeset
|
644 new_hash = repo.commitctx(ctx) |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
645 hg.update(repo, revsymbol(repo, 'tip').node()) |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
65
diff
changeset
|
646 self.pushrevisions() |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
647 tip = revsymbol(self.repo, 'tip') |
62
cc5ebdb1e8d4
push_cmd: Further simplified some logic thanks to an improved test.
Augie Fackler <durin42@gmail.com>
parents:
60
diff
changeset
|
648 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
|
649 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
|
650 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
|
651 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
|
652 |
277
3848a7f9b983
push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
653 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
|
654 self.test_push_two_revs() |
832
e9af7eba88db
globally: clean up whitespace around operators and commas to conform with PEP8
Yonggang Luo <luoyonggang@gmail.com>
parents:
816
diff
changeset
|
655 changes = [('adding_file', 'adding_file', 'different_content',), |
277
3848a7f9b983
push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
656 ] |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
657 par = revsymbol(self.repo, 'tip').rev() |
690
4b55fb6d6847
tests: remove constant rev no from test script
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
671
diff
changeset
|
658 self.commitchanges(changes, parent=par) |
277
3848a7f9b983
push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
659 self.pushrevisions() |
3848a7f9b983
push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
660 changes = [('adding_file', 'adding_file', |
832
e9af7eba88db
globally: clean up whitespace around operators and commas to conform with PEP8
Yonggang Luo <luoyonggang@gmail.com>
parents:
816
diff
changeset
|
661 'even_more different_content',), |
277
3848a7f9b983
push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
662 ] |
690
4b55fb6d6847
tests: remove constant rev no from test script
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
671
diff
changeset
|
663 self.commitchanges(changes, parent=par) |
277
3848a7f9b983
push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
664 try: |
3848a7f9b983
push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
665 self.pushrevisions() |
3848a7f9b983
push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
666 assert False, 'This should have aborted!' |
1555
cff81f35b31e
cleanup: reference Abort from mercurial.error instead of mercurial.util
Augie Fackler <raf@durin42.com>
parents:
1549
diff
changeset
|
667 except hgerror.Abort, e: |
277
3848a7f9b983
push: Add a test that demonstrates base-text detection works
Augie Fackler <durin42@gmail.com>
parents:
257
diff
changeset
|
668 self.assertEqual(e.args[0], |
556
8522f8ef799e
pushmod: make outdated parent error message more helpful
Patrick Mezard <pmezard@gmail.com>
parents:
531
diff
changeset
|
669 'Outgoing changesets parent is not at subversion ' |
8522f8ef799e
pushmod: make outdated parent error message more helpful
Patrick Mezard <pmezard@gmail.com>
parents:
531
diff
changeset
|
670 'HEAD\n' |
8522f8ef799e
pushmod: make outdated parent error message more helpful
Patrick Mezard <pmezard@gmail.com>
parents:
531
diff
changeset
|
671 '(pull again and rebase on a newer revision)') |
907
173065f9b715
push test: peek inside svn's pending transaction list on abort
Augie Fackler <raf@durin42.com>
parents:
872
diff
changeset
|
672 # verify that any pending transactions on the server got cleaned up |
173065f9b715
push test: peek inside svn's pending transaction list on abort
Augie Fackler <raf@durin42.com>
parents:
872
diff
changeset
|
673 self.assertEqual([], os.listdir( |
173065f9b715
push test: peek inside svn's pending transaction list on abort
Augie Fackler <raf@durin42.com>
parents:
872
diff
changeset
|
674 os.path.join(self.tmpdir, 'testrepo-1', 'db', 'transactions'))) |
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
|
675 |
928
d99ed94f4760
wrappers: do not change encoding when pushing
Patrick Mezard <patrick@mezard.eu>
parents:
907
diff
changeset
|
676 def test_push_encoding(self): |
d99ed94f4760
wrappers: do not change encoding when pushing
Patrick Mezard <patrick@mezard.eu>
parents:
907
diff
changeset
|
677 self.test_push_two_revs() |
d99ed94f4760
wrappers: do not change encoding when pushing
Patrick Mezard <patrick@mezard.eu>
parents:
907
diff
changeset
|
678 # Writing then rebasing UTF-8 filenames in a cp1252 windows console |
d99ed94f4760
wrappers: do not change encoding when pushing
Patrick Mezard <patrick@mezard.eu>
parents:
907
diff
changeset
|
679 # used to fail because hg internal encoding was being changed during |
d99ed94f4760
wrappers: do not change encoding when pushing
Patrick Mezard <patrick@mezard.eu>
parents:
907
diff
changeset
|
680 # the interactions with subversion, *and during the rebase*, which |
d99ed94f4760
wrappers: do not change encoding when pushing
Patrick Mezard <patrick@mezard.eu>
parents:
907
diff
changeset
|
681 # confused the dirstate and made it believe the file was deleted. |
d99ed94f4760
wrappers: do not change encoding when pushing
Patrick Mezard <patrick@mezard.eu>
parents:
907
diff
changeset
|
682 fn = 'pi\xc3\xa8ce/test' |
d99ed94f4760
wrappers: do not change encoding when pushing
Patrick Mezard <patrick@mezard.eu>
parents:
907
diff
changeset
|
683 changes = [(fn, fn, 'a')] |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
684 par = revsymbol(self.repo, 'tip').rev() |
928
d99ed94f4760
wrappers: do not change encoding when pushing
Patrick Mezard <patrick@mezard.eu>
parents:
907
diff
changeset
|
685 self.commitchanges(changes, parent=par) |
d99ed94f4760
wrappers: do not change encoding when pushing
Patrick Mezard <patrick@mezard.eu>
parents:
907
diff
changeset
|
686 self.pushrevisions() |
d99ed94f4760
wrappers: do not change encoding when pushing
Patrick Mezard <patrick@mezard.eu>
parents:
907
diff
changeset
|
687 |
929
8417be758047
pushmod: keep the root svn dir when emptying the hg repo (issue359)
Patrick Mezard <patrick@mezard.eu>
parents:
928
diff
changeset
|
688 def test_push_emptying_changeset(self): |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
689 r = revsymbol(self.repo, 'tip') |
929
8417be758047
pushmod: keep the root svn dir when emptying the hg repo (issue359)
Patrick Mezard <patrick@mezard.eu>
parents:
928
diff
changeset
|
690 changes = [ |
8417be758047
pushmod: keep the root svn dir when emptying the hg repo (issue359)
Patrick Mezard <patrick@mezard.eu>
parents:
928
diff
changeset
|
691 ('alpha', None, None), |
8417be758047
pushmod: keep the root svn dir when emptying the hg repo (issue359)
Patrick Mezard <patrick@mezard.eu>
parents:
928
diff
changeset
|
692 ('beta', None, None), |
8417be758047
pushmod: keep the root svn dir when emptying the hg repo (issue359)
Patrick Mezard <patrick@mezard.eu>
parents:
928
diff
changeset
|
693 ] |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
694 parent = revsymbol(self.repo, 'tip').rev() |
929
8417be758047
pushmod: keep the root svn dir when emptying the hg repo (issue359)
Patrick Mezard <patrick@mezard.eu>
parents:
928
diff
changeset
|
695 self.commitchanges(changes, parent=parent) |
8417be758047
pushmod: keep the root svn dir when emptying the hg repo (issue359)
Patrick Mezard <patrick@mezard.eu>
parents:
928
diff
changeset
|
696 self.pushrevisions() |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
697 self.assertEqual(len(revsymbol(self.repo, 'tip').manifest()), 0) |
929
8417be758047
pushmod: keep the root svn dir when emptying the hg repo (issue359)
Patrick Mezard <patrick@mezard.eu>
parents:
928
diff
changeset
|
698 |
8417be758047
pushmod: keep the root svn dir when emptying the hg repo (issue359)
Patrick Mezard <patrick@mezard.eu>
parents:
928
diff
changeset
|
699 # Try to re-add a file after emptying the branch |
8417be758047
pushmod: keep the root svn dir when emptying the hg repo (issue359)
Patrick Mezard <patrick@mezard.eu>
parents:
928
diff
changeset
|
700 changes = [ |
8417be758047
pushmod: keep the root svn dir when emptying the hg repo (issue359)
Patrick Mezard <patrick@mezard.eu>
parents:
928
diff
changeset
|
701 ('alpha', 'alpha', 'alpha'), |
8417be758047
pushmod: keep the root svn dir when emptying the hg repo (issue359)
Patrick Mezard <patrick@mezard.eu>
parents:
928
diff
changeset
|
702 ] |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
703 self.commitchanges(changes, parent=revsymbol(self.repo, 'tip').rev()) |
929
8417be758047
pushmod: keep the root svn dir when emptying the hg repo (issue359)
Patrick Mezard <patrick@mezard.eu>
parents:
928
diff
changeset
|
704 self.pushrevisions() |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
705 self.assertEqual(['alpha'], list(revsymbol(self.repo, 'tip').manifest())) |
929
8417be758047
pushmod: keep the root svn dir when emptying the hg repo (issue359)
Patrick Mezard <patrick@mezard.eu>
parents:
928
diff
changeset
|
706 |
990
def2144c0a8c
push: rebase one at a time before push
Durham Goode <durham@fb.com>
parents:
929
diff
changeset
|
707 def test_push_without_pushing_children(self): |
def2144c0a8c
push: rebase one at a time before push
Durham Goode <durham@fb.com>
parents:
929
diff
changeset
|
708 ''' |
def2144c0a8c
push: rebase one at a time before push
Durham Goode <durham@fb.com>
parents:
929
diff
changeset
|
709 Verify that a push of a nontip node, keeps the tip child |
def2144c0a8c
push: rebase one at a time before push
Durham Goode <durham@fb.com>
parents:
929
diff
changeset
|
710 on top of the pushed commit. |
def2144c0a8c
push: rebase one at a time before push
Durham Goode <durham@fb.com>
parents:
929
diff
changeset
|
711 ''' |
def2144c0a8c
push: rebase one at a time before push
Durham Goode <durham@fb.com>
parents:
929
diff
changeset
|
712 |
1048
903c9c9dfe6a
tests: count revisions explicitly
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1044
diff
changeset
|
713 oldlen = test_util.repolen(self.repo) |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
714 oldtiphash = revsymbol(self.repo, 'default').node() |
990
def2144c0a8c
push: rebase one at a time before push
Durham Goode <durham@fb.com>
parents:
929
diff
changeset
|
715 |
def2144c0a8c
push: rebase one at a time before push
Durham Goode <durham@fb.com>
parents:
929
diff
changeset
|
716 changes = [('gamma', 'gamma', 'sometext')] |
def2144c0a8c
push: rebase one at a time before push
Durham Goode <durham@fb.com>
parents:
929
diff
changeset
|
717 newhash1 = self.commitchanges(changes) |
def2144c0a8c
push: rebase one at a time before push
Durham Goode <durham@fb.com>
parents:
929
diff
changeset
|
718 |
def2144c0a8c
push: rebase one at a time before push
Durham Goode <durham@fb.com>
parents:
929
diff
changeset
|
719 changes = [('delta', 'delta', 'sometext')] |
def2144c0a8c
push: rebase one at a time before push
Durham Goode <durham@fb.com>
parents:
929
diff
changeset
|
720 newhash2 = self.commitchanges(changes) |
def2144c0a8c
push: rebase one at a time before push
Durham Goode <durham@fb.com>
parents:
929
diff
changeset
|
721 |
def2144c0a8c
push: rebase one at a time before push
Durham Goode <durham@fb.com>
parents:
929
diff
changeset
|
722 # push only the first commit |
def2144c0a8c
push: rebase one at a time before push
Durham Goode <durham@fb.com>
parents:
929
diff
changeset
|
723 repo = self.repo |
def2144c0a8c
push: rebase one at a time before push
Durham Goode <durham@fb.com>
parents:
929
diff
changeset
|
724 hg.update(repo, newhash1) |
def2144c0a8c
push: rebase one at a time before push
Durham Goode <durham@fb.com>
parents:
929
diff
changeset
|
725 commands.push(repo.ui, repo) |
1048
903c9c9dfe6a
tests: count revisions explicitly
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1044
diff
changeset
|
726 self.assertEqual(test_util.repolen(self.repo), oldlen + 2) |
990
def2144c0a8c
push: rebase one at a time before push
Durham Goode <durham@fb.com>
parents:
929
diff
changeset
|
727 |
def2144c0a8c
push: rebase one at a time before push
Durham Goode <durham@fb.com>
parents:
929
diff
changeset
|
728 # verify that the first commit is pushed, and the second is not |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
729 commit2 = revsymbol(self.repo, 'tip') |
990
def2144c0a8c
push: rebase one at a time before push
Durham Goode <durham@fb.com>
parents:
929
diff
changeset
|
730 self.assertEqual(commit2.files(), ['delta', ]) |
1040
ada2400241c4
fixes for running under Mercurial 2.0
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1036
diff
changeset
|
731 self.assertEqual(util.getsvnrev(commit2), None) |
990
def2144c0a8c
push: rebase one at a time before push
Durham Goode <durham@fb.com>
parents:
929
diff
changeset
|
732 commit1 = commit2.parents()[0] |
def2144c0a8c
push: rebase one at a time before push
Durham Goode <durham@fb.com>
parents:
929
diff
changeset
|
733 self.assertEqual(commit1.files(), ['gamma', ]) |
1040
ada2400241c4
fixes for running under Mercurial 2.0
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1036
diff
changeset
|
734 prefix = 'svn:' + self.repo.svnmeta().uuid |
ada2400241c4
fixes for running under Mercurial 2.0
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1036
diff
changeset
|
735 self.assertEqual(util.getsvnrev(commit1), |
ada2400241c4
fixes for running under Mercurial 2.0
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1036
diff
changeset
|
736 prefix + '/branches/the_branch@5') |
990
def2144c0a8c
push: rebase one at a time before push
Durham Goode <durham@fb.com>
parents:
929
diff
changeset
|
737 |
991
26e9fd21f3bf
push: avoid rebasing when we know there are no conflicts
Durham Goode <durham@fb.com>
parents:
990
diff
changeset
|
738 def test_push_two_that_modify_same_file(self): |
26e9fd21f3bf
push: avoid rebasing when we know there are no conflicts
Durham Goode <durham@fb.com>
parents:
990
diff
changeset
|
739 ''' |
26e9fd21f3bf
push: avoid rebasing when we know there are no conflicts
Durham Goode <durham@fb.com>
parents:
990
diff
changeset
|
740 Push performs a rebase if two commits touch the same file. |
26e9fd21f3bf
push: avoid rebasing when we know there are no conflicts
Durham Goode <durham@fb.com>
parents:
990
diff
changeset
|
741 This test verifies that code path works. |
26e9fd21f3bf
push: avoid rebasing when we know there are no conflicts
Durham Goode <durham@fb.com>
parents:
990
diff
changeset
|
742 ''' |
26e9fd21f3bf
push: avoid rebasing when we know there are no conflicts
Durham Goode <durham@fb.com>
parents:
990
diff
changeset
|
743 |
1048
903c9c9dfe6a
tests: count revisions explicitly
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1044
diff
changeset
|
744 oldlen = test_util.repolen(self.repo) |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
745 oldtiphash = revsymbol(self.repo, 'default').node() |
991
26e9fd21f3bf
push: avoid rebasing when we know there are no conflicts
Durham Goode <durham@fb.com>
parents:
990
diff
changeset
|
746 |
26e9fd21f3bf
push: avoid rebasing when we know there are no conflicts
Durham Goode <durham@fb.com>
parents:
990
diff
changeset
|
747 changes = [('gamma', 'gamma', 'sometext')] |
26e9fd21f3bf
push: avoid rebasing when we know there are no conflicts
Durham Goode <durham@fb.com>
parents:
990
diff
changeset
|
748 newhash = self.commitchanges(changes) |
26e9fd21f3bf
push: avoid rebasing when we know there are no conflicts
Durham Goode <durham@fb.com>
parents:
990
diff
changeset
|
749 changes = [('gamma', 'gamma', 'sometext\n moretext'), |
26e9fd21f3bf
push: avoid rebasing when we know there are no conflicts
Durham Goode <durham@fb.com>
parents:
990
diff
changeset
|
750 ('delta', 'delta', 'sometext\n moretext'), |
26e9fd21f3bf
push: avoid rebasing when we know there are no conflicts
Durham Goode <durham@fb.com>
parents:
990
diff
changeset
|
751 ] |
26e9fd21f3bf
push: avoid rebasing when we know there are no conflicts
Durham Goode <durham@fb.com>
parents:
990
diff
changeset
|
752 newhash = self.commitchanges(changes) |
26e9fd21f3bf
push: avoid rebasing when we know there are no conflicts
Durham Goode <durham@fb.com>
parents:
990
diff
changeset
|
753 |
26e9fd21f3bf
push: avoid rebasing when we know there are no conflicts
Durham Goode <durham@fb.com>
parents:
990
diff
changeset
|
754 repo = self.repo |
26e9fd21f3bf
push: avoid rebasing when we know there are no conflicts
Durham Goode <durham@fb.com>
parents:
990
diff
changeset
|
755 hg.update(repo, newhash) |
26e9fd21f3bf
push: avoid rebasing when we know there are no conflicts
Durham Goode <durham@fb.com>
parents:
990
diff
changeset
|
756 commands.push(repo.ui, repo) |
1048
903c9c9dfe6a
tests: count revisions explicitly
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1044
diff
changeset
|
757 self.assertEqual(test_util.repolen(self.repo), oldlen + 2) |
991
26e9fd21f3bf
push: avoid rebasing when we know there are no conflicts
Durham Goode <durham@fb.com>
parents:
990
diff
changeset
|
758 |
26e9fd21f3bf
push: avoid rebasing when we know there are no conflicts
Durham Goode <durham@fb.com>
parents:
990
diff
changeset
|
759 # verify that both commits are pushed |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
760 commit1 = revsymbol(self.repo, 'tip') |
991
26e9fd21f3bf
push: avoid rebasing when we know there are no conflicts
Durham Goode <durham@fb.com>
parents:
990
diff
changeset
|
761 self.assertEqual(commit1.files(), ['delta', 'gamma']) |
1040
ada2400241c4
fixes for running under Mercurial 2.0
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1036
diff
changeset
|
762 |
ada2400241c4
fixes for running under Mercurial 2.0
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1036
diff
changeset
|
763 prefix = 'svn:' + self.repo.svnmeta().uuid |
ada2400241c4
fixes for running under Mercurial 2.0
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1036
diff
changeset
|
764 self.assertEqual(util.getsvnrev(commit1), |
ada2400241c4
fixes for running under Mercurial 2.0
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1036
diff
changeset
|
765 prefix + '/branches/the_branch@6') |
991
26e9fd21f3bf
push: avoid rebasing when we know there are no conflicts
Durham Goode <durham@fb.com>
parents:
990
diff
changeset
|
766 commit2 = commit1.parents()[0] |
26e9fd21f3bf
push: avoid rebasing when we know there are no conflicts
Durham Goode <durham@fb.com>
parents:
990
diff
changeset
|
767 self.assertEqual(commit2.files(), ['gamma']) |
1040
ada2400241c4
fixes for running under Mercurial 2.0
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1036
diff
changeset
|
768 self.assertEqual(util.getsvnrev(commit2), |
ada2400241c4
fixes for running under Mercurial 2.0
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1036
diff
changeset
|
769 prefix + '/branches/the_branch@5') |
991
26e9fd21f3bf
push: avoid rebasing when we know there are no conflicts
Durham Goode <durham@fb.com>
parents:
990
diff
changeset
|
770 |
992
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
771 def test_push_in_subdir(self, commit=True): |
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
772 repo = self.repo |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
773 old_tip = revsymbol(repo, 'tip').node() |
992
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
774 def file_callback(repo, memctx, path): |
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
775 if path == 'adding_file' or path == 'newdir/new_file': |
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
776 testData = 'fooFirstFile' |
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
777 if path == 'newdir/new_file': |
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
778 testData = 'fooNewFile' |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
779 return compathacks.makememfilectx(repo, |
1549
8410a978c650
compathacks: be compatible with upstream 8a0cac20a1ad memfilectx change
Jun Wu <quark@fb.com>
parents:
1539
diff
changeset
|
780 memctx=memctx, |
1202
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
781 path=path, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
782 data=testData, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
783 islink=False, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
784 isexec=False, |
cccc7a50f66d
test_push_command: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents:
1055
diff
changeset
|
785 copied=False) |
992
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
786 raise IOError(errno.EINVAL, 'Invalid operation: ' + path) |
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
787 ctx = context.memctx(repo, |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
788 (revsymbol(repo, 'default').node(), node.nullid), |
992
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
789 'automated test', |
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
790 ['adding_file'], |
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
791 file_callback, |
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
792 'an_author', |
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
793 '2012-12-13 20:59:48 -0500', |
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
794 {'branch': 'default', }) |
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
795 new_hash = repo.commitctx(ctx) |
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
796 p = os.path.join(repo.root, "newdir") |
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
797 os.mkdir(p) |
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
798 ctx = context.memctx(repo, |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
799 (revsymbol(repo, 'default').node(), node.nullid), |
992
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
800 'automated test', |
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
801 ['newdir/new_file'], |
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
802 file_callback, |
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
803 'an_author', |
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
804 '2012-12-13 20:59:48 -0500', |
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
805 {'branch': 'default', }) |
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
806 os.chdir(p) |
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
807 new_hash = repo.commitctx(ctx) |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
808 hg.update(repo, revsymbol(repo, 'tip').node()) |
992
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
809 self.pushrevisions() |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
810 tip = revsymbol(self.repo, 'tip') |
992
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
811 self.assertNotEqual(tip.node(), old_tip) |
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
812 self.assertEqual(p, os.getcwd()) |
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
813 self.assertEqual(tip['adding_file'].data(), 'fooFirstFile') |
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
814 self.assertEqual(tip['newdir/new_file'].data(), 'fooNewFile') |
110794582448
push: avoid failure when push is being called from a newly created subdirectory
Kapil Bajaj <kapilbajaj@fb.com>
parents:
991
diff
changeset
|
815 self.assertEqual(tip.branch(), 'default') |
1236
f367a4462191
push: update to branch tip instead of tip
David Schleimer <dschleimer@fb.com>
parents:
1231
diff
changeset
|
816 |
f367a4462191
push: update to branch tip instead of tip
David Schleimer <dschleimer@fb.com>
parents:
1231
diff
changeset
|
817 def test_update_after_push(self): |
f367a4462191
push: update to branch tip instead of tip
David Schleimer <dschleimer@fb.com>
parents:
1231
diff
changeset
|
818 repo = self.repo |
f367a4462191
push: update to branch tip instead of tip
David Schleimer <dschleimer@fb.com>
parents:
1231
diff
changeset
|
819 ui = repo.ui |
f367a4462191
push: update to branch tip instead of tip
David Schleimer <dschleimer@fb.com>
parents:
1231
diff
changeset
|
820 |
f367a4462191
push: update to branch tip instead of tip
David Schleimer <dschleimer@fb.com>
parents:
1231
diff
changeset
|
821 ui.setconfig('hooks', |
f367a4462191
push: update to branch tip instead of tip
David Schleimer <dschleimer@fb.com>
parents:
1231
diff
changeset
|
822 'debug-hgsubversion-between-push-and-pull-for-tests', |
f367a4462191
push: update to branch tip instead of tip
David Schleimer <dschleimer@fb.com>
parents:
1231
diff
changeset
|
823 lambda ui, repo, hooktype: self.add_svn_rev( |
f367a4462191
push: update to branch tip instead of tip
David Schleimer <dschleimer@fb.com>
parents:
1231
diff
changeset
|
824 self.repo_path, |
f367a4462191
push: update to branch tip instead of tip
David Schleimer <dschleimer@fb.com>
parents:
1231
diff
changeset
|
825 {'trunk/racey_file': 'race conditions suck'})) |
f367a4462191
push: update to branch tip instead of tip
David Schleimer <dschleimer@fb.com>
parents:
1231
diff
changeset
|
826 |
f367a4462191
push: update to branch tip instead of tip
David Schleimer <dschleimer@fb.com>
parents:
1231
diff
changeset
|
827 self.test_push_to_branch(push=False) |
f367a4462191
push: update to branch tip instead of tip
David Schleimer <dschleimer@fb.com>
parents:
1231
diff
changeset
|
828 commands.push(ui, repo) |
1570
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
829 newctx = revsymbol(self.repo, '.') |
d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents:
1555
diff
changeset
|
830 self.assertNotEqual(newctx.node(), revsymbol(self.repo, 'tip').node()) |
1236
f367a4462191
push: update to branch tip instead of tip
David Schleimer <dschleimer@fb.com>
parents:
1231
diff
changeset
|
831 self.assertEqual(newctx['adding_file'].data(), 'foo') |
f367a4462191
push: update to branch tip instead of tip
David Schleimer <dschleimer@fb.com>
parents:
1231
diff
changeset
|
832 self.assertEqual(newctx.branch(), 'the_branch') |