comparison hg_delta_editor.py @ 123:58de7aea8a77

Fix a bug in replay convert where replaced files that couldn't use replay would sometimes end up having no content.
author Augie Fackler <durin42@gmail.com>
date Wed, 03 Dec 2008 22:51:03 -0600
parents f508c1fa19a5
children 291925677a9f
comparison
equal deleted inserted replaced
122:04c92c2c4501 123:58de7aea8a77
186 if islink: 186 if islink:
187 data = 'link ' + data 187 data = 'link ' + data
188 self.current_files[path] = data 188 self.current_files[path] = data
189 self.current_files_exec[path] = isexec 189 self.current_files_exec[path] = isexec
190 self.current_files_symlink[path] = islink 190 self.current_files_symlink[path] = islink
191 if path in self.deleted_files:
192 del self.deleted_files[path]
191 193
192 def _normalize_path(self, path): 194 def _normalize_path(self, path):
193 '''Normalize a path to strip of leading slashes and our subdir if we 195 '''Normalize a path to strip of leading slashes and our subdir if we
194 have one. 196 have one.
195 ''' 197 '''
505 """ 507 """
506 if parentctx == childctx: 508 if parentctx == childctx:
507 return True 509 return True
508 if parentctx.rev() > childctx.rev(): 510 if parentctx.rev() > childctx.rev():
509 parentctx, childctx = childctx, parentctx 511 parentctx, childctx = childctx, parentctx
510 512
511 def selfandancestors(selfctx): 513 def selfandancestors(selfctx):
512 yield selfctx 514 yield selfctx
513 for ctx in selfctx.ancestors(): 515 for ctx in selfctx.ancestors():
514 yield ctx 516 yield ctx
515 517
516 files = dict.fromkeys(files) 518 files = dict.fromkeys(files)
517 for pctx in selfandancestors(childctx): 519 for pctx in selfandancestors(childctx):
518 if pctx.rev() <= parentctx.rev(): 520 if pctx.rev() <= parentctx.rev():
519 return True 521 return True
520 for f in pctx.files(): 522 for f in pctx.files():
521 if f in files: 523 if f in files:
522 return False 524 return False
523 # parentctx is not an ancestor of childctx, files are unrelated 525 # parentctx is not an ancestor of childctx, files are unrelated
524 return False 526 return False
525 527