Mercurial > hgsubversion
comparison hgsubversion/stupid.py @ 1277:ada9b39a9eb8
stupid: remove code that's only used by hg < 1.9
Mercurial 1.9 is over three years old at this point, so I'm willing to
drop this code, as there's been an Ubuntu LTS release since then.
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Mon, 08 Dec 2014 16:49:52 -0500 |
parents | 012965ab3bf7 |
children | 2ae577a4cd56 |
comparison
equal
deleted
inserted
replaced
1276:cc1e2c8cdaa6 | 1277:ada9b39a9eb8 |
---|---|
169 assert data[0] != 'git', 'Filtering git hunks not supported.' | 169 assert data[0] != 'git', 'Filtering git hunks not supported.' |
170 if applycurrent: | 170 if applycurrent: |
171 yield data | 171 yield data |
172 return filterhunks | 172 return filterhunks |
173 | 173 |
174 def patchrepoold(ui, meta, parentctx, patchfp): | 174 if True: |
175 files = {} | |
176 try: | |
177 oldpatchfile = patch.patchfile | |
178 olditerhunks = patch.iterhunks | |
179 patch.patchfile = mempatchproxy(parentctx, files) | |
180 patch.iterhunks = filteriterhunks(meta) | |
181 try: | |
182 # We can safely ignore the changed list since we are | |
183 # handling non-git patches. Touched files are known | |
184 # by our memory patcher. | |
185 patch_st = patch.applydiff(ui, patchfp, {}, strip=0) | |
186 finally: | |
187 patch.patchfile = oldpatchfile | |
188 patch.iterhunks = olditerhunks | |
189 except patch.PatchError: | |
190 # TODO: this happens if the svn server has the wrong mime | |
191 # type stored and doesn't know a file is binary. It would | |
192 # be better to do one file at a time and only do a | |
193 # full fetch on files that had problems. | |
194 raise BadPatchApply('patching failed') | |
195 # if this patch didn't apply right, fall back to exporting the | |
196 # entire rev. | |
197 if patch_st == -1: | |
198 assert False, ('This should only happen on case-insensitive' | |
199 ' volumes.') | |
200 elif patch_st == 1: | |
201 # When converting Django, I saw fuzz on .po files that was | |
202 # causing revisions to end up failing verification. If that | |
203 # can be fixed, maybe this won't ever be reached. | |
204 raise BadPatchApply('patching succeeded with fuzz') | |
205 return files | |
206 | |
207 try: | |
208 class svnbackend(patch.repobackend): | 175 class svnbackend(patch.repobackend): |
209 def getfile(self, fname): | 176 def getfile(self, fname): |
210 # In Mercurial >= 3.2, if fname is missing, data will be None and we | 177 # In Mercurial >= 3.2, if fname is missing, data will be None and we |
211 # should return None, None in that case. Earlier versions will raise | 178 # should return None, None in that case. Earlier versions will raise |
212 # an IOError which we let propagate up the stack. | 179 # an IOError which we let propagate up the stack. |
218 return None, None | 185 return None, None |
219 islink, isexec = flags | 186 islink, isexec = flags |
220 if islink: | 187 if islink: |
221 data = 'link ' + data | 188 data = 'link ' + data |
222 return data, (islink, isexec) | 189 return data, (islink, isexec) |
223 except AttributeError: | |
224 svnbackend = None | |
225 | 190 |
226 def patchrepo(ui, meta, parentctx, patchfp): | 191 def patchrepo(ui, meta, parentctx, patchfp): |
227 if not svnbackend: | |
228 return patchrepoold(ui, meta, parentctx, patchfp) | |
229 store = patch.filestore(util.getfilestoresize(ui)) | 192 store = patch.filestore(util.getfilestoresize(ui)) |
230 try: | 193 try: |
231 touched = set() | 194 touched = set() |
232 backend = svnbackend(ui, meta.repo, parentctx, store) | 195 backend = svnbackend(ui, meta.repo, parentctx, store) |
233 | 196 |