Skip to content

Commit

Permalink
git-p4: Use P4EDITOR environment variable when set
Browse files Browse the repository at this point in the history
Perforce allows you to set the P4EDITOR environment variable to your
preferred editor for use in perforce.  Since we are displaying a
perforce changelog to the user we should use it when it is defined.

Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com>
Signed-off-by: Simon Hausmann <simon@lst.de>
  • Loading branch information
Shawn Bohrer authored and Simon Hausmann committed Mar 13, 2008
1 parent 67abd41 commit 82cea9f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion contrib/fast-import/git-p4
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,10 @@ class P4Submit(Command):
defaultEditor = "vi"
if platform.system() == "Windows":
defaultEditor = "notepad"
editor = os.environ.get("EDITOR", defaultEditor);
if os.environ.has_key("P4EDITOR"):
editor = os.environ.get("P4EDITOR")
else:
editor = os.environ.get("EDITOR", defaultEditor);
system(editor + " " + fileName)
tmpFile = open(fileName, "rb")
message = tmpFile.read()
Expand Down

0 comments on commit 82cea9f

Please sign in to comment.