contrib/vim/hgcommand.vim
changeset 2634 105708ba518f
parent 2607 070736e20dfd
child 2635 37bcccf8a683
equal deleted inserted replaced
2633:f7be7babc75a 2634:105708ba518f
   169       let resultBufferName=bufName . ' (' . counter . ')'
   169       let resultBufferName=bufName . ' (' . counter . ')'
   170     endwhile
   170     endwhile
   171   endif
   171   endif
   172 
   172 
   173   let hgCommand = s:HGGetOption("HGCommandHGExec", "hg") . " " . a:cmd
   173   let hgCommand = s:HGGetOption("HGCommandHGExec", "hg") . " " . a:cmd
   174   echomsg "DBG :".hgCommand
   174   "echomsg "DBG :".hgCommand
   175   let hgOut = system(hgCommand)
   175   let hgOut = system(hgCommand)
   176   " HACK:  diff command does not return proper error codes
   176   " HACK:  diff command does not return proper error codes
   177   if v:shell_error && a:cmdName != 'hgdiff'
   177   if v:shell_error && a:cmdName != 'hgdiff'
   178     if strlen(hgOut) == 0
   178     if strlen(hgOut) == 0
   179       echoerr "HG command failed"
   179       echoerr "HG command failed"
   317   let hgBufferCheck=s:HGCurrentBufferCheck()
   317   let hgBufferCheck=s:HGCurrentBufferCheck()
   318   if hgBufferCheck == -1 
   318   if hgBufferCheck == -1 
   319     return ""
   319     return ""
   320   endif
   320   endif
   321   let fileName=bufname(hgBufferCheck)
   321   let fileName=bufname(hgBufferCheck)
   322   let realFileName = fnamemodify(s:HGResolveLink(fileName), ':t')
   322   let fileNameWithoutLink=s:HGResolveLink(fileName)
       
   323   let realFileName = fnamemodify(fileNameWithoutLink, ':t')
   323   let oldCwd=s:HGChangeToCurrentFileDir(fileName)
   324   let oldCwd=s:HGChangeToCurrentFileDir(fileName)
   324   try
   325   try
   325      ""TODO
   326     let hgCommand = s:HGGetOption("HGCommandHGExec", "hg") . " root  " 
   326     "if !filereadable('HG/Root')
   327     let roottext=system(hgCommand)
   327       "return ""
   328     " Suppress ending null char ! Does it work in window ?
   328     "endif
   329     let roottext=substitute(roottext, '.$', '', "")
       
   330     if match(getcwd()."/".fileNameWithoutLink, roottext) == -1
       
   331       return ""
       
   332     endif
   329     let hgCommand = s:HGGetOption("HGCommandHGExec", "hg") . " status -mardui " . fileName
   333     let hgCommand = s:HGGetOption("HGCommandHGExec", "hg") . " status -mardui " . fileName
   330     let statustext=system(hgCommand)
   334     let statustext=system(hgCommand)
   331     if(v:shell_error)
   335     if(v:shell_error)
   332       return ""
   336       return ""
   333     endif
   337     endif
   684     echo "No annotatation available for new file."
   688     echo "No annotatation available for new file."
   685     return -1
   689     return -1
   686   endif
   690   endif
   687 
   691 
   688   let resultBuffer=s:HGDoCommand('annotate -ndu -r ' . revision, 'hgannotate', revision) 
   692   let resultBuffer=s:HGDoCommand('annotate -ndu -r ' . revision, 'hgannotate', revision) 
   689   echomsg "DBG: ".resultBuffer
   693   "echomsg "DBG: ".resultBuffer
   690   if resultBuffer !=  -1
   694   if resultBuffer !=  -1
   691     set filetype=HGAnnotate
   695     set filetype=HGAnnotate
   692   endif
   696   endif
   693 
   697 
   694   return resultBuffer
   698   return resultBuffer