contrib/vim/hgtest.vim
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
Fri, 04 Jan 2013 03:14:54 +0100
changeset 18271 67872e939945
parent 18052 6db1642288c0
permissions -rw-r--r--
performance: speedup computation of obsolete revisions In their current state, revset calls can be very costly as we test predicates on the entire repository. As obsolete computation is used by the "hidden" filter, it needs to be very fast. This changet drops the revset call in favor of direct testing of the phase of a changeset. Performance test on my Mercurial checkout - 19857 total changesets, - 1584 obsolete changesets, - 13310 obsolescence markers. Before: ! obsolete ! wall 0.047041 After: ! obsolete ! wall 0.004590 Performance test on a Mozilla central checkout: - 117293 total changesets, - 1 obsolete changeset, - 1 obsolescence marker. Before: ! obsolete ! wall 0.001539 After: ! obsolete ! wall 0.000017

" Vim syntax file
" Language: Mercurial unified tests
" Author: Steve Losh (steve@stevelosh.com)
"
" Place this file in ~/.vim/syntax/ and add the following line to your
" ~/.vimrc to enable:
" au BufNewFile,BufRead *.t set filetype=hgtest
"
" If you want folding you'll need the following line as well:
" let hgtest_fold=1
"
" You might also want to set the starting foldlevel for hgtest files:
" autocmd Syntax hgtest setlocal foldlevel=1

if exists("b:current_syntax")
  finish
endif

syn include @Shell syntax/sh.vim

syn match hgtestComment /^[^ ].*$/
syn region hgtestOutput start=/^  [^$>]/ start=/^  $/ end=/\v.(\n\n*[^ ])\@=/me=s end=/^  [$>]/me=e-3 end=/^$/ fold containedin=hgtestBlock
syn match hgtestCommandStart /^  \$ / containedin=hgtestCommand
syn region hgtestCommand start=/^  \$ /hs=s+4,rs=s+4 end=/^  [^>]/me=e-3 end=/^  $/me=e-2 containedin=hgtestBlock contains=@Shell keepend
syn region hgtestBlock start=/^  /ms=e-2 end=/\v.(\n\n*[^ ])\@=/me=s end=/^$/me=e-1 fold keepend

hi link hgtestCommandStart Keyword
hi link hgtestComment Normal
hi link hgtestOutput Comment

if exists("hgtest_fold")
  setlocal foldmethod=syntax
endif

syn sync match hgtestSync grouphere NONE "^$"
syn sync maxlines=200

" It's okay to set tab settings here, because an indent of two spaces is specified
" by the file format.
setlocal tabstop=2 softtabstop=2 shiftwidth=2 expandtab

let b:current_syntax = "hgtest"