git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git-p4: Use P4EDITOR environment variable when set

From
Shawn Bohrer <shawn.bohrer@gmail.com>
Date
Mar 13, 2008, 00:03 UTC
Message-ID
<1205366604-12970-2-git-send-email-shawn.bohrer@gmail.com>
In-Reply-To
<1205366604-12970-1-git-send-email-shawn.bohrer@gmail.com>

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>
---
 contrib/fast-import/git-p4 |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index 0b46084..55e38ff 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -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()
-- 
1.5.4.3
Previous: Shawn Bohrer
Message 2 of 2 in “git-p4: Unset P4DIFF environment variable when using 'p4 -du diff'”
  1. git-p4: Unset P4DIFF environment variable when using 'p4 -du diff'Shawn Bohrer, Mar 13, 2008
  2. git-p4: Use P4EDITOR environment variable when setShawn Bohrer, Mar 13, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.