changeset 197:eec9b72fe3df

Merge pull request #146 from GitHub.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 27 Jul 2017 22:10:09 -0700
parents 4cccf8c88421 (current diff) cac059bce038 (diff)
children 5fb056a9eefb
files
diffstat 3 files changed, 31 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/autoload/gutentags/cscope.vim	Thu Jul 27 21:53:32 2017 -0700
+++ b/autoload/gutentags/cscope.vim	Thu Jul 27 22:10:09 2017 -0700
@@ -24,6 +24,7 @@
 " Gutentags Module Interface {{{
 
 let s:runner_exe = gutentags#get_plat_file('update_scopedb')
+let s:unix_redir = (&shellredir =~# '%s') ? &shellredir : &shellredir . ' %s'
 let s:added_dbs = []
 
 function! gutentags#cscope#init(project_root) abort
@@ -34,7 +35,7 @@
     if g:gutentags_auto_add_cscope && filereadable(l:dbfile_path)
         if index(s:added_dbs, l:dbfile_path) < 0
             call add(s:added_dbs, l:dbfile_path)
-            execute 'cs add ' . fnameescape(l:dbfile_path)
+            silent! execute 'cs add ' . fnameescape(l:dbfile_path)
         endif
     endif
 endfunction
@@ -43,7 +44,7 @@
     if a:data == 0
         if index(s:added_dbs, self.db_file) < 0
             call add(s:added_dbs, self.db_file)
-            execute 'cs add ' . fnameescape(s:db_file)
+            silent! execute 'cs add ' . fnameescape(s:db_file)
         else
             execute 'cs reset'
         endif
@@ -60,6 +61,17 @@
     if !empty(l:file_list_cmd)
         let l:cmd .= ' -L "' . l:file_list_cmd . '"'
     endif
+    if g:gutentags_trace
+        if has('win32')
+            let l:cmd .= ' -l "' . a:tags_file . '.log"'
+        else
+            let l:cmd .= ' ' . printf(s:unix_redir, '"' . a:tags_file . '.log"')
+        endif
+    else
+        if !has('win32')
+            let l:cmd .= ' ' . printf(s:unix_redir, '/dev/null')
+        endif
+    endif
     let l:cmd .= ' '
     let l:cmd .= gutentags#get_execute_cmd_suffix()
 
--- a/plat/unix/update_scopedb.sh	Thu Jul 27 21:53:32 2017 -0700
+++ b/plat/unix/update_scopedb.sh	Thu Jul 27 22:10:09 2017 -0700
@@ -69,10 +69,10 @@
             echo "${PROJECT_ROOT%/}/${l}"
         done > "${DB_FILE}.files"
     fi
-    CSCOPE_ARGS="${CSCOPE_ARGS} -i ${DB_FILE}.files"
 else
-    CSCOPE_ARGS="${CSCOPE_ARGS} -R"
+    find . -type f > "${DB_FILE}.files"
 fi
+CSCOPE_ARGS="${CSCOPE_ARGS} -i ${DB_FILE}.files"
 
 echo "Running cscope"
 echo "$CSCOPE_EXE $CSCOPE_ARGS -b -k -f \"$DB_FILE.temp\""
--- a/plat/win32/update_scopedb.cmd	Thu Jul 27 21:53:32 2017 -0700
+++ b/plat/win32/update_scopedb.cmd	Thu Jul 27 22:10:09 2017 -0700
@@ -9,6 +9,7 @@
 set CSCOPE_ARGS=
 set DB_FILE=cscope.out
 set FILE_LIST_CMD=
+set LOG_FILE=
 
 :ParseArgs
 if [%1]==[] goto :DoneParseArgs
@@ -32,6 +33,11 @@
     shift
     goto :LoopParseArgs
 )
+if [%1]==[-l] (
+    set LOG_FILE=%~2
+    shift
+    goto :LoopParseArgs
+)
 echo Invalid Argument: %1
 goto :Usage
 
@@ -46,10 +52,12 @@
 rem             GENERATE DATABASE
 rem ==========================================
 
-echo Locking db file
+if [%LOG_FILE%]==[] set LOG_FILE=CON
+
+echo Locking db file > %LOG_FILE%
 echo locked > "%DB_FILE%.lock"
 
-echo Running cscope
+echo Running cscope >> %LOG_FILE%
 if NOT ["%FILE_LIST_CMD%"]==[""] (
     if ["%PROJECT_ROOT%"]==["."] (
         call %FILE_LIST_CMD% > %DB_FILE%.files
@@ -64,16 +72,16 @@
 )
 "%CSCOPE_EXE%" %CSCOPE_ARGS% -b -k -f "%DB_FILE%"
 if ERRORLEVEL 1 (
-    echo ERROR: Cscope executable returned non-zero code.
+    echo ERROR: Cscope executable returned non-zero code. >> %LOG_FILE%
 )
 
-echo Unlocking db file
+echo Unlocking db file >> %LOG_FILE%
 del /F "%DB_FILE%.files" "%DB_FILE%.lock"
 if ERRORLEVEL 1 (
-    echo ERROR: Unable to remove file lock.
+    echo ERROR: Unable to remove file lock. >> %LOG_FILE%
 )
 
-echo Done.
+echo Done. >> %LOG_FILE%
 
 goto :EOF
 
@@ -90,5 +98,6 @@
 echo    -f [file=scope.out]: The path to the database file to create
 echo    -p [dir=]:           The path to the project root
 echo    -L [cmd=]:           The file list command to run
+echo    -l [log=]:           The log file to output to
 echo.