From 148d93e885029f7426584a4a501bd47d746634c7 Mon Sep 17 00:00:00 2001 From: Bob Hiestand Date: Wed, 6 Jan 2010 15:00:14 -0600 Subject: [PATCH] vcshg: Identify hg version control when not in the root of a repository. --- plugin/vcshg.vim | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/plugin/vcshg.vim b/plugin/vcshg.vim index 6195deb..a1ee802 100644 --- a/plugin/vcshg.vim +++ b/plugin/vcshg.vim @@ -90,12 +90,17 @@ endfunction " Function: s:hgFunctions.Identify(buffer) {{{2 function! s:hgFunctions.Identify(buffer) - call s:VCSCommandUtility.system(s:Executable() . ' root') - if(v:shell_error) - return 0 - else - return g:VCSCOMMAND_IDENTIFY_INEXACT - endif + let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname(a:buffer))) + try + call s:VCSCommandUtility.system(s:Executable() . ' root') + if(v:shell_error) + return 0 + else + return g:VCSCOMMAND_IDENTIFY_INEXACT + endif + finally + call VCSCommandChdir(oldCwd) + endtry endfunction " Function: s:hgFunctions.Add() {{{2 -- 2.11.4.GIT