working with Perforce

382 views
Skip to first unread message

Chuck Soper

unread,
May 8, 2009, 10:59:20 PM5/8/09
to bbe...@googlegroups.com
Hello,

I mainly use Perforce from terminal; I don't use BBEdit. For years whenever
I execute 'p4 submit' from the terminal, TextEdit would launch. I would
modify the change description then quit TextEdit to submit the change my
Perforce repository.

Now when I execute 'p4 submit' BBEdit is launched and in the terminal
Perforce returns the error, "Change description missing. You must enter
one." Does anyone know why? I finally added the change description from the
command line and unfortunately submitted more files than I intended! Very
discouraging.

This may be more of a Finder question. I'm not sure. I've also noticed that
whenever I download .txt files from Safari that BBEdit launches instead of
TextEdit. Does anyone know the answer?

Thanks,
Chuck


Jim Correia

unread,
May 9, 2009, 8:48:58 AM5/9/09
to bbe...@googlegroups.com
On May 8, 2009, at 10:59 PM, Chuck Soper wrote:

> I mainly use Perforce from terminal; I don't use BBEdit. For years
> whenever
> I execute 'p4 submit' from the terminal, TextEdit would launch. I
> would
> modify the change description then quit TextEdit to submit the
> change my
> Perforce repository.
>
> Now when I execute 'p4 submit' BBEdit is launched and in the terminal
> Perforce returns the error, "Change description missing. You must
> enter
> one." Does anyone know why? I finally added the change description
> from the
> command line and unfortunately submitted more files than I intended!
> Very
> discouraging.

I'm not sure what could have changed on your machine to cause this
behavior.

I intentionally use BBEdit as my command line editor.

EDITOR=bbedit --wait --resume

This works great with p4.

Jim

Daryl Spitzer

unread,
May 9, 2009, 10:33:30 AM5/9/09
to bbe...@googlegroups.com
Chuck,

You may have to set P4EDITOR. The documentation at
http://www.perforce.com/perforce/doc.082/manuals/cmdref/env.P4EDITOR.html#1044292
makes it sound like Perforce ignores the value of EDITOR (though that
may be incorrect).

Either way, the --wait command-line option to bbedit (as Jim suggests)
is important. (And --resume is convenient.) See `man bbedit`.

--
Daryl

Patrick Woolsey

unread,
May 9, 2009, 10:36:25 AM5/9/09
to bbe...@googlegroups.com
Chuck Soper <chu...@veladg.com> sez>:

[...]


>This may be more of a Finder question. I'm not sure. I've also noticed that
>whenever I download .txt files from Safari that BBEdit launches instead of
>TextEdit. Does anyone know the answer?
>

This means Launch Services has decided to use BBEdit rather than TextEdit
to handle such files. :-)

You can change this mapping either:

a) by getting info on a ".txt" file in the Finder and applying "Open With"
/ "Change All", or

b) by using a utility like RCDfaultApp to directly set the helper app for
files with that suffix.

Regards,

Patrick Woolsey
==
Bare Bones Software, Inc. <http://www.barebones.com>
P.O. Box 1048, Bedford, MA 01730-1048

Jim Correia

unread,
May 9, 2009, 10:39:49 AM5/9/09
to bbe...@googlegroups.com
On May 9, 2009, at 10:33 AM, Daryl Spitzer wrote:

> You may have to set P4EDITOR. The documentation at
> http://www.perforce.com/perforce/doc.082/manuals/cmdref/env.P4EDITOR.html#1044292
> makes it sound like Perforce ignores the value of EDITOR (though that
> may be incorrect).

You can set P4EDITOR if you want to set the value just for p4.

Otherwise, per the documentation you point to, p4 will fallback to
EDITOR then `vi` if P4EDITOR is not set.

(I use p4 daily, committing through `bbedit` without having P4EDITOR
set. The advice I gave was not practical, not theoretical :-)).

Jim

Charles Albrecht

