contrib/vim/hgcommand.vim
changeset 2637 fcfd46c4a27a
parent 2636 733fff9b23f7
child 2638 8dadff054acf
equal deleted inserted replaced
2636:733fff9b23f7 2637:fcfd46c4a27a
   320     return ""
   320     return ""
   321   endif
   321   endif
   322   let fileName=bufname(hgBufferCheck)
   322   let fileName=bufname(hgBufferCheck)
   323   let fileNameWithoutLink=s:HGResolveLink(fileName)
   323   let fileNameWithoutLink=s:HGResolveLink(fileName)
   324   let realFileName = fnamemodify(fileNameWithoutLink, ':t')
   324   let realFileName = fnamemodify(fileNameWithoutLink, ':t')
   325   let oldCwd=s:HGChangeToCurrentFileDir(fileName)
   325   let oldCwd=s:HGChangeToCurrentFileDir(realFileName)
   326   try
   326   try
   327     let hgCommand = s:HGGetOption("HGCommandHGExec", "hg") . " root  " 
   327     let hgCommand = s:HGGetOption("HGCommandHGExec", "hg") . " root  " 
   328     let roottext=system(hgCommand)
   328     let roottext=system(hgCommand)
   329     " Suppress ending null char ! Does it work in window ?
   329     " Suppress ending null char ! Does it work in window ?
   330     let roottext=substitute(roottext,'^.*/\([^/\n\r]*\)\n\_.*$','\1','')
   330     let roottext=substitute(roottext,'^.*/\([^/\n\r]*\)\n\_.*$','\1','')
   331     if match(getcwd()."/".fileNameWithoutLink, roottext) == -1
   331     if match(getcwd()."/".fileNameWithoutLink, roottext) == -1
   332       return ""
   332       return ""
   333     endif
   333     endif
   334     let returnExpression = ""
   334     let returnExpression = ""
   335     let hgCommand = s:HGGetOption("HGCommandHGExec", "hg") . " status -mardui " . fileName
   335     if a:repositoryVar != ""
       
   336       let returnExpression=returnExpression . " | let " . a:repositoryVar . "='" . roottext . "'"
       
   337     endif
       
   338     let hgCommand = s:HGGetOption("HGCommandHGExec", "hg") . " status -mardui " . realFileName
   336     let statustext=system(hgCommand)
   339     let statustext=system(hgCommand)
   337     if(v:shell_error)
   340     if(v:shell_error)
   338       return ""
   341       return ""
   339     endif
       
   340     if a:repositoryVar != ""
       
   341       let returnExpression=returnExpression . " | let " . a:repositoryVar . "='" . roottext . "'"
       
   342     endif
   342     endif
   343     if match(statustext, '^[?I]') >= 0 
   343     if match(statustext, '^[?I]') >= 0 
   344       let revision="NEW"
   344       let revision="NEW"
   345     elseif match(statustext, '^[R]') >= 0 
   345     elseif match(statustext, '^[R]') >= 0 
   346       let revision="REMOVED"
   346       let revision="REMOVED"
  1675    buffers, uses some hacks to try to restore the state of the original buffer 
  1675    buffers, uses some hacks to try to restore the state of the original buffer 
  1676    when the scratch buffer containing the other version is destroyed.  There 
  1676    when the scratch buffer containing the other version is destroyed.  There 
  1677    may still be bugs in here, depending on many configuration details.
  1677    may still be bugs in here, depending on many configuration details.
  1678 
  1678 
  1679 ==============================================================================
  1679 ==============================================================================
       
  1680 
       
  1681 9. TODO  						      *hgcommand-todo*
       
  1682 
       
  1683    Integrate symlink tracking once HG will support them.
       
  1684 ==============================================================================
  1680 === END_DOC
  1685 === END_DOC
  1681 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  1686 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  1682 " v im:tw=78:ts=8:ft=help:norl:
  1687 " v im:tw=78:ts=8:ft=help:norl:
  1683 " vim600: set foldmethod=marker  tabstop=8 shiftwidth=2 softtabstop=2 smartindent smarttab  :
  1688 " vim600: set foldmethod=marker  tabstop=8 shiftwidth=2 softtabstop=2 smartindent smarttab  :
  1684 "fileencoding=iso-8859-15 
  1689 "fileencoding=iso-8859-15