comparison tests/test_single_dir_clone.py @ 502:89eda60c90b3

single: add another test for single-dir push
author Augie Fackler <durin42@gmail.com>
date Wed, 25 Nov 2009 23:09:26 -0500
parents 5ddc212dbc56
children cf4fe45bf8fd
comparison
equal deleted inserted replaced
501:c617dcaac86d 502:89eda60c90b3
102 repo.commitctx(ctx) 102 repo.commitctx(ctx)
103 hg.update(repo, repo['tip'].node()) 103 hg.update(repo, repo['tip'].node())
104 self.pushrevisions() 104 self.pushrevisions()
105 self.assertTrue('adding_file' in self.svnls('')) 105 self.assertTrue('adding_file' in self.svnls(''))
106 106
107 def test_push_single_dir_at_subdir(self):
108 repo = self._load_fixture_and_fetch('branch_from_tag.svndump',
109 stupid=False,
110 layout='single',
111 subdir='trunk')
112 def filectxfn(repo, memctx, path):
113 return context.memfilectx(path=path,
114 data='contents of %s' % path,
115 islink=False,
116 isexec=False,
117 copied=False)
118 ctx = context.memctx(repo,
119 (repo['tip'].node(), node.nullid),
120 'automated test',
121 ['bogus'],
122 filectxfn,
123 'an_author',
124 '2009-10-19 18:49:30 -0500',
125 {'branch': 'localhacking',})
126 n = repo.commitctx(ctx)
127 self.assertEqual(self.repo['tip']['bogus'].data(),
128 'contents of bogus')
129 before = repo['tip'].hex()
130 hg.update(repo, self.repo['tip'].hex())
131 self.pushrevisions()
132 self.assertNotEqual(before, self.repo['tip'].hex())
133 self.assertEqual(self.repo['tip']['bogus'].data(),
134 'contents of bogus')
135
107 def test_push_single_dir_branch(self): 136 def test_push_single_dir_branch(self):
108 # Tests local branches pushing to a single dir repo. Creates a fork at 137 # Tests local branches pushing to a single dir repo. Creates a fork at
109 # tip. The default branch adds a file called default, while branch foo 138 # tip. The default branch adds a file called default, while branch foo
110 # adds a file called foo, then tries to push the foo branch and default 139 # adds a file called foo, then tries to push the foo branch and default
111 # branch in that order. 140 # branch in that order.
148 self.repo.branchheads('default')[1], 177 self.repo.branchheads('default')[1],
149 clean=True) 178 clean=True)
150 self.pushrevisions() 179 self.pushrevisions()
151 self.assertTrue('default' in self.svnls('')) 180 self.assertTrue('default' in self.svnls(''))
152 self.assertEquals(len(self.repo.branchheads('default')), 1) 181 self.assertEquals(len(self.repo.branchheads('default')), 1)
153