comparison tests/test_single_dir_clone.py @ 793:e698be84c22d

pushmod: fix binary files svn:mime-type (issue255) - Handle single directory layout - Reset svn:mime-type when the file is no longer binary
author Patrick Mezard <pmezard@gmail.com>
date Thu, 10 Mar 2011 22:17:56 +0100
parents 1041fb1bec8c
children f07bfd66db13
comparison
equal deleted inserted replaced
792:ba65c0b01d4f 793:e698be84c22d
90 return context.memfilectx(path=path, 90 return context.memfilectx(path=path,
91 data='foo', 91 data='foo',
92 islink=False, 92 islink=False,
93 isexec=False, 93 isexec=False,
94 copied=False) 94 copied=False)
95 elif path == 'adding_binary':
96 return context.memfilectx(path=path,
97 data='\0binary',
98 islink=False,
99 isexec=False,
100 copied=False)
95 raise IOError(errno.EINVAL, 'Invalid operation: ' + path) 101 raise IOError(errno.EINVAL, 'Invalid operation: ' + path)
96 ctx = context.memctx(repo, 102 ctx = context.memctx(repo,
97 (repo['tip'].node(), node.nullid), 103 (repo['tip'].node(), node.nullid),
98 'automated test', 104 'automated test',
99 ['adding_file'], 105 ['adding_file', 'adding_binary'],
100 file_callback, 106 file_callback,
101 'an_author', 107 'an_author',
102 '2009-10-19 18:49:30 -0500', 108 '2009-10-19 18:49:30 -0500',
103 {'branch': 'default',}) 109 {'branch': 'default',})
104 repo.commitctx(ctx) 110 repo.commitctx(ctx)
105 hg.update(repo, repo['tip'].node()) 111 hg.update(repo, repo['tip'].node())
106 self.pushrevisions() 112 self.pushrevisions()
107 self.assertTrue('adding_file' in self.svnls('')) 113 self.assertTrue('adding_file' in self.svnls(''))
114 self.assertEqual('application/octet-stream',
115 self.svnpropget('adding_binary', 'svn:mime-type'))
116 # Now add another commit and test mime-type being reset
117 changes = [('adding_binary', 'adding_binary', 'no longer binary')]
118 self.commitchanges(changes)
119 self.pushrevisions()
120 self.assertEqual('', self.svnpropget('adding_binary', 'svn:mime-type'))
108 121
109 def test_push_single_dir_at_subdir(self): 122 def test_push_single_dir_at_subdir(self):
110 repo = self._load_fixture_and_fetch('branch_from_tag.svndump', 123 repo = self._load_fixture_and_fetch('branch_from_tag.svndump',
111 stupid=False, 124 stupid=False,
112 layout='single', 125 layout='single',