juneedahamed / vc.vim

Support for SVN, Git, HG and BZR
47 stars 9 forks source link

All's well except VCDiff #13

Open morsedl opened 6 years ago

morsedl commented 6 years ago

Hi,

The plugin is working well for me with vim 8.0.647 under tmux under Cygwin on Windows 10.

However, the command I will use the most, VCDiff, does not:

screenshot-1

After I press Enter, I get this split and an error message:

screenshot-2

(the error messages reads as follows (it's a bit hard to read in the screenshot): svn: E205000: Syntaxfehler in Revisionsparameter »http://svn/svnfinal/libs/Cinema4D/trunk/plugins/Dallmeier-Tools/DallmeierTools.pyp«)

Oddly, however, if I run VCLog and just press enter, things seem to work fine:

screenshot-3

I've tried setting debugging in .vimrc:

let g:vc_enable_debug = 1
let g:vc_enable_extended_debug = 1

but this does not seem to provide any additional information.

Any ideas?

Thanks!

idbrii commented 6 years ago

Not sure, but try nnoremap <silent> <leader>fd :silent! cd %:p:h <Bar>VCDiff<CR>

Changing directory to where your file is might help. If not, could you translate the error message to english?

morsedl commented 6 years ago

Hi idbrii,

Thanks for your reply. I tried both --- that is, starting vim in the same folder as the file for which I'm running VCDiff, and adding the nnoremap command you specified to my .vimrc.

Unfortunately the results were exactly the same (same problems, same error messages, etc.).

Any further suggestions? Is there any way I can debug / modify the call to svn that's being made? It seems prettly clear the problem is the way one (or more) revisions is being specified as arguments to svn (based on the error messages). Or it may be due to passing something like "r#http://.." to svn (i.e., I would expect simply http://...)?

Apropos, you asked for translation of the error messages:

First screenshot: "r#http://...." Shell ended with error code 1

Second screenshot: svn: E205000: Syntax error in revision parameter: "http://..."

Thanks, Doug

idbrii commented 6 years ago

If let g:vc_enable_debug = 1 didn't help, then your best bet is to add some echo statements to the code. Or try let morsedl_debug = url to capture data for reading later (useful if echo is not seen or you don't want echoerr to disrupt the flow).

   fun! vc#svn#diff(argsd) "{{{2
      let diffwith = ""
      let url = vc#svn#url(a:argsd.meta.entity)
      echoerr url

It looks like it's passing your repository url as the revision number (r should be followed by an integer).

Does VCInfo give the output you'd expect?

I'd also try some svn commands from vim's commandline: :! svn info or in blank buffer read! svn diff DallmeirTools.pyp

morsedl commented 6 years ago

@idbrii Thanks for your reply, and apologies for the slow response.

Yes, VCInfo provides the the svn summary one would expect. Also, both :! svn info in a blank buffer and read! svn diff DallmeierTools.pyp work fine.

Agreed, it's been pretty clear to me that the problem is the plugin is passing my repo url instead of a revision number. Why that is is of course not clear to me.

Wait, OK, after a bit more exploring, I believe I have found the problem, namely that our repo uses https and not http, and that our IT department has let the ssl certificate expire.

Strange, in that most svn commands work at the CLI for me regardless. But "svn info" for a https:// path does not:

$ svn --non-interactive --trust-server-cert info https://svn/svnfinal/libs/Cinema4D/trunk/plugins/Dallmeier-Tools/DallmeierTools.pyp
svn: E170013: Unable to connect to a repository at URL 'https://svn/svnfinal/libs/Cinema4D/trunk/plugins/Dallmeier-Tools/DallmeierTools.pyp'
svn: E230001: Server SSL certificate verification failed: certificate has expired, certificate issued for a different hostname, issuer is not trusted

And since vc#svn#lastchngdrev exec()'s "svn info" to get the revision number for a file, it's failing and thus this is almost certainly the root of the problem.

So, it might be worth putting some error handling around vc.vim's exec()'s to "svn info" so others don't fall into this problem, as getting an error message with r# in it isn't very diagnostic (as you've noted).

I've contacted our IT department to get our ssl cert up to date and will report back if somehow after this the problem persists.

One quick question though: How do I tell vc.vim to use https:// instead of http:// in these URLs, as our setup has http:// turned off. As such, I have to configure vc.vim to always use https:// if it employs a svn url.

Thanks again, Doug

morsedl commented 6 years ago

@idbrii Well, it turns out we do have an old svn repo over https://, but that's not the one I use.

So, back to digging, as what I wrote in my previous obviously does not apply. :-(

morsedl commented 6 years ago

@idbrii OK, found the problem, definitive this time, as now VCDiff works.

The plugin assumes English. I live and work in Germany and work at the CLI in German.

Hence, changing as follows:

        " let find = '^Last Changed Rev:'
        let find = '^Letzte geänderte Rev:'

in vc#svn#lastchngdrev (presently line 735 in autoload/vc/svn.vim) fixed the problem.

So, I'm happy, thanks! No doubt language issues might come up again, but at least now I'll start there first.

@juneedahamed I see that throughout the plugin it's assumed that exec() to CLI program assume English. You probably should note that prominently on the main github page for vc.vim for the plugin. And thanks again for a solid plugin. With it's caching, it's much faster than any other VC plugin for vim that I've used.

idbrii commented 6 years ago

@juneedahamed Maybe all svn commands could be executed with

export LANG=C
export LC_MESSAGES=C

https://stackoverflow.com/a/1315757/79125

Or something like this:

let $LC_MESSAGES_bak = $LC_MESSAGES
let $LC_MESSAGES = 'C'
let LANG_bak = $LANG
let $LANG = 'C'

system('svn')

let $LANG = LANG_bak
let $LC_MESSAGES = $LC_MESSAGES_bak
morsedl commented 6 years ago

@idbrii Yup.

See also my similar suggestion at issue #18 .

morsedl commented 6 years ago

Also, I suspect issue #11 might also be the same problem, but it's hard to say for sure.