def copy_file_from_manifest(repo, ctx, filename, dir):
 for changeset in reversed_upper_bounded_changelog(repo, ctx):
  changeset_ctx = repo.changectx(changeset)
  fctx = get_file_context_from_ctx(changeset_ctx, filename)
  if (fctx and (fctx not in ['DELETED'])):
   file_path = os.path.join(dir, filename)
   fh = open(file_path, 'wb')
   fh.write(fctx.data())
   fh.close()
   return file_path
 return None

def copy_file_from_manifest ( repo , ctx , filename , dir ) : for changeset in reversed_upper_bounded_changelog ( repo , ctx ) : changeset_ctx = repo . changectx ( changeset ) fctx = get_file_context_from_ctx ( changeset_ctx , filename ) if ( fctx and ( fctx not in [ 'DELETED' ] ) ) : file_path = os . path . join ( dir , filename ) fh = open ( file_path , 'wb' ) fh . write ( fctx . data ( ) ) fh . close ( ) return file_path return None
copy the latest version of the file named filename from the repository manifest to the directory to which dir refers .