Patchwork D8321: darwin: use vim, not vi, to avoid data-loss inducing posix behavior

login
register
mail settings
Submitter phabricator
Date March 25, 2020, 4:53 p.m.
Message ID <61b179eff8feb2e1eff6038a5ca1b4ba@localhost.localdomain>
Download mbox | patch
Permalink /patch/45885/
State Not Applicable
Headers show

Comments

phabricator - March 25, 2020, 4:53 p.m.
Closed by commit rHGc23877cb25a5: darwin: use vim, not vi, to avoid data-loss inducing posix behavior (authored by spectral).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8321?vs=20864&id=20877

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8321/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8321

AFFECTED FILES
  mercurial/ui.py

CHANGE DETAILS




To: spectral, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1914,6 +1914,12 @@ 
             # instead default to E to plumb commit messages to
             # avoid confusion.
             editor = b'E'
+        elif pycompat.isdarwin:
+            # vi on darwin is POSIX compatible to a fault, and that includes
+            # exiting non-zero if you make any mistake when running an ex
+            # command. Proof: `vi -c ':unknown' -c ':qa'; echo $?` produces 1,
+            # while s/vi/vim/ doesn't.
+            editor = b'vim'
         else:
             editor = b'vi'
         return encoding.environ.get(b"HGEDITOR") or self.config(