tests/test-editor-filename.t
author Matt Harbison <matt_harbison@yahoo.com>
Mon, 05 Dec 2022 16:05:04 -0500
branchstable
changeset 49602 f4a363b25859
parent 49585 55c6ebd11cb9
permissions -rw-r--r--
extensions: load help from hgext.__index__ as a fallback this time Prior to 843418dc0b1b, `hgext.__index__` was consulted first if present, which caused the longer help from the extension modules to be ignored, even when available. But that change causes a bunch of test failures when the pyoxidized binary bundles *.pyc in the binary, saying the there's no help topic for `hg help $disabled_extension` and suggesting the use of `--keyword`, rather than showing a summary and indicating that it is disabled. Current failures were in test-check-help.t, test-extension.t, test-help.t, and test-qrecord.t. Ideally, we would read the various *.pyc files from memory and slurp in the docstring, but I know that they used to not be readable as resources, and I can't figure out how to make it work now. So maybe 3.9 and/or the current PyOxidizer doesn't support it yet. I got closer in py2exe with `importlib.resources.open_binary("hgext", "rebase.pyc")`, but `open_binary()` on *.pyc fails in pyoxidizer.[1] Either way, the *.pyc can't be passed to `ast.parse()` as `extensions._disabledcmdtable()` is doing, so I'm setting that aside for now. [1] https://github.com/indygreg/PyOxidizer/issues/649
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34046
6e6452bc441d editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff changeset
     1
Test temp file used with an editor has the expected suffix.
6e6452bc441d editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff changeset
     2
49585
55c6ebd11cb9 tests: run many tests in $TESTTMP/repo instead of $TESTTMP
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 45892
diff changeset
     3
  $ hg init repo
55c6ebd11cb9 tests: run many tests in $TESTTMP/repo instead of $TESTTMP
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 45892
diff changeset
     4
  $ cd repo
34046
6e6452bc441d editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff changeset
     5
6e6452bc441d editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff changeset
     6
Create an editor that writes its arguments to stdout and set it to $HGEDITOR.
6e6452bc441d editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff changeset
     7
6e6452bc441d editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff changeset
     8
  $ cat > editor.sh << EOF
6e6452bc441d editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff changeset
     9
  > echo "\$@"
6e6452bc441d editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff changeset
    10
  > exit 1
6e6452bc441d editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff changeset
    11
  > EOF
6e6452bc441d editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff changeset
    12
  $ hg add editor.sh
49585
55c6ebd11cb9 tests: run many tests in $TESTTMP/repo instead of $TESTTMP
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 45892
diff changeset
    13
  $ HGEDITOR="sh $TESTTMP/repo/editor.sh"
34046
6e6452bc441d editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff changeset
    14
  $ export HGEDITOR
6e6452bc441d editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff changeset
    15
6e6452bc441d editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff changeset
    16
Verify that the path for a commit editor has the expected suffix.
6e6452bc441d editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff changeset
    17
6e6452bc441d editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff changeset
    18
  $ hg commit
6e6452bc441d editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff changeset
    19
  *.commit.hg.txt (glob)
34075
4bf1889456f3 test-editor-filename: fix portability of fake editor command
Yuya Nishihara <yuya@tcha.org>
parents: 34071
diff changeset
    20
  abort: edit failed: sh exited with status 1
45892
ac362d5a7893 errors: introduce CanceledError and use it in a few places
Martin von Zweigbergk <martinvonz@google.com>
parents: 42566
diff changeset
    21
  [250]
34046
6e6452bc441d editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff changeset
    22
6e6452bc441d editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff changeset
    23
Verify that the path for a histedit editor has the expected suffix.
6e6452bc441d editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff changeset
    24
6e6452bc441d editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff changeset
    25
  $ cat >> $HGRCPATH <<EOF
6e6452bc441d editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff changeset
    26
  > [extensions]
6e6452bc441d editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff changeset
    27
  > rebase=
6e6452bc441d editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff changeset
    28
  > histedit=
6e6452bc441d editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff changeset
    29
  > EOF
6e6452bc441d editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff changeset
    30
  $ hg commit --message 'At least one commit for histedit.'
6e6452bc441d editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff changeset
    31
  $ hg histedit
6e6452bc441d editor: use an unambiguous path suffix for editor files
Michael Bolin <mbolin@fb.com>
parents:
diff changeset
    32
  *.histedit.hg.txt (glob)
34075
4bf1889456f3 test-editor-filename: fix portability of fake editor command
Yuya Nishihara <yuya@tcha.org>
parents: 34071
diff changeset
    33
  abort: edit failed: sh exited with status 1
45892
ac362d5a7893 errors: introduce CanceledError and use it in a few places
Martin von Zweigbergk <martinvonz@google.com>
parents: 42566
diff changeset
    34
  [250]
34071
3c82b14d2838 editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents: 34046
diff changeset
    35
3c82b14d2838 editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents: 34046
diff changeset
    36
Verify that when performing an action that has the side-effect of creating an
3c82b14d2838 editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents: 34046
diff changeset
    37
editor for a diff, the file ends in .diff.
3c82b14d2838 editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents: 34046
diff changeset
    38
3c82b14d2838 editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents: 34046
diff changeset
    39
  $ echo 1 > one
3c82b14d2838 editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents: 34046
diff changeset
    40
  $ echo 2 > two
3c82b14d2838 editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents: 34046
diff changeset
    41
  $ hg add
3c82b14d2838 editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents: 34046
diff changeset
    42
  adding one
3c82b14d2838 editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents: 34046
diff changeset
    43
  adding two
3c82b14d2838 editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents: 34046
diff changeset
    44
  $ hg commit --interactive --config ui.interactive=true --config ui.interface=text << EOF
3c82b14d2838 editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents: 34046
diff changeset
    45
  > y
3c82b14d2838 editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents: 34046
diff changeset
    46
  > e
3c82b14d2838 editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents: 34046
diff changeset
    47
  > q
3c82b14d2838 editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents: 34046
diff changeset
    48
  > EOF
3c82b14d2838 editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents: 34046
diff changeset
    49
  diff --git a/one b/one
3c82b14d2838 editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents: 34046
diff changeset
    50
  new file mode 100644
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 34075
diff changeset
    51
  examine changes to 'one'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 34075
diff changeset
    52
  (enter ? for help) [Ynesfdaq?] y
34071
3c82b14d2838 editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents: 34046
diff changeset
    53
  
3c82b14d2838 editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents: 34046
diff changeset
    54
  @@ -0,0 +1,1 @@
3c82b14d2838 editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents: 34046
diff changeset
    55
  +1
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 34075
diff changeset
    56
  record change 1/2 to 'one'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 34075
diff changeset
    57
  (enter ? for help) [Ynesfdaq?] e
34071
3c82b14d2838 editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents: 34046
diff changeset
    58
  
3c82b14d2838 editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents: 34046
diff changeset
    59
  *.diff (glob)
3c82b14d2838 editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents: 34046
diff changeset
    60
  editor exited with exit code 1
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 34075
diff changeset
    61
  record change 1/2 to 'one'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 34075
diff changeset
    62
  (enter ? for help) [Ynesfdaq?] q
34071
3c82b14d2838 editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents: 34046
diff changeset
    63
  
3c82b14d2838 editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com>
parents: 34046
diff changeset
    64
  abort: user quit
45892
ac362d5a7893 errors: introduce CanceledError and use it in a few places
Martin von Zweigbergk <martinvonz@google.com>
parents: 42566
diff changeset
    65
  [250]