comparison hg_delta_editor.py @ 55:987e44afa71e

hg_delta_editor: simplify exec/symlink flags generation
author Patrick Mezard <pmezard@gmail.com>
date Mon, 03 Nov 2008 08:43:07 -0600
parents af7ac6c03452
children 430af23bef4a
comparison
equal deleted inserted replaced
54:db7a1ab8851a 55:987e44afa71e
345 assert False, ('a non-trunk branch should probably have' 345 assert False, ('a non-trunk branch should probably have'
346 ' parents figured out by this point') 346 ' parents figured out by this point')
347 extra['branch'] = branch 347 extra['branch'] = branch
348 parent_ctx = self.repo.changectx(parents[0]) 348 parent_ctx = self.repo.changectx(parents[0])
349 def filectxfn(repo, memctx, path): 349 def filectxfn(repo, memctx, path):
350 is_link = False
351 is_exec = False
352 copied = None 350 copied = None
353 current_file = files[path] 351 current_file = files[path]
354 if current_file in self.deleted_files: 352 if current_file in self.deleted_files:
355 raise IOError() 353 raise IOError()
356 # TODO(augie) tag copies from files 354 # TODO(augie) tag copies from files
357 if path in parent_ctx: 355 flags = parent_ctx.flags(path)
358 is_exec = 'x' in parent_ctx.flags(path) 356 is_exec = self.current_files_exec.get(current_file,
359 is_link = 'l' in parent_ctx.flags(path) 357 'x' in flags)
360 if current_file in self.current_files_exec: 358 is_link = self.current_files_symlink.get(current_file,
361 is_exec = self.current_files_exec[current_file] 359 'l' in flags)
362 if current_file in self.current_files_symlink:
363 is_link = self.current_files_symlink[current_file]
364 if current_file in self.current_files: 360 if current_file in self.current_files:
365 data = self.current_files[current_file] 361 data = self.current_files[current_file]
366 if is_link: 362 if is_link:
367 assert data.startswith('link ') 363 assert data.startswith('link ')
368 data = data[len('link '):] 364 data = data[len('link '):]