annotate tests/test_single_dir_push.py @ 1570:d55c9d0ba350

tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
author Paul Morelle <paul.morelle@octobus.net>
date Fri, 25 May 2018 11:52:03 +0200
parents 8410a978c650
children 7bb6562feb85
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1047
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
1 import test_util
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
2
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
3 import errno
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
4 import shutil
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
5 import unittest
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
6
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
7 from mercurial import commands
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
8 from mercurial import context
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
9 from mercurial import hg
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
10 from mercurial import node
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
11 from mercurial import ui
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
12
1570
d55c9d0ba350 tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents: 1549
diff changeset
13 revsymbol = test_util.revsymbol
d55c9d0ba350 tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents: 1549
diff changeset
14
1103
6e1dbf6cbc92 compathacks: new module to collect hacks to work around hg internals changing
Augie Fackler <raf@durin42.com>
parents: 1075
diff changeset
15 from hgsubversion import compathacks
6e1dbf6cbc92 compathacks: new module to collect hacks to work around hg internals changing
Augie Fackler <raf@durin42.com>
parents: 1075
diff changeset
16
1047
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
17 class TestSingleDirPush(test_util.TestBase):
1075
cf325cd90b22 test_single_dir_push: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 1055
diff changeset
18 stupid_mode_tests = True
1055
2d7398fffd0d push: obsolete rather than rebase & strip when enabled
Dan Villiom Podlaski Christiansen <dan@cabo.dk>
parents: 1047
diff changeset
19 obsolete_mode_tests = True
2d7398fffd0d push: obsolete rather than rebase & strip when enabled
Dan Villiom Podlaski Christiansen <dan@cabo.dk>
parents: 1047
diff changeset
20
1047
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
21 def test_push_single_dir(self):
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
22 # Tests simple pushing from default branch to a single dir repo
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
23 repo, repo_path = self.load_and_fetch('branch_from_tag.svndump',
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
24 layout='single',
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
25 subdir='')
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
26 def file_callback(repo, memctx, path):
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
27 if path == 'adding_file':
1205
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
28 return compathacks.makememfilectx(repo,
1549
8410a978c650 compathacks: be compatible with upstream 8a0cac20a1ad memfilectx change
Jun Wu <quark@fb.com>
parents: 1539
diff changeset
29 memctx=memctx,
1205
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
30 path=path,
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
31 data='foo',
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
32 islink=False,
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
33 isexec=False,
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
34 copied=False)
1047
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
35 elif path == 'adding_binary':
1205
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
36 return compathacks.makememfilectx(repo,
1549
8410a978c650 compathacks: be compatible with upstream 8a0cac20a1ad memfilectx change
Jun Wu <quark@fb.com>
parents: 1539
diff changeset
37 memctx=memctx,
1205
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
38 path=path,
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
39 data='\0binary',
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
40 islink=False,
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
41 isexec=False,
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
42 copied=False)
1047
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
43 raise IOError(errno.EINVAL, 'Invalid operation: ' + path)
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
44 ctx = context.memctx(repo,
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
45 (repo['tip'].node(), node.nullid),
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
46 'automated test',
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
47 ['adding_file', 'adding_binary'],
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
48 file_callback,
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
49 'an_author',
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
50 '2009-10-19 18:49:30 -0500',
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
51 {'branch': 'default', })
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
52 repo.commitctx(ctx)
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
53 hg.update(repo, repo['tip'].node())
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
54 self.pushrevisions()
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
55 self.assertTrue('adding_file' in test_util.svnls(repo_path, ''))
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
56 self.assertEqual('application/octet-stream',
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
57 test_util.svnpropget(repo_path, 'adding_binary',
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
58 'svn:mime-type'))
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
59 # Now add another commit and test mime-type being reset
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
60 changes = [('adding_binary', 'adding_binary', 'no longer binary')]
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
61 self.commitchanges(changes)
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
62 self.pushrevisions()
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
63 self.assertEqual('', test_util.svnpropget(repo_path, 'adding_binary',
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
64 'svn:mime-type'))
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
65
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
66 def test_push_single_dir_at_subdir(self):
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
67 repo = self._load_fixture_and_fetch('branch_from_tag.svndump',
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
68 layout='single',
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
69 subdir='trunk')
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
70 def filectxfn(repo, memctx, path):
1205
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
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,
1205
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
73 path=path,
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
74 data='contents of %s' % path,
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
75 islink=False,
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
76 isexec=False,
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
77 copied=False)
1047
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
78 ctx = context.memctx(repo,
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
79 (repo['tip'].node(), node.nullid),
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
80 'automated test',
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
81 ['bogus'],
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
82 filectxfn,
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
83 'an_author',
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
84 '2009-10-19 18:49:30 -0500',
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
85 {'branch': 'localhacking', })
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
86 n = repo.commitctx(ctx)
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
87 self.assertEqual(self.repo['tip']['bogus'].data(),
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
88 'contents of bogus')
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
89 before = repo['tip'].hex()
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
90 hg.update(repo, self.repo['tip'].hex())
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
91 self.pushrevisions()
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
92 self.assertNotEqual(before, self.repo['tip'].hex())
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
93 self.assertEqual(self.repo['tip']['bogus'].data(),
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
94 'contents of bogus')
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
95
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
96 def test_push_single_dir_one_incoming_and_two_outgoing(self):
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
97 # Tests simple pushing from default branch to a single dir repo
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
98 # Pushes two outgoing over one incoming svn rev
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
99 # (used to cause an "unknown revision")
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
100 # This can happen if someone committed to svn since our last pull (race).
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
101 repo, repo_path = self.load_and_fetch('branch_from_tag.svndump',
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
102 layout='single',
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
103 subdir='trunk')
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
104 self.add_svn_rev(repo_path, {'trunk/alpha': 'Changed'})
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
105 def file_callback(repo, memctx, path):
1205
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
106 return compathacks.makememfilectx(repo,
1549
8410a978c650 compathacks: be compatible with upstream 8a0cac20a1ad memfilectx change
Jun Wu <quark@fb.com>
parents: 1539
diff changeset
107 memctx=memctx,
1205
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
108 path=path,
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
109 data='data of %s' % path,
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
110 islink=False,
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
111 isexec=False,
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
112 copied=False)
1047
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
113 for fn in ['one', 'two']:
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
114 ctx = context.memctx(repo,
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
115 (repo['tip'].node(), node.nullid),
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
116 'automated test',
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
117 [fn],
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
118 file_callback,
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
119 'an_author',
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
120 '2009-10-19 18:49:30 -0500',
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
121 {'branch': 'default', })
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
122 repo.commitctx(ctx)
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
123 hg.update(repo, repo['tip'].node())
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
124 self.pushrevisions(expected_extra_back=1)
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
125 self.assertTrue('trunk/one' in test_util.svnls(repo_path, ''))
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
126 self.assertTrue('trunk/two' in test_util.svnls(repo_path, ''))
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
127
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
128 def test_push_single_dir_branch(self):
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
129 # Tests local branches pushing to a single dir repo. Creates a fork at
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
130 # tip. The default branch adds a file called default, while branch foo
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
131 # adds a file called foo, then tries to push the foo branch and default
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
132 # branch in that order.
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
133 repo, repo_path = self.load_and_fetch('branch_from_tag.svndump',
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
134 layout='single',
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
135 subdir='')
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
136 def file_callback(data):
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
137 def cb(repo, memctx, path):
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
138 if path == data:
1205
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
139 return compathacks.makememfilectx(repo,
1549
8410a978c650 compathacks: be compatible with upstream 8a0cac20a1ad memfilectx change
Jun Wu <quark@fb.com>
parents: 1539
diff changeset
140 memctx=memctx,
1205
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
141 path=path,
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
142 data=data,
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
143 islink=False,
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
144 isexec=False,
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
145 copied=False)
1047
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
146 raise IOError(errno.EINVAL, 'Invalid operation: ' + path)
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
147 return cb
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
148
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
149 def commit_to_branch(name, parent):
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
150 repo.commitctx(context.memctx(repo,
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
151 (parent, node.nullid),
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
152 'automated test (%s)' % name,
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
153 [name],
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
154 file_callback(name),
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
155 'an_author',
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
156 '2009-10-19 18:49:30 -0500',
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
157 {'branch': name, }))
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
158
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
159 parent = repo['tip'].node()
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
160 commit_to_branch('default', parent)
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
161 commit_to_branch('foo', parent)
1570
d55c9d0ba350 tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents: 1549
diff changeset
162 hg.update(repo, revsymbol(repo, 'foo').node())
1047
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
163 self.pushrevisions()
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
164 repo = self.repo # repo is outdated after the rebase happens, refresh
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
165 self.assertTrue('foo' in test_util.svnls(repo_path, ''))
1103
6e1dbf6cbc92 compathacks: new module to collect hacks to work around hg internals changing
Augie Fackler <raf@durin42.com>
parents: 1075
diff changeset
166 self.assertEqual(compathacks.branchset(repo), set(['default']))
1047
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
167 # Have to cross to another branch head, so hg.update doesn't work
1342
c6b01fd34694 trying to fix progress output
Augie Fackler <raf@durin42.com>
parents: 1205
diff changeset
168 commands.update(self.ui(),
1047
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
169 self.repo,
1570
d55c9d0ba350 tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
Paul Morelle <paul.morelle@octobus.net>
parents: 1549
diff changeset
170 node.hex(self.repo.branchheads('default')[1]),
1047
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
171 clean=True)
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
172 self.pushrevisions()
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
173 self.assertTrue('default' in test_util.svnls(repo_path, ''))
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
174 self.assertEquals(len(self.repo.branchheads('default')), 1)
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
175
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
176 @test_util.requiresoption('branch')
1075
cf325cd90b22 test_single_dir_push: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 1055
diff changeset
177 def test_push_single_dir_renamed_branch(self):
1047
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
178 # Tests pulling and pushing with a renamed branch
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
179 # Based on test_push_single_dir
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
180 repo_path = self.load_svndump('branch_from_tag.svndump')
1343
e597714cb420 tests: pass --quiet anyplace we call dispatch to run a command
Augie Fackler <raf@durin42.com>
parents: 1342
diff changeset
181 cmd = ['clone', '--quiet', '--layout=single', '--branch=flaf']
1075
cf325cd90b22 test_single_dir_push: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 1055
diff changeset
182 if self.stupid:
1047
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
183 cmd.append('--stupid')
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
184 cmd += [test_util.fileurl(repo_path), self.wc_path]
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
185 test_util.dispatch(cmd)
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
186
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
187 def file_callback(repo, memctx, path):
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
188 if path == 'adding_file':
1205
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
189 return compathacks.makememfilectx(repo,
1549
8410a978c650 compathacks: be compatible with upstream 8a0cac20a1ad memfilectx change
Jun Wu <quark@fb.com>
parents: 1539
diff changeset
190 memctx=memctx,
1205
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
191 path=path,
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
192 data='foo',
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
193 islink=False,
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
194 isexec=False,
f1dd304be8aa test_single_dir_push: call makememfilectx
Sean Farley <sean.michael.farley@gmail.com>
parents: 1103
diff changeset
195 copied=False)
1047
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
196 raise IOError(errno.EINVAL, 'Invalid operation: ' + path)
1539
0ebcc5bbf692 tests: when making a `memctx`, make sure to use a single repo instance
Augie Fackler <raf@durin42.com>
parents: 1343
diff changeset
197 lr = self.repo
0ebcc5bbf692 tests: when making a `memctx`, make sure to use a single repo instance
Augie Fackler <raf@durin42.com>
parents: 1343
diff changeset
198 ctx = context.memctx(lr,
0ebcc5bbf692 tests: when making a `memctx`, make sure to use a single repo instance
Augie Fackler <raf@durin42.com>
parents: 1343
diff changeset
199 (lr['tip'].node(), node.nullid),
1047
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
200 'automated test',
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
201 ['adding_file'],
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
202 file_callback,
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
203 'an_author',
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
204 '2009-10-19 18:49:30 -0500',
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
205 {'branch': 'default', })
1539
0ebcc5bbf692 tests: when making a `memctx`, make sure to use a single repo instance
Augie Fackler <raf@durin42.com>
parents: 1343
diff changeset
206 lr.commitctx(ctx)
1047
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
207 hg.update(self.repo, self.repo['tip'].node())
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
208 self.pushrevisions()
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
209 self.assertTrue('adding_file' in test_util.svnls(repo_path, ''))
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
210
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
211 self.assertEquals(set(['flaf']),
3092b3c109a8 tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff changeset
212 set(self.repo[i].branch() for i in self.repo))