Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix cd and candidates action__path.

  • Loading branch information...
commit f171c58055ef749dfb4acb7a811b4ae67dd7bc8a 1 parent a757587
@hrsh7th authored
View
1  autoload/unite/kinds/vcs/changeset.vim
@@ -44,4 +44,3 @@ endfunction
let &cpo = s:save_cpo
unlet s:save_cpo
-
View
5 autoload/unite/kinds/vcs/file.vim
@@ -26,11 +26,12 @@ endfunction
let s:kind.action_table.log = {
\ 'description': 'display vcs log.',
- \ 'is_selectable': 1
+ \ 'is_selectable': 1,
+ \ 'is_quit': 0
\ }
function! s:kind.action_table.log.func(candidates)
let candidate = type(a:candidates) == type([]) ? a:candidates[0] : a:candidates
- call unite#start([['vcs/log', candidate.action__path]])
+ call unite#start_temporary([['vcs/log', fnamemodify(candidate.action__path, ':p:h')]])
endfunction
let &cpo = s:save_cpo
View
3  autoload/unite/kinds/vcs/log.vim
@@ -39,10 +39,11 @@ endfunction
let s:kind.action_table.changeset = {
\ 'description': 'display changeset.',
\ 'is_selectable': 0,
+ \ 'is_quit': 0
\ }
function! s:kind.action_table.changeset.func(candidates)
let candidate = type(a:candidates) == type([]) ? a:candidates[0] : a:candidates
- call unite#start([['vcs/changeset', candidate.action__path, candidate.action__revision]])
+ call unite#start_temporary([['vcs/changeset', fnamemodify(candidate.action__path, ':p:h'), candidate.action__revision]])
endfunction
let &cpo = s:save_cpo
View
2  autoload/unite/sources/vcs/changeset.vim
@@ -35,7 +35,7 @@ function! s:source.gather_candidates(args, context)
let statuslen = max(map(copy(changeset.changesets), "strlen(v:val.status)"))
return map(changeset.changesets, "{
- \ 'word': s:padding(v:val.status, statuslen) . ' | ' . v:val.path,
+ \ 'word': s:padding(v:val.status, statuslen) . ' | ' . v:val.path[strlen(vcs#vcs('root', [v:val.path])) + 1:-1],
\ 'action__revision': changeset.revision,
\ 'action__prev_revision': changeset.prev_revision,
\ 'action__author': changeset.author,
View
3  autoload/vcs.vim
@@ -48,7 +48,8 @@ function! vcs#target(args)
else
let args = [a:args]
endif
- let target = type(args) == type([]) ? args[0] : args
+ let _ = type(args) == type([]) ? args[0] : args
+ let target = type(_) == type([]) ? _[0] : _
let target = fnamemodify(target, ':p')
return target
endfunction
View
5 autoload/vcs/git/add.vim
@@ -2,15 +2,16 @@ let s:save_cpo = &cpo
set cpo&vim
function! vcs#git#add#do(args)
- let files = type(a:args) == type([]) ? a:args : [a:args]
-
let cwd = getcwd()
exec 'cd ' . vcs#vcs('root', files)
+
+ let files = type(a:args) == type([]) ? a:args : [a:args]
let result = substitute(vcs#system(join([
\ 'git',
\ 'add',
\ join(vcs#escape(files), ' ')
\ ], ' ')), '\r', '', 'g')
+
exec 'cd ' . cwd
return result
endfunction
View
8 autoload/vcs/git/cat.vim
@@ -2,18 +2,18 @@ let s:save_cpo = &cpo
set cpo&vim
function! vcs#git#cat#do(args)
+ let cwd = getcwd()
+ exec 'cd '. vcs#vcs('root', [a:args])
+
let target = vcs#target(a:args)
let revision = len(a:args) == 2 ? a:args[1] : 'HEAD'
let root = vcs#vcs('root', [target])
-
- let cwd = getcwd()
- exec 'cd '. root
-
let result = substitute(vcs#system(join([
\ 'git',
\ 'show',
\ revision . ":" . vcs#escape(target[strlen(root) + 1:-1])
\ ], ' ')), '\r', '', 'g')
+
exec 'cd ' . cwd
return result
endfunction
View
18 autoload/vcs/git/changeset.vim
@@ -2,18 +2,21 @@ let s:save_cpo = &cpo
set cpo&vim
function! vcs#git#changeset#do(args)
+ let cwd = getcwd()
+ exec 'cd '. vcs#vcs('root', [a:args])
+
let target = vcs#target(a:args)
let revision = len(a:args) == 2 ? a:args[1] : 'HEAD'
let str = s:system(target, revision)
let list = s:str2list(str)
- let changeset = s:parse(target, revision, list)
- return changeset
+ let result = s:parse(target, revision, list)
+
+ exec 'cd ' . cwd
+ return result
endfunction
function! s:system(target, revision)
- let cwd = getcwd()
- exec 'cd ' . vcs#vcs('root', [a:target])
- let result = vcs#system(join([
+ return vcs#system(join([
\ 'git',
\ 'log',
\ '--name-status',
@@ -21,8 +24,6 @@ function! s:system(target, revision)
\ '-1',
\ a:revision,
\ ], ' '))
- exec 'cd ' . cwd
- return result
endfunction
function! s:str2list(str)
@@ -32,6 +33,7 @@ function! s:str2list(str)
endfunction
function! s:parse(target, revision, list)
+ let root = vcs#vcs('root', [a:target])
return {
\ 'revision': a:list[0][0],
\ 'prev_revision': a:list[0][1],
@@ -39,7 +41,7 @@ function! s:parse(target, revision, list)
\ 'date': join(split(a:list[0][4], ' ')[0:1], ' '),
\ 'message': a:list[0][5],
\ 'changesets': map(a:list[1:], "{
- \ 'path': substitute(v:val, '^.*\\s', '', 'g'),
+ \ 'path': root . '/' . substitute(v:val, '^.*\\s', '', 'g'),
\ 'status': substitute(v:val, '\\s.*$', '', 'g'),
\ }")
\ }
View
7 autoload/vcs/git/commit.vim
@@ -2,11 +2,11 @@ let s:save_cpo = &cpo
set cpo&vim
function! vcs#git#commit#do(args)
- let files = type(a:args) == type([]) ? a:args : [a:args]
+ let cwd = getcwd()
+ exec 'cd ' . vcs#vcs('root', a:args)
+ let files = type(a:args) == type([]) ? a:args : [a:args]
" TODO: collect windows.
- let cwd = getcwd()
- exec 'cd ' . vcs#vcs('root', files)
exec join([
\ '!',
\ 'export EDITOR=vim;',
@@ -15,6 +15,7 @@ function! vcs#git#commit#do(args)
\ '--include',
\ join(vcs#escape(files), ' ')
\ ], ' ')
+
exec 'cd ' . cwd
endfunction
View
7 autoload/vcs/git/delete.vim
@@ -2,10 +2,10 @@ let s:save_cpo = &cpo
set cpo&vim
function! vcs#git#delete#do(args)
- let files = type(a:args) == type([]) ? a:args : [a:args]
-
let cwd = getcwd()
- exec 'cd ' . vcs#vcs('root', files)
+ exec 'cd ' . vcs#vcs('root', a:args)
+
+ let files = type(a:args) == type([]) ? a:args : [a:args]
let result = substitute(vcs#system(join([
\ 'git',
\ 'rm',
@@ -13,6 +13,7 @@ function! vcs#git#delete#do(args)
\ '--cached',
\ join(vcs#escape(files), ' ')
\ ], ' ')), '\r', '', 'g')
+
exec 'cd ' . cwd
return result
endfunction
View
15 autoload/vcs/git/log.vim
@@ -2,24 +2,25 @@ let s:save_cpo = &cpo
set cpo&vim
function! vcs#git#log#do(args)
+ let cwd = getcwd()
+ exec 'cd ' . vcs#vcs('root', a:args)
+
let target = vcs#target(a:args)
let str = s:system(target)
let list = s:str2list(str)
- let list = s:parse(target, list)
- return list
+ let result = s:parse(target, list)
+
+ exec 'cd ' . cwd
+ return result
endfunction
function! s:system(target)
- let cwd = getcwd()
- exec 'cd ' . vcs#vcs('root', [a:target])
- let result = vcs#system(join([
+ return vcs#system(join([
\ 'git',
\ 'log',
\ '--pretty=format:"' . g:vcs#git#log_format . '"',
\ vcs#escape(a:target)
\ ], ' '))
- exec 'cd ' . cwd
- return result
endfunction
function! s:str2list(str)
View
5 autoload/vcs/git/revert.vim
@@ -2,11 +2,10 @@ let s:save_cpo = &cpo
set cpo&vim
function! vcs#git#revert#do(args)
- let files = type(a:args) == type([]) ? a:args : [a:args]
-
let cwd = getcwd()
- exec 'cd ' . vcs#vcs('root', files)
+ exec 'cd ' . vcs#vcs('root', a:args)
+ let files = type(a:args) == type([]) ? a:args : [a:args]
let result = ''
for file in files
let status = vcs#vcs('status', [file])
View
15 autoload/vcs/git/status.vim
@@ -2,25 +2,26 @@ let s:save_cpo = &cpo
set cpo&vim
function! vcs#git#status#do(args)
+ let cwd = getcwd()
+ exec 'cd ' . vcs#vcs('root', a:args)
+
let target = vcs#target(a:args)
let str = s:system(target)
let list = s:str2list(str)
let list = s:extract(list)
- let list = s:parse(target, list)
- return list
+ let result = s:parse(target, list)
+
+ exec 'cd ' . cwd
+ return result
endfunction
function! s:system(target)
- let cwd = getcwd()
- exec 'cd ' . vcs#vcs('root', [a:target])
- let result = vcs#system(join([
+ return vcs#system(join([
\ 'git',
\ 'status',
\ '--short',
\ vcs#escape(a:target)
\ ], ' '))
- exec 'cd ' . cwd
- return result
endfunction
function! s:str2list(str)
View
8 autoload/vcs/svn/add.vim
@@ -2,12 +2,18 @@ let s:save_cpo = &cpo
set cpo&vim
function! vcs#svn#add#do(args)
+ let cwd = getcwd()
+ exec 'cd ' . vcs#vcs('root', a:args)
+
let files = type(a:args) == type([]) ? a:args : [a:args]
- return substitute(vcs#system(join([
+ let result = substitute(vcs#system(join([
\ 'svn',
\ 'add',
\ join(vcs#escape(files), ' ')
\ ], ' ')), '\r', '', 'g')
+
+ exec 'cd ' . cwd
+ return result
endfunction
let &cpo = s:save_cpo
View
9 autoload/vcs/svn/cat.vim
@@ -2,16 +2,21 @@ let s:save_cpo = &cpo
set cpo&vim
function! vcs#svn#cat#do(args)
+ let cwd = getcwd()
+ exec 'cd ' . vcs#vcs('root', a:args)
+
let target = vcs#target(a:args)
let revision = len(a:args) == 2 ? a:args[1] : 'HEAD'
-
- return substitute(vcs#system(join([
+ let result = substitute(vcs#system(join([
\ 'svn',
\ 'cat',
\ '--revision',
\ revision,
\ vcs#escape(target)
\ ], ' ')), '\r', '', 'g')
+
+ exec 'cd ' . cwd
+ return result
endfunction
let &cpo = s:save_cpo
View
15 autoload/vcs/svn/changeset.vim
@@ -2,12 +2,18 @@ let s:save_cpo = &cpo
set cpo&vim
function! vcs#svn#changeset#do(args)
+ let cwd = getcwd()
+ exec 'cd ' . vcs#vcs('root', a:args)
+
let target = vcs#target(a:args)
let revision = len(a:args) == 2 ? a:args[1] : 'HEAD'
let str = s:system(target, revision)
let list = s:str2list(str)
let list = s:extract(list)
- return s:parse(target, list, revision)
+ let result = s:parse(target, list, revision)
+
+ exec 'cd ' . cwd
+ return result
endfunction
function! s:system(target, revision)
@@ -17,7 +23,7 @@ function! s:system(target, revision)
\ '--limit 2',
\ '--verbose',
\ '--stop-on-copy',
- \ vcs#escape(a:target) . '@' . a:revision
+ \ vcs#escape(vcs#vcs('root', [a:target])) . '@' . a:revision
\ ], ' '))
endfunction
@@ -61,12 +67,13 @@ function! s:parse(target, list, revision)
endfunction
function! s:repository2working(target, path)
+ let root = vcs#vcs('root', [a:target])
let list = map(split(vcs#system(join([
\ 'svn',
\ 'info',
- \ a:target
+ \ vcs#escape(vcs#vcs('root', [a:target]))
\ ], ' ')), "\n")[2:3], "join(split(v:val, ' ')[1:-1], '')")
- return a:path[len(list[0]) - len(list[1]) + 1:-1]
+ return root . '/' . a:path[len(list[0]) - len(list[1]) + 1:-1]
endfunction
let &cpo = s:save_cpo
View
5 autoload/vcs/svn/commit.vim
@@ -2,6 +2,9 @@ let s:save_cpo = &cpo
set cpo&vim
function! vcs#svn#commit#do(args)
+ let cwd = getcwd()
+ exec 'cd ' . vcs#vcs('root', a:args)
+
let files = type(a:args) == type([]) ? a:args : [a:args]
" TODO: collect windows.
exec join([
@@ -12,6 +15,8 @@ function! vcs#svn#commit#do(args)
\ 'commit',
\ join(vcs#escape(files), ' ')
\ ], ' ')
+
+ exec 'cd ' . cwd
endfunction
let &cpo = s:save_cpo
View
8 autoload/vcs/svn/delete.vim
@@ -2,12 +2,18 @@ let s:save_cpo = &cpo
set cpo&vim
function! vcs#svn#delete#do(args)
+ let cwd = getcwd()
+ exec 'cd ' . vcs#vcs('root', a:args)
+
let files = type(a:args) == type([]) ? a:args : [a:args]
- return substitute(vcs#system(join([
+ let result = substitute(vcs#system(join([
\ 'svn',
\ 'delete',
\ join(vcs#escape(files), ' ')
\ ], ' ')), '\r', '', 'g')
+
+ exec 'cd ' . cwd
+ return result
endfunction
let &cpo = s:save_cpo
View
9 autoload/vcs/svn/log.vim
@@ -2,12 +2,17 @@ let s:save_cpo = &cpo
set cpo&vim
function! vcs#svn#log#do(args)
+ let cwd = getcwd()
+ exec 'cd ' . vcs#vcs('root', a:args)
+
let target = vcs#target(a:args)
let str = s:system(target)
let list = s:str2list(str)
let list = s:extract(list)
- let list = s:parse(target, list)
- return list
+ let result = s:parse(target, list)
+
+ exec 'cd ' . cwd
+ return result
endfunction
function! s:system(target)
View
8 autoload/vcs/svn/resolve.vim
@@ -2,15 +2,21 @@ let s:save_cpo = &cpo
set cpo&vim
function! vcs#svn#resolve#do(args)
+ let cwd = getcwd()
+ exec 'cd ' . vcs#vcs('root', a:args)
+
let files = type(a:args) == type([]) ? a:args : [a:args]
let accept = input('accept? ', '')
- return substitute(vcs#system(join([
+ let result = substitute(vcs#system(join([
\ 'svn',
\ 'resolve',
\ '--accept',
\ accept,
\ join(vcs#escape(files), ' ')
\ ], ' ')), '\r', '', 'g')
+
+ exec 'cd ' . cwd
+ return result
endfunction
let &cpo = s:save_cpo
View
8 autoload/vcs/svn/resolved.vim
@@ -2,12 +2,18 @@ let s:save_cpo = &cpo
set cpo&vim
function! vcs#svn#resolved#do(args)
+ let cwd = getcwd()
+ exec 'cd ' . vcs#vcs('root', a:args)
+
let files = type(a:args) == type([]) ? a:args : [a:args]
- return substitute(vcs#system(join([
+ let result = substitute(vcs#system(join([
\ 'svn',
\ 'resolved',
\ join(vcs#escape(files), ' ')
\ ], ' ')), '\r', '', 'g')
+
+ exec 'cd ' . cwd
+ return result
endfunction
let &cpo = s:save_cpo
View
8 autoload/vcs/svn/revert.vim
@@ -2,12 +2,18 @@ let s:save_cpo = &cpo
set cpo&vim
function! vcs#svn#revert#do(args)
+ let cwd = getcwd()
+ exec 'cd ' . vcs#vcs('root', a:args)
+
let files = type(a:args) == type([]) ? a:args : [a:args]
- return substitute(vcs#system(join([
+ let result = substitute(vcs#system(join([
\ 'svn',
\ 'revert',
\ join(vcs#escape(files), ' ')
\ ], ' ')), '\r', '', 'g')
+
+ exec 'cd ' . cwd
+ return result
endfunction
let &cpo = s:save_cpo
View
9 autoload/vcs/svn/status.vim
@@ -2,12 +2,17 @@ let s:save_cpo = &cpo
set cpo&vim
function! vcs#svn#status#do(args)
+ let cwd = getcwd()
+ exec 'cd ' . vcs#vcs('root', a:args)
+
let target = vcs#target(a:args)
let str = s:system(target)
let list = s:str2list(str)
let list = s:extract(list)
- let list = s:parse(list)
- return list
+ let result = s:parse(list)
+
+ exec 'cd ' . cwd
+ return result
endfunction
function! s:system(target)
Please sign in to comment.
Something went wrong with that request. Please try again.