Mercurial > hgsubversion
comparison hgsubversion/editor.py @ 1232:ba8485b9fee0
editor: correctly import copies of directories from non-tracked or closed branches
author | David Schleimer <dschleimer@fb.com> |
---|---|
date | Sun, 17 Nov 2013 09:57:00 -0800 |
parents | c6f7a8cfeca9 |
children | 0d0132cba155 |
comparison
equal
deleted
inserted
replaced
1231:5c2917375961 | 1232:ba8485b9fee0 |
---|---|
237 if not isdir: | 237 if not isdir: |
238 self._missing.add(path[len(root):]) | 238 self._missing.add(path[len(root):]) |
239 else: | 239 else: |
240 # Resolve missing directories content immediately so the | 240 # Resolve missing directories content immediately so the |
241 # missing files maybe processed by delete actions. | 241 # missing files maybe processed by delete actions. |
242 # we remove the missing directory entries to deal with the case | |
243 # where a directory is replaced from e.g. a closed branch | |
244 # this will show up as a delete and then a copy | |
245 # we process deletes after missing, so we can handle a directory | |
246 # copy plus delete of file in that directory. This means that we | |
247 # need to be sure that only things whose final disposition is | |
248 # deletion remain in self._deleted at the end of the editing process. | |
242 rev = self.current.rev.revnum | 249 rev = self.current.rev.revnum |
243 path = path + '/' | 250 path = path + '/' |
244 parentdir = path[len(root):] | 251 parentdir = path[len(root):] |
245 for f, k in svn.list_files(parentdir, rev): | 252 for f, k in svn.list_files(parentdir, rev): |
246 if k != 'f': | 253 if k != 'f': |
247 continue | 254 continue |
248 f = parentdir + f | 255 f = parentdir + f |
249 if not self.meta.is_path_valid(f, False): | 256 if not self.meta.is_path_valid(f, False): |
250 continue | 257 continue |
258 self._deleted.discard(f) | |
251 self._missing.add(f) | 259 self._missing.add(f) |
252 | 260 |
253 @svnwrap.ieditor | 261 @svnwrap.ieditor |
254 def delete_entry(self, path, revision_bogus, parent_baton, pool=None): | 262 def delete_entry(self, path, revision_bogus, parent_baton, pool=None): |
255 self._checkparentdir(parent_baton) | 263 self._checkparentdir(parent_baton) |
429 frompath = '' | 437 frompath = '' |
430 else: | 438 else: |
431 source_rev = copyfrom_revision | 439 source_rev = copyfrom_revision |
432 frompath, source_branch = self.meta.split_branch_path(copyfrom_path)[:2] | 440 frompath, source_branch = self.meta.split_branch_path(copyfrom_path)[:2] |
433 new_hash = self.meta.get_parent_revision(source_rev + 1, source_branch, True) | 441 new_hash = self.meta.get_parent_revision(source_rev + 1, source_branch, True) |
434 if new_hash == node.nullid: | 442 if frompath is None or new_hash == node.nullid: |
435 self.addmissing(path, isdir=True) | 443 self.addmissing(path, isdir=True) |
436 return baton | 444 return baton |
437 fromctx = self._getctx(new_hash) | 445 fromctx = self._getctx(new_hash) |
438 if frompath != '/' and frompath != '': | 446 if frompath != '/' and frompath != '': |
439 frompath = '%s/' % frompath | 447 frompath = '%s/' % frompath |