This instance will be upgraded to Heptapod 0.21.0rc2 on 2021-04-16 at 14:00 UTC+2 (a few minutes of down time)

test-editor-filename.t 1.38 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
Test temp file used with an editor has the expected suffix.

  $ hg init

Create an editor that writes its arguments to stdout and set it to $HGEDITOR.

  $ cat > editor.sh << EOF
  > echo "\$@"
  > exit 1
  > EOF
  $ hg add editor.sh
12
  $ HGEDITOR="sh $TESTTMP/editor.sh"
13 14 15 16 17 18
  $ export HGEDITOR

Verify that the path for a commit editor has the expected suffix.

  $ hg commit
  *.commit.hg.txt (glob)
19
  abort: edit failed: sh exited with status 1
20
  [250]
21 22 23 24 25 26 27 28 29 30 31

Verify that the path for a histedit editor has the expected suffix.

  $ cat >> $HGRCPATH <<EOF
  > [extensions]
  > rebase=
  > histedit=
  > EOF
  $ hg commit --message 'At least one commit for histedit.'
  $ hg histedit
  *.histedit.hg.txt (glob)
32
  abort: edit failed: sh exited with status 1
33
  [250]
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

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
50 51
  examine changes to 'one'?
  (enter ? for help) [Ynesfdaq?] y
52 53 54
  
  @@ -0,0 +1,1 @@
  +1
55 56
  record change 1/2 to 'one'?
  (enter ? for help) [Ynesfdaq?] e
57 58 59
  
  *.diff (glob)
  editor exited with exit code 1
60 61
  record change 1/2 to 'one'?
  (enter ? for help) [Ynesfdaq?] q
62 63
  
  abort: user quit
64
  [250]