Skip to content
Browse files

delete renamed files.

  • Loading branch information...
1 parent c50f686 commit 13773af24d83859626b25910162ae03665a0fe4d @hrsh7th committed Sep 26, 2012
View
128 autoload/unite/kinds/vcs_log.vim
@@ -1,128 +0,0 @@
-let s:save_cpo = &cpo
-set cpo&vim
-
-function! unite#kinds#vcs_log#define()
- return s:kind
-endfunction
-
-let s:kind = {
- \ 'name': 'vcs/log',
- \ 'default_action': 'diff',
- \ 'action_table': {},
- \ 'parents': ['vcs/file']
- \ }
-
-let s:kind.action_table.yank_comment = {
- \ 'description': 'yank commit message.',
- \ 'is_selectable': 0,
- \ }
-function! s:kind.action_table.yank_comment.func(candidates)
- let candidate = type(a:candidates) == type([]) ? a:candidates[0] : a:candidates
- let @" = candidate.action__message
- if has('clipboard')
- let @* = @"
- endif
-endfunction
-
-let s:kind.action_table.yank_revision = {
- \ 'description': 'yank revision.',
- \ 'is_selectable': 0,
- \ }
-function! s:kind.action_table.yank_revision.func(candidates)
- let candidate = type(a:candidates) == type([]) ? a:candidates[0] : a:candidates
- let @" = candidate.action__revision
- if has('clipboard')
- let @* = @"
- endif
-endfunction
-
-let s:kind.action_table.diff = {
- \ 'description': 'diff with original.',
- \ 'is_selectable': 1,
- \ }
-function! s:kind.action_table.diff.func(candidates)
- if len(a:candidates) > 2
- echomsg 'invalid candidates length.'
- return
- endif
-
- " for diff original.
- let candidate = a:candidates[0]
- if len(a:candidates) == 1
- exec 'tabedit ' . candidate.action__path
- diffthis
- vnew
- set bufhidden=delete
- set nobuflisted
- set buftype=nofile
- set noswapfile
- let lines = split(vcs#vcs('cat', [candidate.action__path, candidate.action__revision]), '\n')
- call setline(1, lines[0])
- call append('.', lines[1:-1])
- exec 'file [' . candidate.action__revision . '] ' . candidate.action__path
- setlocal nomodifiable
- diffthis
- return
- endif
-
- tabnew
- set bufhidden=delete
- set nobuflisted
- set buftype=nofile
- set noswapfile
- let lines = split(vcs#vcs('cat', [candidate.action__path, candidate.action__revision]), '\n')
- call setline(1, lines[0])
- call append('.', lines[1:-1])
- exec 'file [REMOTE: ' . candidate.action__revision . '] ' . candidate.action__path
- setlocal nomodifiable
- diffthis
-
- let candidate_ = a:candidates[1]
- vnew
- set bufhidden=delete
- set nobuflisted
- set buftype=nofile
- set noswapfile
- let lines = split(vcs#vcs('cat', [candidate_.action__path, candidate_.action__revision]), '\n')
- call setline(1, lines[0])
- call append('.', lines[1:-1])
- exec 'file [REMOTE: ' . candidate_.action__revision . '] ' . candidate_.action__path
- setlocal nomodifiable
- diffthis
-endfunction
-
-let s:kind.action_table.diff_prev = {
- \ 'description': 'diff with previous revision.',
- \ 'is_selectable': 1,
- \ }
-function! s:kind.action_table.diff_prev.func(candidates)
- for candidate in a:candidates
- tabnew
- set bufhidden=delete
- set nobuflisted
- set buftype=nofile
- set noswapfile
- let lines = split(vcs#vcs('cat', [candidate.action__path, candidate.action__revision]), '\n')
- call setline(1, lines[0])
- call append('.', lines[1:-1])
- exec 'file [REMOTE1: ' . candidate.action__revision . '] ' . candidate.action__path
- setlocal nomodifiable
- diffthis
-
- vnew
- set bufhidden=delete
- set nobuflisted
- set buftype=nofile
- set noswapfile
- let lines = split(vcs#vcs('cat', [candidate.action__path, candidate.action__prev_revision]), '\n')
- call setline(1, lines[0])
- call append('.', lines[1:-1])
- exec 'file [REMOTE2: ' . candidate.action__prev_revision . '] ' . candidate.action__path
- setlocal nomodifiable
- diffthis
- endfor
-endfunction
-
-let &cpo = s:save_cpo
-unlet s:save_cpo
-
View
89 autoload/unite/kinds/vcs_status.vim
@@ -1,89 +0,0 @@
-let s:save_cpo = &cpo
-set cpo&vim
-
-function! unite#kinds#vcs_status#define()
- return s:kind
-endfunction
-
-let s:kind = {
- \ 'name': 'vcs/status',
- \ 'default_action': 'open',
- \ 'action_table': {},
- \ 'parents': ['vcs/file']
- \ }
-
-let s:kind.action_table.commit = {
- \ 'description': 'vcs commit for candidate.',
- \ 'is_selectable': 1,
- \ 'is_invalidate_cache': 1,
- \ 'is_quit': 0,
- \ }
-function! s:kind.action_table.commit.func(candidates)
- let candidates = type(a:candidates) == type([]) ? a:candidates : [a:candidates]
- call vcs#vcs('commit', map(candidates, "v:val.action__path"))
-endfunction
-
-let s:kind.action_table.add = {
- \ 'description': 'vcs add for candidate.',
- \ 'is_selectable': 1,
- \ 'is_invalidate_cache': 1,
- \ 'is_quit': 0,
- \ }
-function! s:kind.action_table.add.func(candidates)
- let candidates = type(a:candidates) == type([]) ? a:candidates : [a:candidates]
- for message in split(vcs#vcs('add', map(copy(candidates), "v:val.action__path")), '\n')
- echomsg message
- endfor
-endfunction
-
-let s:kind.action_table.delete = {
- \ 'description': 'vcs delete for candidate.',
- \ 'is_selectable': 1,
- \ 'is_invalidate_cache': 1,
- \ 'is_quit': 0,
- \ }
-function! s:kind.action_table.delete.func(candidates)
- let candidates = type(a:candidates) == type([]) ? a:candidates : [a:candidates]
- for message in split(vcs#vcs('delete', map(copy(candidates), "v:val.action__path")), '\n')
- echomsg message
- endfor
-endfunction
-
-let s:kind.action_table.revert = {
- \ 'description': 'vcs revert for candidate.',
- \ 'is_selectable': 1,
- \ 'is_invalidate_cache': 1,
- \ 'is_quit': 0,
- \ }
-function! s:kind.action_table.revert.func(candidates)
- let candidates = type(a:candidates) == type([]) ? a:candidates : [a:candidates]
- for message in split(vcs#vcs('revert', map(copy(candidates), "v:val.action__path")), '\n')
- echomsg message
- endfor
-endfunction
-
-let s:kind.action_table.diff = {
- \ 'description': 'diff with remote.',
- \ 'is_selectable': 1
- \ }
-function! s:kind.action_table.diff.func(candidates)
- for candidate in a:candidates
- exec 'tabedit ' . candidate.action__path
- diffthis
- vnew
- set bufhidden=delete
- set nobuflisted
- set buftype=nofile
- set noswapfile
- let lines = split(vcs#vcs('cat', [candidate.action__path]), '\n')
- call setline(1, lines[0])
- call append('.', lines[1:-1])
- exec 'file [REMOTE: HEAD] ' . candidate.action__path
- setlocal nomodifiable
- diffthis
- endfor
-endfunction
-
-let &cpo = s:save_cpo
-unlet s:save_cpo
-
View
43 autoload/unite/kinds/vcs_status_svn.vim
@@ -1,43 +0,0 @@
-let s:save_cpo = &cpo
-set cpo&vim
-
-function! unite#kinds#vcs_status_svn#define()
- return s:kind
-endfunction
-
-let s:kind = {
- \ 'name': 'vcs/status/svn',
- \ 'default_action': 'open',
- \ 'action_table': {},
- \ 'parents': ['vcs/status']
- \ }
-
-let s:kind.action_table.resolve = {
- \ 'description': 'vcs resolve for candidate.',
- \ 'is_selectable': 1,
- \ 'is_invalidate_cache': 1,
- \ 'is_quit': 0,
- \ }
-function! s:kind.action_table.resolve.func(candidates)
- let candidates = type(a:candidates) == type([]) ? a:candidates : [a:candidates]
- for message in split(vcs#vcs('resolve', map(copy(candidates), "v:val.action__path")), '\n')
- echomsg message
- endfor
-endfunction
-
-let s:kind.action_table.resolved = {
- \ 'description': 'vcs resolved for candidate.',
- \ 'is_selectable': 1,
- \ 'is_invalidate_cache': 1,
- \ 'is_quit': 0,
- \ }
-function! s:kind.action_table.resolved.func(candidates)
- let candidates = type(a:candidates) == type([]) ? a:candidates : [a:candidates]
- for message in split(vcs#vcs('resolved', map(copy(candidates), "v:val.action__path")), '\n')
- echomsg message
- endfor
-endfunction
-
-let &cpo = s:save_cpo
-unlet s:save_cpo
-
View
53 autoload/unite/sources/vcs_file_rec.vim
@@ -1,53 +0,0 @@
-let s:save_cpo = &cpo
-set cpo&vim
-
-function! unite#sources#vcs_file_rec#define()
- return s:source
-endfunction
-
-let s:source = {
- \ 'name': 'vcs/file_rec',
- \ 'description': 'vcs repository files.'
- \ }
-
-function! s:source.gather_candidates(args, context)
- if !a:context.is_redraw
- let path = vcs#target(a:args)
- if vcs#detect(path) == ''
- call unite#print_message('[vcs/file_rec] vcs not detected: ' . path)
- return []
- endif
- let path = len(a:args) > 0 ? path : vcs#vcs('root', [path])
- let a:context.source__path = path
- else
- let path = a:context.source__path
- endif
-
- let statuses = vcs#vcs('status', [path])
- let status_map = {}
- for status in statuses
- let status_map[status.path] = status.status
- endfor
-
- let statuslen = max(map(statuses, 'strlen(v:val.status)'))
- return map(unite#get_candidates([['file_rec', path]]), "{
- \ 'word': s:padding(exists('status_map[v:val.action__path]') ? status_map[v:val.action__path] : '', statuslen) . ' | ' . v:val.word,
- \ 'action__path': v:val.action__path,
- \ 'kind': exists('status_map[v:val.action__path]') ? 'vcs/status' : 'vcs/file'
- \ }")
-endfunction
-
-function! s:padding(str, num)
- let strlen = strlen(a:str)
- let num = a:num
- let pad = ''
- while num - strlen > 0
- let pad = pad . ' '
- let num = num - 1
- endwhile
- return a:str . pad
-endfunction
-
-let &cpo = s:save_cpo
-unlet s:save_cpo
-
View
56 autoload/unite/sources/vcs_log.vim
@@ -1,56 +0,0 @@
-let s:save_cpo = &cpo
-set cpo&vim
-
-function! unite#sources#vcs_log#define()
- return s:source
-endfunction
-
-let s:source = {
- \ 'name': 'vcs/log',
- \ 'description': 'vcs repository or file log.'
- \ }
-
-function! s:source.gather_candidates(args, context)
- if !a:context.is_redraw
- let path = vcs#target(a:args)
- if vcs#detect(path) == ''
- call unite#print_message('[vcs/status] vcs not detected: ' . path)
- return []
- endif
- let a:context.source__path = path
- else
- let path = a:context.source__path
- endif
-
- let root = vcs#vcs('root', [path])
- call unite#print_message('[vcs/log] root: ' . root)
- call unite#print_message('[vcs/log] target: ' . path[strlen(root) + 1:-1])
-
- let logs = vcs#vcs('log', [path])
- let revisionlen = max(map(copy(logs), "strlen(v:val.revision)"))
- let authorlen = max(map(copy(logs), "strlen(split(v:val.author, ' ')[0])"))
- return map(logs, "{
- \ 'word': s:padding(v:val.revision, revisionlen) . ' | '. s:padding(split(v:val.author, ' ')[0], authorlen) . ' | ' . v:val.message,
- \ 'action__path': v:val.path,
- \ 'action__revision': v:val.revision,
- \ 'action__prev_revision': v:val.prev_revision,
- \ 'action__author': v:val.author,
- \ 'action__message': v:val.message,
- \ 'kind': 'vcs/log'
- \ }")
-endfunction
-
-function! s:padding(str, num)
- let strlen = strlen(a:str)
- let num = a:num
- let pad = ''
- while num - strlen > 0
- let pad = pad . ' '
- let num = num - 1
- endwhile
- return a:str . pad
-endfunction
-
-let &cpo = s:save_cpo
-unlet s:save_cpo
-
View
49 autoload/unite/sources/vcs_status.vim
@@ -1,49 +0,0 @@
-let s:save_cpo = &cpo
-set cpo&vim
-
-function! unite#sources#vcs_status#define()
- return s:source
-endfunction
-
-let s:source = {
- \ 'name': 'vcs/status',
- \ 'description': 'vcs repository status.'
- \ }
-
-function! s:source.gather_candidates(args, context)
- if !a:context.is_redraw
- let path = vcs#target(a:args)
- let type = vcs#detect(path)
- if type == ''
- call unite#print_message('[vcs/status] vcs not detected: ' . path)
- return []
- endif
- let path = len(a:args) > 0 ? path : vcs#vcs('root', [path])
- let a:context.source__path = path
- let a:context.source__type = type
- else
- let path = a:context.source__path
- let type = a:context.source__type
- endif
-
- let root = vcs#vcs('root', [path])
- call unite#print_message('[vcs/status] type: ' . type)
- call unite#print_message('[vcs/status] root: ' . root)
- call unite#print_message('[vcs/status] target: ' . path[strlen(root) + 1:-1])
-
- let kind = 'vcs/status'
- if len(keys(unite#get_kinds(kind . '/' . type))) > 0
- let kind = kind . '/' . type
- endif
- return map(vcs#vcs('status', [path]), "{
- \ 'word': v:val.status . ' | '. v:val.path[strlen(vcs#vcs('root', [v:val.path])) + 1:-1],
- \ 'source__path': path,
- \ 'action__path': v:val.path,
- \ 'action__status': v:val.status,
- \ 'kind': kind
- \ }")
-endfunction
-
-let &cpo = s:save_cpo
-unlet s:save_cpo
-

0 comments on commit 13773af

Please sign in to comment.
Something went wrong with that request. Please try again.