(add unix users bit) |
(Change <tt> to <code>, perhaps also minor tweak.) |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{ScriptComments|perforce: Perforce source control features}} |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
+ | <pre> |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
+ | </pre> |
||
− | And do a dos2unix |
+ | And do a dos2unix to convert line endings: |
+ | <pre> |
||
⚫ | |||
⚫ | |||
⚫ | |||
+ | </pre> |
||
+ | == Handling AltRoots == |
||
⚫ | |||
+ | If you have altroots in your perforce user specification you might |
||
⚫ | |||
+ | want to add the equivalent of 'alias p4='p4 -d `/bin/pwd`' |
||
⚫ | |||
+ | |||
+ | I did this by changing this around line 105: |
||
+ | |||
+ | <pre> |
||
+ | "Basic check for p4-enablement |
||
+ | if executable( "p4" ) |
||
+ | let s:PerforceExecutable="p4 -d " . getcwd() |
||
+ | else |
||
+ | augroup! perforce |
||
+ | endif |
||
+ | </pre> |
||
+ | |||
+ | == Handling Symlinks == |
||
+ | |||
+ | Let's say you have a symlink to a file. If you want to edit the file you would normally have to do something like "p4 edit `readlink $file`". This hack does basically that. |
||
+ | |||
+ | Line 122-ish |
||
+ | <pre> |
||
+ | "---------------------------------------------------------------------------- |
||
+ | " A wrapper around a p4 command line for the current buffer |
||
+ | "---------------------------------------------------------------------------- |
||
+ | function s:P4ShellCommandCurrentBuffer( sCmd ) |
||
+ | let filename = resolve(expand( "%:p" )) |
||
+ | return s:P4ShellCommand( a:sCmd . " " . filename ) |
||
+ | endfunction |
||
+ | </pre> |
||
+ | |||
+ | == Not Requiring a Changelist == |
||
+ | This plugin assumes you use the methodology where you have an explicit changelist created for every edit. If you want to use a default changelist, then you need to remove the "-c" options given to a couple commands: |
||
+ | |||
+ | Line 335-ish |
||
+ | <pre> |
||
+ | " let listnum = "" |
||
+ | " let listnum = s:P4GetChangelist( "Current changelists:\n" . s:P4GetChangelists(0) . "\nEnter changelist number: ", |
||
+ | " if listnum == "" |
||
+ | " echomsg "No changelist specified. Edit cancelled." |
||
+ | " return |
||
+ | " endif |
||
+ | " call s:P4ShellCommandCurrentBuffer( action . " -c " . listnum ) |
||
+ | call s:P4ShellCommandCurrentBuffer( action ) |
||
+ | </pre> |
||
+ | |||
+ | Line 366-ish |
||
+ | <pre> |
||
+ | " let listnum = "" |
||
+ | " let listnum = s:P4GetChangelist( "Current changelists:\n" . s:P4GetChangelists(0) . "\nEnter changelist number |
||
+ | " if listnum == "" |
||
+ | " echomsg "No changelist specified. Delete cancelled." |
||
+ | " return |
||
+ | " endif |
||
+ | " call s:P4ShellCommandCurrentBuffer( "delete -c " . listnum ) |
||
+ | call s:P4ShellCommandCurrentBuffer( "delete" ) |
||
+ | </pre> |
||
+ | |||
+ | ==Comments== |
Latest revision as of 09:42, 14 July 2012
Use this page to discuss script 167 perforce: Perforce source control features
- Add constructive comments, bug reports, or discuss improvements (see the guideline).
- Do not document the script here (the author should do that on vim.org).
- This page may be out of date: check the script's vim.org page above, and its release notes.
Unix users[]
Edit line 106 to change p4.exe
to p4
"Basic check for p4-enablement if executable( "p4" ) let s:PerforceExecutable="p4" else
And do a dos2unix to convert line endings:
$vim perforce.vim :set ff=unix :wq!
Handling AltRoots[]
If you have altroots in your perforce user specification you might want to add the equivalent of 'alias p4='p4 -d `/bin/pwd`'
I did this by changing this around line 105:
"Basic check for p4-enablement if executable( "p4" ) let s:PerforceExecutable="p4 -d " . getcwd() else augroup! perforce endif
Handling Symlinks[]
Let's say you have a symlink to a file. If you want to edit the file you would normally have to do something like "p4 edit `readlink $file`". This hack does basically that.
Line 122-ish
"---------------------------------------------------------------------------- " A wrapper around a p4 command line for the current buffer "---------------------------------------------------------------------------- function s:P4ShellCommandCurrentBuffer( sCmd ) let filename = resolve(expand( "%:p" )) return s:P4ShellCommand( a:sCmd . " " . filename ) endfunction
Not Requiring a Changelist[]
This plugin assumes you use the methodology where you have an explicit changelist created for every edit. If you want to use a default changelist, then you need to remove the "-c" options given to a couple commands:
Line 335-ish
" let listnum = "" " let listnum = s:P4GetChangelist( "Current changelists:\n" . s:P4GetChangelists(0) . "\nEnter changelist number: ", " if listnum == "" " echomsg "No changelist specified. Edit cancelled." " return " endif " call s:P4ShellCommandCurrentBuffer( action . " -c " . listnum ) call s:P4ShellCommandCurrentBuffer( action )
Line 366-ish
" let listnum = "" " let listnum = s:P4GetChangelist( "Current changelists:\n" . s:P4GetChangelists(0) . "\nEnter changelist number " if listnum == "" " echomsg "No changelist specified. Delete cancelled." " return " endif " call s:P4ShellCommandCurrentBuffer( "delete -c " . listnum ) call s:P4ShellCommandCurrentBuffer( "delete" )