Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Unified Diff: git_cl.py

Issue 14854003: Make git-cl more accurately imitate git's editor selection process, and respect $VISUAL. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Make tests use $GIT_EDITOR instead of $EDITOR (previously they failed for me, as $EDITOR was overriā€¦ Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gclient_utils.py ('k') | tests/abandon.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cl.py
diff --git a/git_cl.py b/git_cl.py
index 4e89e065e73a1d8a2b292a8b3361f0d50a6006ba..9f691763ba21ee060e86eb0044319830fb18cdd5 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -245,6 +245,7 @@ class Settings(object):
self.viewvc_url = None
self.updated = False
self.is_gerrit = None
+ self.git_editor = None
def LazyUpdateIfNeeded(self):
"""Updates the settings from a codereview.settings file, if available."""
@@ -369,6 +370,12 @@ class Settings(object):
self.is_gerrit = self._GetConfig('gerrit.host', error_ok=True)
return self.is_gerrit
+ def GetGitEditor(self):
+ """Return the editor specified in the git config, or None if none is."""
+ if self.git_editor is None:
+ self.git_editor = self._GetConfig('core.editor', error_ok=True)
+ return self.git_editor or None
+
def _GetConfig(self, param, **kwargs):
self.LazyUpdateIfNeeded()
return RunGit(['config', param], **kwargs).strip()
@@ -853,7 +860,8 @@ class ChangeDescription(object):
if '\nBUG=' not in self._description:
self.append_footer('BUG=')
- content = gclient_utils.RunEditor(self._description, True)
+ content = gclient_utils.RunEditor(self._description, True,
+ git_editor=settings.GetGitEditor())
if not content:
DieWithError('Running editor failed')
« no previous file with comments | « gclient_utils.py ('k') | tests/abandon.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698