Mercurial > hg
changeset 2634:105708ba518f
Test if file is below an HG root before doing anything
author | "Mathieu Clabaut <mathieu.clabaut@gmail.com>" |
---|---|
date | Tue, 18 Jul 2006 18:35:47 +0200 |
parents | f7be7babc75a |
children | 37bcccf8a683 |
files | contrib/vim/hgcommand.vim |
diffstat | 1 files changed, 11 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/vim/hgcommand.vim Sat Jul 15 13:09:46 2006 +0200 +++ b/contrib/vim/hgcommand.vim Tue Jul 18 18:35:47 2006 +0200 @@ -171,7 +171,7 @@ endif let hgCommand = s:HGGetOption("HGCommandHGExec", "hg") . " " . a:cmd - echomsg "DBG :".hgCommand + "echomsg "DBG :".hgCommand let hgOut = system(hgCommand) " HACK: diff command does not return proper error codes if v:shell_error && a:cmdName != 'hgdiff' @@ -319,13 +319,17 @@ return "" endif let fileName=bufname(hgBufferCheck) - let realFileName = fnamemodify(s:HGResolveLink(fileName), ':t') + let fileNameWithoutLink=s:HGResolveLink(fileName) + let realFileName = fnamemodify(fileNameWithoutLink, ':t') let oldCwd=s:HGChangeToCurrentFileDir(fileName) try - ""TODO - "if !filereadable('HG/Root') - "return "" - "endif + let hgCommand = s:HGGetOption("HGCommandHGExec", "hg") . " root " + let roottext=system(hgCommand) + " Suppress ending null char ! Does it work in window ? + let roottext=substitute(roottext, '.$', '', "") + if match(getcwd()."/".fileNameWithoutLink, roottext) == -1 + return "" + endif let hgCommand = s:HGGetOption("HGCommandHGExec", "hg") . " status -mardui " . fileName let statustext=system(hgCommand) if(v:shell_error) @@ -686,7 +690,7 @@ endif let resultBuffer=s:HGDoCommand('annotate -ndu -r ' . revision, 'hgannotate', revision) - echomsg "DBG: ".resultBuffer + "echomsg "DBG: ".resultBuffer if resultBuffer != -1 set filetype=HGAnnotate endif