ramccor / vcscommand

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

Svn get file info problem (regex) #116

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When I load to buffer untracked file I recieve error 688.

Problem in vcssvn.vim. You use in function s:svnFunctions.GetBufferInfo in 201 
line regexp for get information about status of file, but this regexp incoreect 
for untracked files scheduled for adding for example.

For normal controlled file you recieve:
              1193       19 username   www/index.php
But for untracked file string is:
A                -       ?   ?           www/beta.php

Two ways for resolve this problem. Simple - add check for list length:

--- .vim/plugin/vcssvn.vim  2014-06-03 14:21:37.755148801 +0400
+++ .vim/plugin/vcssvn.vim.new  2014-06-03 14:22:02.107147193 +0400
@@ -198,7 +198,13 @@
        return ['Ignored']
    endif

-   let [flags, revision, repository] = matchlist(statusText, 
'^\(.\{9}\)\s*\(\d\+\)\s\+\(\d\+\)')[1:3]
+   let matches = matchlist(statusText, '^\(.\{9}\)\s*\(\d\+\)\s\+\(\d\+\)')
+   if len(matches) > 0
+       let [flags, revision, repository] = matches[1:3]
+   else
+       let revision = ''
+   endif
+
    if revision == ''
        " Error
        return ['Unknown']

Second way - remake regexp for matching blocks with "?".

Original issue reported on code.google.com by visti...@gmail.com on 3 Jun 2014 at 10:25

GoogleCodeExporter commented 9 years ago
Second way is right, you must replace line 201 with that:

let [flags, revision, repository] = matchlist(statusText, 
'^\(.\{9}\)\s*\([-0-9]\+\)\s\+\([?0-9]\+\)')[1:3]

Original comment by visti...@gmail.com on 3 Jun 2014 at 10:44