pombreda / vcscommand

Automatically exported from code.google.com/p/vcscommand
0 stars 0 forks source link

patch for vcshg.vim #46

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
version 1.99.31

error message output when running VCSLog command if the current 
diretory in vim(that is :pwd) is not same to the diretory of the file editing 

Original issue reported on code.google.com by tocer.deng@gmail.com on 21 Dec 2009 at 2:18

Attachments:

GoogleCodeExporter commented 9 years ago
I do not use HG.  However, I suspect the given patch isn't correct.  Identify 
should 
determine whether the directory is under version control, not the file.  Could 
you 
please test the following patch instead?

diff --git a/plugin/vcshg.vim b/plugin/vcshg.vim
index 0a31063..47cc61c 100644
--- a/plugin/vcshg.vim
+++ b/plugin/vcshg.vim
@@ -83,12 +83,17 @@ endfunction

 " Function: s:hgFunctions.Identify(buffer) {{{2
 function! s:hgFunctions.Identify(buffer)
-       call system(VCSCommandGetOption('VCSCommandHGExec', 'hg') . ' root')
-       if(v:shell_error)
-               return 0
-       else
-               return g:VCSCOMMAND_IDENTIFY_INEXACT
-       endif
+       let oldCwd = 
VCSCommandChangeToCurrentFileDir(resolve(bufname(a:buffer)))
+       try
+               call system(VCSCommandGetOption('VCSCommandHGExec', 'hg') . ' 
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

Original comment by bob.hies...@gmail.com on 6 Jan 2010 at 8:57

GoogleCodeExporter commented 9 years ago
good patch. it works well for me. Thank you.

Original comment by tocer.deng@gmail.com on 7 Jan 2010 at 1:35

GoogleCodeExporter commented 9 years ago
This should be fixed in 1.99.32.

Original comment by bob.hies...@gmail.com on 7 Jan 2010 at 6:21