unread,
May 9, 2009, 11:05:59 AM5/9/09
to bbe...@googlegroups.com
On May 9, 2009, at 7:33 AM, Daryl Spitzer wrote:
>
> Chuck,
>
> You may have to set P4EDITOR. The documentation at
> http://www.perforce.com/perforce/doc.082/manuals/cmdref/env.P4EDITOR.html#1044292
> makes it sound like Perforce ignores the value of EDITOR (though that
> may be incorrect).
>
> Either way, the --wait command-line option to bbedit (as Jim suggests)
> is important. (And --resume is convenient.) See `man bbedit`.

Perforce will prefer P4EDITOR, but if EDITOR is set, it will use that.
I set them to:

P4EDITOR="/usr/bin/bbedit --wait --resume --"

And similarly with

P4DIFF="/usr/bin/bbdiff --"
P4MERGE="/Applications/p4merge.app/Contents/MacOS/p4merge"

-Charles
char...@pobox.com

Chuck Soper

unread,
May 12, 2009, 1:48:10 PM5/12/09
to bbe...@googlegroups.com

Thanks for everyone's fast responses to my questions about using Perforce.
After a few days, I'm finally trying to fix this.

I discovered that my P4 variables are in ~/.bash_profile. I plan to add the
following line to that file:


P4EDITOR="/usr/bin/bbedit --wait --resume --"

After I've done that, is there a way I can force my user account accept
changes made to .bash_profile without logging out and back in? I think this
is a basic Unix question.

I noticed that P4V Preferences has a tab for setting the editor as well.
Perhaps, this is an alternate way to set the P4EDITOR. Also, the following
link mentions EDITOR_SIGNATURE, the four-character creator for Mac.
<http://www.perforce.com/perforce/doc.082/manuals/cmdref/env.P4EDITOR.html#1
044292>

I plan to start using BBEdit as my P4 command line editor. When I used
TextEdit as my P4 command line editor (such as modifying change description
during a submit), I had quit TextEdit for the command to be accepted. Is
there a way to have BBEdit (or TextEdit) accept the command without quitting
the app?

Thanks very much,
Chuck


Steve Saeedi

unread,
May 12, 2009, 2:12:49 PM5/12/09
to bbe...@googlegroups.com
You can also create a environment.plist file in your local .MacOSX
folder in your home dir. For more info, read:

http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/EnvironmentVars.html

or

http://bit.ly/lfBhf

These variables will then be available to all programs.

- Steve

Steve Kalkwarf

unread,
May 12, 2009, 2:18:19 PM5/12/09
to bbe...@googlegroups.com
> I discovered that my P4 variables are in ~/.bash_profile. I plan to
> add the
> following line to that file:
> P4EDITOR="/usr/bin/bbedit --wait --resume --"
>
> After I've done that, is there a way I can force my user account
> accept
> changes made to .bash_profile without logging out and back in? I
> think this
> is a basic Unix question.

I believe you want to add that line to your ~/.bashrc file, as that's
used for interactive shells. I could have my details wrong on that,
though.

When you open a new terminal window, it will get the new environment
variable. To update existing windows, do:

source ~/.bash_rc

I don't specify P4EDITOR; just EDITOR. That way you get BBEdit for
anything that wants to open an editor, like Perforce, Subversion,
mutt, etc.

> I noticed that P4V Preferences has a tab for setting the editor as
> well.
> Perhaps, this is an alternate way to set the P4EDITOR. Also, the
> following
> link mentions EDITOR_SIGNATURE, the four-character creator for Mac.
> <http://www.perforce.com/perforce/doc.082/manuals/cmdref/env.P4EDITOR.html#1
> 044292>

To the best of my knowledge, settings made in P4V only affect P4V.

Don't use EDITOR_SIGNATURE. You want to use the bbedit command line
tool as the interface to have the best experience.

> I plan to start using BBEdit as my P4 command line editor. When I used
> TextEdit as my P4 command line editor (such as modifying change
> description
> during a submit), I had quit TextEdit for the command to be
> accepted. Is
> there a way to have BBEdit (or TextEdit) accept the command without
> quitting
> the app?

With the --wait --resume set, saving then closing the commit window
will allow Perforce to proceed.

Steve

Chuck Soper

