comparison tests/test_fetch_mappings.py @ 962:8648ccfb8325

editor: process missing files with regular files Missing files were stored directly in RevisionMeta and resolved after the revision was replayed. It means the missing files set was no pruned by delete_entry() actions or by the filemap, and some of them were fetched for no reason. Say you convert: A branch/foo/bar (from trunk/foo/bar:123) with a filemap excluding "foo/bar". Since the directory was excluded in trunk the files cannot be found and were marked as missing even though they were discarded afterwards.
author Patrick Mezard <patrick@mezard.eu>
date Sat, 20 Oct 2012 22:22:02 +0200
parents 502613f6b583
children 64d961130a07
comparison
equal deleted inserted replaced
961:b729909d3793 962:8648ccfb8325
99 fromself = set(test) 99 fromself = set(test)
100 test.load(orig) 100 test.load(orig)
101 all_tests = set(test) 101 all_tests = set(test)
102 self.assertEqual(fromself.symmetric_difference(all_tests), set()) 102 self.assertEqual(fromself.symmetric_difference(all_tests), set())
103 103
104 def _loadwithfilemap(self, svndump, filemapcontent, stupid=False): 104 def _loadwithfilemap(self, svndump, filemapcontent, stupid=False,
105 failonmissing=True):
105 repo_path = self.load_svndump(svndump) 106 repo_path = self.load_svndump(svndump)
106 filemap = open(self.filemap, 'w') 107 filemap = open(self.filemap, 'w')
107 filemap.write(filemapcontent) 108 filemap.write(filemapcontent)
108 filemap.close() 109 filemap.close()
109 ui = self.ui(stupid) 110 ui = self.ui(stupid)
110 ui.setconfig('hgsubversion', 'filemap', self.filemap) 111 ui.setconfig('hgsubversion', 'filemap', self.filemap)
111 ui.setconfig('hgsubversion', 'failoninvalidreplayfile', 'true') 112 ui.setconfig('hgsubversion', 'failoninvalidreplayfile', 'true')
112 ui.setconfig('hgsubversion', 'failonmissing', 'true') 113 ui.setconfig('hgsubversion', 'failonmissing', failonmissing)
113 commands.clone(ui, test_util.fileurl(repo_path), 114 commands.clone(ui, test_util.fileurl(repo_path),
114 self.wc_path, filemap=self.filemap) 115 self.wc_path, filemap=self.filemap)
115 return self.repo 116 return self.repo
116 117
117 def test_file_map(self, stupid=False): 118 def test_file_map(self, stupid=False):
144 ['alpha', 'beta']) 145 ['alpha', 'beta'])
145 self.assertEqual(self.repo['default'].manifest().keys(), 146 self.assertEqual(self.repo['default'].manifest().keys(),
146 ['alpha', 'beta']) 147 ['alpha', 'beta'])
147 148
148 def test_file_map_copy(self): 149 def test_file_map_copy(self):
149 repo = self._loadwithfilemap('copies.svndump', "exclude dir2\n") 150 # Exercise excluding files copied from a non-excluded directory.
151 # There will be missing files as we are copying from an excluded
152 # directory.
153 repo = self._loadwithfilemap('copies.svndump', "exclude dir2\n",
154 failonmissing=False)
155 self.assertEqual(['dir/a', 'dir3/a'], list(repo['tip']))
156
157 def test_file_map_exclude_copy_source_and_dest(self):
158 # dir3 is excluded and copied from dir2 which is also excluded.
159 # dir3 files should not be marked as missing and fetched.
160 repo = self._loadwithfilemap('copies.svndump',
161 "exclude dir2\nexclude dir3\n")
150 self.assertEqual(['dir/a'], list(repo['tip'])) 162 self.assertEqual(['dir/a'], list(repo['tip']))
163
164 def test_file_map_include_file_exclude_dir(self):
165 # dir3 is excluded but we want dir3/a, which is also copied from
166 # an exluded dir2. dir3/a should be fetched.
167 repo = self._loadwithfilemap('copies.svndump',
168 "include .\nexclude dir2\nexclude dir3\ninclude dir3/a\n",
169 failonmissing=False)
170 self.assertEqual(['dir/a', 'dir3/a'], list(repo['tip']))
151 171
152 def test_branchmap(self, stupid=False): 172 def test_branchmap(self, stupid=False):
153 repo_path = self.load_svndump('branchmap.svndump') 173 repo_path = self.load_svndump('branchmap.svndump')
154 branchmap = open(self.branchmap, 'w') 174 branchmap = open(self.branchmap, 'w')
155 branchmap.write("badname = good-name # stuffy\n") 175 branchmap.write("badname = good-name # stuffy\n")