From 1fabba03795bb9241e3fb177d3fd37f906246bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98ystein=20Walle?= Date: Mon, 6 Jun 2011 11:57:14 +0200 Subject: [PATCH] Added support for repositories on Launchpad --- autoload/vundle/config.vim | 7 ++++++- autoload/vundle/installer.vim | 8 ++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index 0e32183..34ff173 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -40,6 +40,7 @@ endf func! s:parse_name(arg) let arg = a:arg + let vcs = 'git' if arg =~? '^\s*\(gh\|github\):\S\+' \ || arg =~? '^[a-z0-9][a-z0-9-]*/[^/]\+$' let uri = 'https://github.com/'.split(arg, ':')[-1] @@ -49,11 +50,15 @@ func! s:parse_name(arg) \ || arg =~? '\.git\s*$' let uri = arg let name = split( substitute(uri,'/\?\.git\s*$','','i') ,'\/')[-1] + elseif arg =~? '^lp:' + let uri = arg + let name = split (uri, ':')[-1] + let vcs = 'bzr' else let name = arg let uri = 'https://github.com/vim-scripts/'.name.'.git' endif - return {'name': name, 'uri': uri } + return {'name': name, 'uri': uri, 'vcs': vcs } endf func! s:rtp_rm_a() diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index 3edbccf..935ac25 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -66,17 +66,17 @@ func! s:helptags(rtp) abort endf func! s:sync(bang, bundle) abort - let git_dir = expand(a:bundle.path().'/.git/') - if isdirectory(git_dir) + let repo_dir = expand(a:bundle.path().'/.'.a:bundle.vcs.'/') + if isdirectory(repo_dir) if !(a:bang) | return 0 | endif - let cmd = 'cd '.shellescape(a:bundle.path()).' && git pull' + let cmd = 'cd '.shellescape(a:bundle.path()).' && '.a:bundle.vcs.' pull' if (has('win32') || has('win64')) let cmd = substitute(cmd, '^cd ','cd /d ','') " add /d switch to change drives let cmd = '"'.cmd.'"' " enclose in quotes endif else - let cmd = 'git clone '.a:bundle.uri.' '.shellescape(a:bundle.path()) + let cmd = a:bundle.vcs.' clone '.a:bundle.uri.' '.shellescape(a:bundle.path()) endif silent exec '!'.cmd return 1