git-p4: Use P4EDITOR environment variable when set
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>
Shawn Bohrer committed
Mar 12, 2008 at 19:03 UTC
82cea9ffb1c4677155e3e2996d76542502611370
1 file changed
+4
-1
contrib/fast-import/git-p4
+4
-1
@@ -652,7 +652,10 @@ class P4Submit(Command):
652
defaultEditor = "vi"
653
if platform.system() == "Windows":
654
defaultEditor = "notepad"
655
- editor = os.environ.get("EDITOR", defaultEditor);
655
+ if os.environ.has_key("P4EDITOR"):
656
+ editor = os.environ.get("P4EDITOR")
657
+ else:
658
+ editor = os.environ.get("EDITOR", defaultEditor);
659
system(editor + " " + fileName)
660
tmpFile = open(fileName, "rb")
661
message = tmpFile.read()