unread,
May 12, 2009, 9:38:52 PM5/12/09
to Steve Kalkwarf, bbe...@googlegroups.com
On 5/12/09 11:18 AM, "Steve Kalkwarf" <kalk...@barebones.com> wrote:
>
>> I discovered that my P4 variables are in ~/.bash_profile. I plan to
>> add the
>> following line to that file:
>> P4EDITOR="/usr/bin/bbedit --wait --resume --"
>>
>> After I've done that, is there a way I can force my user account
>> accept
>> changes made to .bash_profile without logging out and back in? I
>> think this
>> is a basic Unix question.
>
> I believe you want to add that line to your ~/.bashrc file, as that's
> used for interactive shells. I could have my details wrong on that,
> though.
>
> When you open a new terminal window, it will get the new environment
> variable. To update existing windows, do:
>
> source ~/.bash_rc
>
I don't have a .bash_rc file in my home directory.

I finally figured out that I needed to add "export P4EDITOR" to my
.bash_login file. After I did 'source ~/.bash_login' it was working
properly. Okay, I'm making progress.

I'll consider changing P4EDITOR to EDITOR later.

> I don't specify P4EDITOR; just EDITOR. That way you get BBEdit for
> anything that wants to open an editor, like Perforce, Subversion,
> mutt, etc.
>
>> I noticed that P4V Preferences has a tab for setting the editor as
>> well.
>> Perhaps, this is an alternate way to set the P4EDITOR. Also, the
>> following
>> link mentions EDITOR_SIGNATURE, the four-character creator for Mac.
>> <http://www.perforce.com/perforce/doc.082/manuals/cmdref/env.P4EDITOR.html#1
>> 044292>
>
> To the best of my knowledge, settings made in P4V only affect P4V.
>
> Don't use EDITOR_SIGNATURE. You want to use the bbedit command line
> tool as the interface to have the best experience.
>

Okay, thanks. I tend to prefer the command line interface, but I
occasionally use P4V.

>> I plan to start using BBEdit as my P4 command line editor. When I used
>> TextEdit as my P4 command line editor (such as modifying change
>> description
>> during a submit), I had quit TextEdit for the command to be
>> accepted. Is
>> there a way to have BBEdit (or TextEdit) accept the command without
>> quitting
>> the app?
>
> With the --wait --resume set, saving then closing the commit window
> will allow Perforce to proceed.
>
> Steve

This works, but I don't know how to cancel or terminate a command. From the
terminal, I'm unable to use control-C. In BBEdit, once I save the temp file,
I don't see how to cancel the command. Any suggestions on how to cancel a
command after the temp file is open? Sometimes I start editing and save a
Perforce spec (temp file) then realize that I don't want the command
executed.

Thanks,
Chuck


Steve Kalkwarf

unread,
May 13, 2009, 8:35:56 AM5/13/09
to bbe...@googlegroups.com
>>
>> With the --wait --resume set, saving then closing the commit window
>> will allow Perforce to proceed.
>>
>> Steve
>
> This works, but I don't know how to cancel or terminate a command.
> From the
> terminal, I'm unable to use control-C. In BBEdit, once I save the
> temp file,
> I don't see how to cancel the command. Any suggestions on how to
> cancel a
> command after the temp file is open? Sometimes I start editing and
> save a
> Perforce spec (temp file) then realize that I don't want the command
> executed.

As long as you don't save the window first, you can close it, and then
Control-C the bbedit tool running in the terminal.

Steve

Lewis@Gmail

unread,
May 13, 2009, 3:37:29 PM5/13/09
to bbe...@googlegroups.com

On 13-May-2009, at 06:35, Steve Kalkwarf wrote:

>
>>>
>>> With the --wait --resume set, saving then closing the commit window
>>> will allow Perforce to proceed.
>>>
>>> Steve
>>
>> This works, but I don't know how to cancel or terminate a command.
>> From the
>> terminal, I'm unable to use control-C. In BBEdit, once I save the
>> temp file,
>> I don't see how to cancel the command. Any suggestions on how to
>> cancel a
>> command after the temp file is open?

The --wait tells the terminal to wait until the command is completed.
It is completed when you close the window you opened.

> As long as you don't save the window first, you can close it, and then
> Control-C the bbedit tool running in the terminal.

I use BBEdit as my 'vi' and I've never had to ^C it after closing the
window.

--
<http://en.wikipedia.org/wiki/TOFU>

Reply all
Reply to author
Forward
0 new messages