Added Perforce plugin.
[profile.git] / .vim / perforce / perforcebugrep.vim
1 " perforcebugrep.vim: Generate perforcebugrep.txt for perforce plugin.
2 " Author: Hari Krishna (hari_vim at yahoo dot com)
3 " Last Change: 29-Aug-2006 @ 17:57
4 " Created:     07-Nov-2003
5 " Requires:    Vim-7.0, perforce.vim(4.0)
6 " Version:     2.1.0
7 " Licence: This program is free software; you can redistribute it and/or
8 "          modify it under the terms of the GNU General Public License.
9 "          See http://www.gnu.org/copyleft/gpl.txt 
10
11 if !exists("loaded_perforce")
12   runtime plugin/perforce.vim
13 endif
14 if !exists("loaded_perforce") || loaded_perforce < 400
15   echomsg "perforcebugrep: You need a newer version of perforce.vim plugin"
16   finish
17 endif
18
19 " Make sure line-continuations won't cause any problem. This will be restored
20 "   at the end
21 let s:save_cpo = &cpo
22 set cpo&vim
23
24 " Based on $VIM/bugreport.vim
25 let _more = &more
26 try
27   PFInitialize " Make sure it is autoloaded.
28
29   set nomore
30   call delete('perforcebugrep.txt')
31   if has("unix")
32     !echo "uname -a" >perforcebugrep.txt
33     !uname -a >>perforcebugrep.txt
34   endif
35
36   redir >>perforcebugrep.txt
37   version
38
39   echo "Perforce plugin version: " . loaded_perforce
40   echo "Genutils plugin version: " . loaded_genutils
41
42   echo "--- Perforce Plugin Settings ---"
43   for nextSetting in perforce#PFGet('s:settings')
44     let value = perforce#PFCall('s:_', nextSetting)
45     echo nextSetting.': '.value
46   endfor
47   echo "s:p4Contexts: " . string(perforce#PFCall('s:_', 'Contexts'))
48   echo "g:p4CurDirExpr: " . perforce#PFCall('s:_', 'CurDirExpr')
49   echo "g:p4CurPresetExpr: " . perforce#PFCall('s:_', 'CurPresetExpr')
50   echo "s:p4Client: " . perforce#PFCall('s:_', 'Client')
51   echo "s:p4User: " . perforce#PFCall('s:_', 'User')
52   echo "s:p4Port: " . perforce#PFCall('s:_', 'Port')
53
54   echo "--- Current Buffer ---"
55   echo "Current buffer: " . expand('%')
56   echo "Current directory: " . getcwd()
57   let tempDir = perforce#PFCall('s:_', 'TempDir')
58   if isdirectory(tempDir)
59     echo 'temp directory "' . tempDir . '" exists'
60   else
61     echo 'temp directory "' . tempDir . '" does NOT exist'
62   endif
63   if exists('b:p4OrgFileName')
64     echo 'b:p4OrgFileName: ' . b:p4OrgFileName
65   endif
66   if exists('b:p4Command')
67     echo 'b:p4Command: ' . b:p4Command
68   endif
69   if exists('b:p4Options')
70     echo 'b:p4Options: ' . b:p4Options
71   endif
72   if exists('b:p4FullCmd')
73     echo 'b:p4FullCmd: '. b:p4FullCmd
74   endif
75   if exists('g:p4FullCmd')
76     echo 'g:p4FullCmd: '. g:p4FullCmd
77   endif
78   setlocal
79
80   echo "--- p4 info ---"
81   let info = perforce#PFCall('perforce#PFIF', '1', '4', 'info')
82   " The above resets redir.
83   redir >>perforcebugrep.txt
84   echo info
85
86   set all
87 finally
88   redir END
89   let &more = _more
90   sp perforcebugrep.txt
91 endtry
92
93 " Restore cpo.
94 let &cpo = s:save_cpo
95 unlet s:save_cpo
96
97 " vim6:fdm=marker et sw=2