Patchwork D607: editor: file created for diff action should have .diff suffix

login
register
mail settings
Submitter phabricator
Date Sept. 1, 2017, 8:29 p.m.
Message ID <c19e4fbb927a98f74e821bcaa1c2fb03@localhost.localdomain>
Download mbox | patch
Permalink /patch/23604/
State Not Applicable
Headers show

Comments

phabricator - Sept. 1, 2017, 8:29 p.m.
mbolin updated this revision to Diff 1556.
mbolin added a comment.


  Remove bin/bash shebang as @quark says this should fix the FreeBSD issue and should generally be banned from integration tests.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D607?vs=1551&id=1556

BRANCH
  default

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

AFFECTED FILES
  mercurial/ui.py
  tests/test-editor-filename.t

CHANGE DETAILS




To: mbolin, durin42, ryanmce, quark, #hg-reviewers, yuja
Cc: mercurial-devel

Patch

diff --git a/tests/test-editor-filename.t b/tests/test-editor-filename.t
--- a/tests/test-editor-filename.t
+++ b/tests/test-editor-filename.t
@@ -4,8 +4,7 @@ 
 
 Create an editor that writes its arguments to stdout and set it to $HGEDITOR.
 
-  $ cat > editor.sh << EOF
-  > #!/bin/bash
+  $ cat > $TESTTMP/editor.sh << EOF
   > echo "\$@"
   > exit 1
   > EOF
@@ -33,3 +32,31 @@ 
   *.histedit.hg.txt (glob)
   abort: edit failed: editor.sh exited with status 1
   [255]
+
+Verify that when performing an action that has the side-effect of creating an
+editor for a diff, the file ends in .diff.
+
+  $ echo 1 > one
+  $ echo 2 > two
+  $ hg add
+  adding one
+  adding two
+  $ hg commit --interactive --config ui.interactive=true --config ui.interface=text << EOF
+  > y
+  > e
+  > q
+  > EOF
+  diff --git a/one b/one
+  new file mode 100644
+  examine changes to 'one'? [Ynesfdaq?] y
+  
+  @@ -0,0 +1,1 @@
+  +1
+  record change 1/2 to 'one'? [Ynesfdaq?] e
+  
+  *.diff (glob)
+  editor exited with exit code 1
+  record change 1/2 to 'one'? [Ynesfdaq?] q
+  
+  abort: user quit
+  [255]
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1361,7 +1361,9 @@ 
             extra_defaults.update(extra)
         extra = extra_defaults
 
-        if action:
+        if action == 'diff':
+            suffix = '.diff'
+        elif action:
             suffix = '.%s.hg.txt' % action
         else:
             suffix = extra['suffix']