Set stg's text editor in .stgitrc
authorChuck Lever <cel@netapp.com>
Tue, 6 Sep 2005 16:12:27 +0000 (12:12 -0400)
committerCatalin Marinas <catalin.marinas@gmail.com>
Wed, 7 Sep 2005 09:39:31 +0000 (10:39 +0100)
Allow specifying stg's text editor in .stgitrc.  Some legacy tools need
an old version of "vi" in EDITOR, but we can be flexible.

Signed-off-by: Chuck Lever <cel@netapp.com>
examples/stgitrc
stgit/stack.py

index a225090..f4facef 100644 (file)
@@ -17,6 +17,10 @@ smtpserver: localhost:25
 #smtpuser: username
 #smtppassword: password
 
+# stg will look for this first, then look for the EDITOR environmental
+# variable, then default to using 'vi'
+#editor: /usr/bin/vi
+
 
 [gitmergeonefile]
 # Different three-way merge tools below. Uncomment the preferred one.
index cfac219..7a91b0c 100644 (file)
@@ -92,7 +92,9 @@ def edit_file(series, string, comment, show_patch = True):
     f.close()
 
     # the editor
-    if 'EDITOR' in os.environ:
+    if config.has_option('stgit', 'editor'):
+        editor = config.get('stgit', 'editor')
+    elif 'EDITOR' in os.environ:
         editor = os.environ['EDITOR']
     else:
         editor = 'vi'