tests/test-extdiff.t
author Mads Kiilerich <madski@unity3d.com>
Wed, 28 Jan 2015 02:28:39 +0100
branchstable
changeset 23969 01e5b7323a48
parent 23683 5edb387158a1
child 23974 e484546a7c18
permissions -rw-r--r--
extdiff: reintroduce backward compatibility with manual quoting of parameters 72a89cf86fcd broke things ... and the following cleanups didn't fix all issues. It didn't work with the diffargs shipped in mergetools.rc with explicit quoting. Parameters would end up with being quoted twice - especially if they really needed quoting. To work around that, look for explicit quotes around the variables that will be substituted with proper quoting. Also accept an additional prefix so we can handle both --foo='$parent' and '--foo=$parent' It will however still fail if the user intentionally place the variable inside a quoted string, as in 'parent $parent is on the left' There is currently no good way to handle that, short of knowing exactly which quoting mechanism will be used.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12304
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
     1
  $ echo "[extensions]" >> $HGRCPATH
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
     2
  $ echo "extdiff=" >> $HGRCPATH
2906
453097750fbf extdiff: fix bugs. add test.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     3
12304
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
     4
  $ hg init a
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
     5
  $ cd a
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
     6
  $ echo a > a
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
     7
  $ echo b > b
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
     8
  $ hg add
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
     9
  adding a
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    10
  adding b
2906
453097750fbf extdiff: fix bugs. add test.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    11
12304
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    12
Should diff cloned directories:
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    13
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    14
  $ hg extdiff -o -r $opt
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    15
  Only in a: a
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    16
  Only in a: b
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12304
diff changeset
    17
  [1]
12304
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    18
23172
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 23152
diff changeset
    19
  $ cat <<EOF >> $HGRCPATH
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 23152
diff changeset
    20
  > [extdiff]
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 23152
diff changeset
    21
  > cmd.falabala = echo
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 23152
diff changeset
    22
  > opts.falabala = diffing
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 23152
diff changeset
    23
  > cmd.edspace = echo
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 23152
diff changeset
    24
  > opts.edspace = "name  <user@example.com>"
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 23152
diff changeset
    25
  > EOF
12304
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    26
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    27
  $ hg falabala
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    28
  diffing a.000000000000 a
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12304
diff changeset
    29
  [1]
2906
453097750fbf extdiff: fix bugs. add test.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    30
12304
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    31
  $ hg help falabala
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    32
  hg falabala [OPTION]... [FILE]...
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    33
  
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    34
  use 'echo' to diff repository (or selected files)
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    35
  
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    36
      Show differences between revisions for the specified files, using the
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    37
      'echo' program.
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    38
  
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    39
      When two revision arguments are given, then changes are shown between
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    40
      those revisions. If only one revision is specified then that revision is
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    41
      compared to the working directory, and, when no revisions are specified,
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    42
      the working directory files are compared to its parent.
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    43
  
22117
c1d93edcf004 help: fold repeatable option message into option table header
Matt Mackall <mpm@selenic.com>
parents: 22110
diff changeset
    44
  options ([+] can be repeated):
12304
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    45
  
15145
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14024
diff changeset
    46
   -o --option OPT [+]      pass option to comparison program
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14024
diff changeset
    47
   -r --rev REV [+]         revision
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14024
diff changeset
    48
   -c --change REV          change made by revision
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14024
diff changeset
    49
   -I --include PATTERN [+] include names matching the given patterns
ff26712a0c50 help: use RST to format option lists
Matt Mackall <mpm@selenic.com>
parents: 14024
diff changeset
    50
   -X --exclude PATTERN [+] exclude names matching the given patterns
12304
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    51
  
22110
26f7c8033bed help: tweak --verbose command help hint
Matt Mackall <mpm@selenic.com>
parents: 17837
diff changeset
    52
  (some details hidden, use --verbose to show complete help)
2906
453097750fbf extdiff: fix bugs. add test.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    53
12304
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    54
  $ hg ci -d '0 0' -mtest1
2906
453097750fbf extdiff: fix bugs. add test.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    55
12304
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    56
  $ echo b >> a
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    57
  $ hg ci -d '1 0' -mtest2
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    58
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    59
Should diff cloned files directly:
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    60
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    61
  $ hg falabala -r 0:1
13762
3740792dbe51 test-extdiff: fix 5c0e1222e7c0 temporary dir output
Patrick Mezard <pmezard@gmail.com>
parents: 13660
diff changeset
    62
  diffing */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12304
diff changeset
    63
  [1]
12304
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    64
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    65
Test diff during merge:
2906
453097750fbf extdiff: fix bugs. add test.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    66
12304
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    67
  $ hg update -C 0
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    68
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    69
  $ echo c >> c
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    70
  $ hg add c
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    71
  $ hg ci -m "new branch" -d '1 0'
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    72
  created new head
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    73
  $ hg merge 1
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    74
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    75
  (branch merge, don't forget to commit)
2906
453097750fbf extdiff: fix bugs. add test.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    76
12304
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    77
Should diff cloned file against wc file:
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    78
12587
e3247ceaca5e tests: removed test names in tests
Erik Zielke <ez@aragost.com>
parents: 12346
diff changeset
    79
  $ hg falabala
13762
3740792dbe51 test-extdiff: fix 5c0e1222e7c0 temporary dir output
Patrick Mezard <pmezard@gmail.com>
parents: 13660
diff changeset
    80
  diffing */extdiff.*/a.2a13a4d2da36/a */a/a (glob)
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12304
diff changeset
    81
  [1]
12304
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    82
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    83
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    84
Test --change option:
3330
49966b5ab16f fix traceback of extdiff after a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2990
diff changeset
    85
12304
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    86
  $ hg ci -d '2 0' -mtest3
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    87
  $ hg falabala -c 1
13762
3740792dbe51 test-extdiff: fix 5c0e1222e7c0 temporary dir output
Patrick Mezard <pmezard@gmail.com>
parents: 13660
diff changeset
    88
  diffing */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12304
diff changeset
    89
  [1]
12304
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    90
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    91
Check diff are made from the first parent:
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    92
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    93
  $ hg falabala -c 3 || echo "diff-like tools yield a non-zero exit code"
13762
3740792dbe51 test-extdiff: fix 5c0e1222e7c0 temporary dir output
Patrick Mezard <pmezard@gmail.com>
parents: 13660
diff changeset
    94
  diffing */extdiff.*/a.2a13a4d2da36/a a.46c0e4daeb72/a (glob)
12304
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    95
  diff-like tools yield a non-zero exit code
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
    96
23680
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
    97
issue4463: usage of command line configuration without additional quoting
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
    98
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
    99
  $ cat <<EOF >> $HGRCPATH
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   100
  > [extdiff]
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   101
  > cmd.4463a = echo
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   102
  > opts.4463a = a-naked 'single quoted' "double quoted"
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   103
  > 4463b = echo b-naked 'single quoted' "double quoted"
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   104
  > echo =
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   105
  > EOF
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   106
  $ hg update -q -C 0
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   107
  $ echo a >> a
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   108
#if windows
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   109
  $ hg --debug 4463a | grep '^running'
23682
1642eb429536 windows: quote the specified string only when it has to be quoted
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23680
diff changeset
   110
  running 'echo a-naked \'single quoted\' "double quoted" *\\a *\\a' in */extdiff.* (glob)
23680
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   111
  $ hg --debug 4463b | grep '^running'
23682
1642eb429536 windows: quote the specified string only when it has to be quoted
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23680
diff changeset
   112
  running 'echo b-naked \'single quoted\' "double quoted" *\\a *\\a' in */extdiff.* (glob)
23680
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   113
  $ hg --debug echo | grep '^running'
23682
1642eb429536 windows: quote the specified string only when it has to be quoted
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23680
diff changeset
   114
  running '*echo* *\\a *\\a' in */extdiff.* (glob)
23680
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   115
#else
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   116
  $ hg --debug 4463a | grep '^running'
23683
5edb387158a1 posix: quote the specified string only when it may have to be quoted
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23682
diff changeset
   117
  running 'echo a-naked \'single quoted\' "double quoted" */a $TESTTMP/a/a' in */extdiff.* (glob)
23680
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   118
  $ hg --debug 4463b | grep '^running'
23683
5edb387158a1 posix: quote the specified string only when it may have to be quoted
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23682
diff changeset
   119
  running 'echo b-naked \'single quoted\' "double quoted" */a $TESTTMP/a/a' in */extdiff.* (glob)
23680
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   120
  $ hg --debug echo | grep '^running'
23683
5edb387158a1 posix: quote the specified string only when it may have to be quoted
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23682
diff changeset
   121
  running '*echo */a $TESTTMP/a/a' in */extdiff.* (glob)
23680
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   122
#endif
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   123
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   124
(getting options from other than extdiff section)
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   125
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   126
  $ cat <<EOF >> $HGRCPATH
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   127
  > [extdiff]
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   128
  > # using diff-tools diffargs
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   129
  > 4463b2 = echo
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   130
  > # using merge-tools diffargs
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   131
  > 4463b3 = echo
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   132
  > # no diffargs
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   133
  > 4463b4 = echo
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   134
  > [diff-tools]
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   135
  > 4463b2.diffargs = b2-naked 'single quoted' "double quoted"
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   136
  > [merge-tools]
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   137
  > 4463b3.diffargs = b3-naked 'single quoted' "double quoted"
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   138
  > EOF
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   139
#if windows
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   140
  $ hg --debug 4463b2 | grep '^running'
23682
1642eb429536 windows: quote the specified string only when it has to be quoted
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23680
diff changeset
   141
  running 'echo b2-naked \'single quoted\' "double quoted" *\\a *\\a' in */extdiff.* (glob)
23680
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   142
  $ hg --debug 4463b3 | grep '^running'
23682
1642eb429536 windows: quote the specified string only when it has to be quoted
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23680
diff changeset
   143
  running 'echo b3-naked \'single quoted\' "double quoted" *\\a *\\a' in */extdiff.* (glob)
23680
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   144
  $ hg --debug 4463b4 | grep '^running'
23682
1642eb429536 windows: quote the specified string only when it has to be quoted
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23680
diff changeset
   145
  running 'echo *\\a *\\a' in */extdiff.* (glob)
1642eb429536 windows: quote the specified string only when it has to be quoted
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23680
diff changeset
   146
  $ hg --debug 4463b4 --option b4-naked --option 'being quoted' | grep '^running'
1642eb429536 windows: quote the specified string only when it has to be quoted
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23680
diff changeset
   147
  running 'echo b4-naked "being quoted" *\\a *\\a' in */extdiff.* (glob)
1642eb429536 windows: quote the specified string only when it has to be quoted
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23680
diff changeset
   148
  $ hg --debug extdiff -p echo --option echo-naked --option 'being quoted' | grep '^running'
1642eb429536 windows: quote the specified string only when it has to be quoted
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23680
diff changeset
   149
  running 'echo echo-naked "being quoted" *\\a *\\a' in */extdiff.* (glob)
23680
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   150
#else
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   151
  $ hg --debug 4463b2 | grep '^running'
23683
5edb387158a1 posix: quote the specified string only when it may have to be quoted
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23682
diff changeset
   152
  running 'echo b2-naked \'single quoted\' "double quoted" */a $TESTTMP/a/a' in */extdiff.* (glob)
23680
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   153
  $ hg --debug 4463b3 | grep '^running'
23683
5edb387158a1 posix: quote the specified string only when it may have to be quoted
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23682
diff changeset
   154
  running 'echo b3-naked \'single quoted\' "double quoted" */a $TESTTMP/a/a' in */extdiff.* (glob)
23680
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   155
  $ hg --debug 4463b4 | grep '^running'
23683
5edb387158a1 posix: quote the specified string only when it may have to be quoted
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23682
diff changeset
   156
  running 'echo */a $TESTTMP/a/a' in */extdiff.* (glob)
5edb387158a1 posix: quote the specified string only when it may have to be quoted
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23682
diff changeset
   157
  $ hg --debug 4463b4 --option b4-naked --option 'being quoted' | grep '^running'
5edb387158a1 posix: quote the specified string only when it may have to be quoted
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23682
diff changeset
   158
  running "echo b4-naked 'being quoted' */a $TESTTMP/a/a" in */extdiff.* (glob)
5edb387158a1 posix: quote the specified string only when it may have to be quoted
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23682
diff changeset
   159
  $ hg --debug extdiff -p echo --option echo-naked --option 'being quoted' | grep '^running'
5edb387158a1 posix: quote the specified string only when it may have to be quoted
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23682
diff changeset
   160
  running "echo echo-naked 'being quoted' */a $TESTTMP/a/a" in */extdiff.* (glob)
23680
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   161
#endif
4075f2f8ea53 extdiff: avoid unexpected quoting arguments for external tools (issue4463)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23172
diff changeset
   162
23969
01e5b7323a48 extdiff: reintroduce backward compatibility with manual quoting of parameters
Mads Kiilerich <madski@unity3d.com>
parents: 23683
diff changeset
   163
  $ touch 'sp ace'
01e5b7323a48 extdiff: reintroduce backward compatibility with manual quoting of parameters
Mads Kiilerich <madski@unity3d.com>
parents: 23683
diff changeset
   164
  $ hg add 'sp ace'
01e5b7323a48 extdiff: reintroduce backward compatibility with manual quoting of parameters
Mads Kiilerich <madski@unity3d.com>
parents: 23683
diff changeset
   165
  $ hg ci -m 'sp ace'
01e5b7323a48 extdiff: reintroduce backward compatibility with manual quoting of parameters
Mads Kiilerich <madski@unity3d.com>
parents: 23683
diff changeset
   166
  created new head
01e5b7323a48 extdiff: reintroduce backward compatibility with manual quoting of parameters
Mads Kiilerich <madski@unity3d.com>
parents: 23683
diff changeset
   167
  $ echo > 'sp ace'
01e5b7323a48 extdiff: reintroduce backward compatibility with manual quoting of parameters
Mads Kiilerich <madski@unity3d.com>
parents: 23683
diff changeset
   168
01e5b7323a48 extdiff: reintroduce backward compatibility with manual quoting of parameters
Mads Kiilerich <madski@unity3d.com>
parents: 23683
diff changeset
   169
Test pre-72a89cf86fcd backward compatibility with half-baked manual quoting
01e5b7323a48 extdiff: reintroduce backward compatibility with manual quoting of parameters
Mads Kiilerich <madski@unity3d.com>
parents: 23683
diff changeset
   170
01e5b7323a48 extdiff: reintroduce backward compatibility with manual quoting of parameters
Mads Kiilerich <madski@unity3d.com>
parents: 23683
diff changeset
   171
  $ cat <<EOF >> $HGRCPATH
01e5b7323a48 extdiff: reintroduce backward compatibility with manual quoting of parameters
Mads Kiilerich <madski@unity3d.com>
parents: 23683
diff changeset
   172
  > [extdiff]
01e5b7323a48 extdiff: reintroduce backward compatibility with manual quoting of parameters
Mads Kiilerich <madski@unity3d.com>
parents: 23683
diff changeset
   173
  > odd =
01e5b7323a48 extdiff: reintroduce backward compatibility with manual quoting of parameters
Mads Kiilerich <madski@unity3d.com>
parents: 23683
diff changeset
   174
  > [merge-tools]
01e5b7323a48 extdiff: reintroduce backward compatibility with manual quoting of parameters
Mads Kiilerich <madski@unity3d.com>
parents: 23683
diff changeset
   175
  > odd.diffargs = --foo='\$clabel' '\$clabel' "--bar=\$clabel" "\$clabel"
01e5b7323a48 extdiff: reintroduce backward compatibility with manual quoting of parameters
Mads Kiilerich <madski@unity3d.com>
parents: 23683
diff changeset
   176
  > odd.executable = echo
01e5b7323a48 extdiff: reintroduce backward compatibility with manual quoting of parameters
Mads Kiilerich <madski@unity3d.com>
parents: 23683
diff changeset
   177
  > EOF
01e5b7323a48 extdiff: reintroduce backward compatibility with manual quoting of parameters
Mads Kiilerich <madski@unity3d.com>
parents: 23683
diff changeset
   178
#if windows
01e5b7323a48 extdiff: reintroduce backward compatibility with manual quoting of parameters
Mads Kiilerich <madski@unity3d.com>
parents: 23683
diff changeset
   179
TODO
01e5b7323a48 extdiff: reintroduce backward compatibility with manual quoting of parameters
Mads Kiilerich <madski@unity3d.com>
parents: 23683
diff changeset
   180
#else
01e5b7323a48 extdiff: reintroduce backward compatibility with manual quoting of parameters
Mads Kiilerich <madski@unity3d.com>
parents: 23683
diff changeset
   181
  $ hg --debug odd | grep '^running'
01e5b7323a48 extdiff: reintroduce backward compatibility with manual quoting of parameters
Mads Kiilerich <madski@unity3d.com>
parents: 23683
diff changeset
   182
  running "/bin/echo --foo='sp ace' 'sp ace' --bar='sp ace' 'sp ace'" in * (glob)
01e5b7323a48 extdiff: reintroduce backward compatibility with manual quoting of parameters
Mads Kiilerich <madski@unity3d.com>
parents: 23683
diff changeset
   183
#endif
01e5b7323a48 extdiff: reintroduce backward compatibility with manual quoting of parameters
Mads Kiilerich <madski@unity3d.com>
parents: 23683
diff changeset
   184
16899
8149ff405c78 tests: convert some 'hghave execbit' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 15442
diff changeset
   185
#if execbit
8149ff405c78 tests: convert some 'hghave execbit' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 15442
diff changeset
   186
12304
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   187
Test extdiff of multiple files in tmp dir:
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   188
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   189
  $ hg update -C 0 > /dev/null
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   190
  $ echo changed > a
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   191
  $ echo changed > b
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   192
  $ chmod +x b
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   193
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   194
Diff in working directory, before:
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   195
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   196
  $ hg diff --git
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   197
  diff --git a/a b/a
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   198
  --- a/a
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   199
  +++ b/a
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   200
  @@ -1,1 +1,1 @@
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   201
  -a
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   202
  +changed
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   203
  diff --git a/b b/b
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   204
  old mode 100644
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   205
  new mode 100755
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   206
  --- a/b
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   207
  +++ b/b
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   208
  @@ -1,1 +1,1 @@
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   209
  -b
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   210
  +changed
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   211
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   212
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   213
Edit with extdiff -p:
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   214
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   215
Prepare custom diff/edit tool:
8065
66d0a03d3afc extdiff: preserve execute-bit across copies (issue1562)
Patrick Mezard <pmezard@gmail.com>
parents: 7758
diff changeset
   216
12304
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   217
  $ cat > 'diff tool.py' << EOT
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   218
  > #!/usr/bin/env python
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   219
  > import time
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   220
  > time.sleep(1) # avoid unchanged-timestamp problems
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   221
  > file('a/a', 'ab').write('edited\n')
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   222
  > file('a/b', 'ab').write('edited\n')
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   223
  > EOT
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   224
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   225
  $ chmod +x 'diff tool.py'
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   226
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12316
diff changeset
   227
will change to /tmp/extdiff.TMP and populate directories a.TMP and a
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12316
diff changeset
   228
and start tool
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12316
diff changeset
   229
12304
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   230
  $ hg extdiff -p "`pwd`/diff tool.py"
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12304
diff changeset
   231
  [1]
12304
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   232
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   233
Diff in working directory, after:
9956
6045a8c4dbbc extdiff: respect --option in command aliases (issue949)
Sune Foldager <cryo@cyanite.org>
parents: 8212
diff changeset
   234
12304
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   235
  $ hg diff --git
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   236
  diff --git a/a b/a
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   237
  --- a/a
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   238
  +++ b/a
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   239
  @@ -1,1 +1,2 @@
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   240
  -a
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   241
  +changed
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   242
  +edited
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   243
  diff --git a/b b/b
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   244
  old mode 100644
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   245
  new mode 100755
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   246
  --- a/b
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   247
  +++ b/b
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   248
  @@ -1,1 +1,2 @@
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   249
  -b
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   250
  +changed
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   251
  +edited
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   252
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   253
Test extdiff with --option:
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   254
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   255
  $ hg extdiff -p echo -o this -c 1
13762
3740792dbe51 test-extdiff: fix 5c0e1222e7c0 temporary dir output
Patrick Mezard <pmezard@gmail.com>
parents: 13660
diff changeset
   256
  this */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12304
diff changeset
   257
  [1]
12304
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   258
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   259
  $ hg falabala -o this -c 1
13762
3740792dbe51 test-extdiff: fix 5c0e1222e7c0 temporary dir output
Patrick Mezard <pmezard@gmail.com>
parents: 13660
diff changeset
   260
  diffing this */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12304
diff changeset
   261
  [1]
12304
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   262
23138
72a89cf86fcd extdiff: quote user-supplied options passed to shell
Michael Fyles <mf@vorston.net>
parents: 22117
diff changeset
   263
Test extdiff's handling of options with spaces in them:
72a89cf86fcd extdiff: quote user-supplied options passed to shell
Michael Fyles <mf@vorston.net>
parents: 22117
diff changeset
   264
72a89cf86fcd extdiff: quote user-supplied options passed to shell
Michael Fyles <mf@vorston.net>
parents: 22117
diff changeset
   265
  $ hg edspace -c 1
72a89cf86fcd extdiff: quote user-supplied options passed to shell
Michael Fyles <mf@vorston.net>
parents: 22117
diff changeset
   266
  name  <user@example.com> */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
72a89cf86fcd extdiff: quote user-supplied options passed to shell
Michael Fyles <mf@vorston.net>
parents: 22117
diff changeset
   267
  [1]
72a89cf86fcd extdiff: quote user-supplied options passed to shell
Michael Fyles <mf@vorston.net>
parents: 22117
diff changeset
   268
72a89cf86fcd extdiff: quote user-supplied options passed to shell
Michael Fyles <mf@vorston.net>
parents: 22117
diff changeset
   269
  $ hg extdiff -p echo -o "name  <user@example.com>" -c 1
72a89cf86fcd extdiff: quote user-supplied options passed to shell
Michael Fyles <mf@vorston.net>
parents: 22117
diff changeset
   270
  name  <user@example.com> */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
72a89cf86fcd extdiff: quote user-supplied options passed to shell
Michael Fyles <mf@vorston.net>
parents: 22117
diff changeset
   271
  [1]
72a89cf86fcd extdiff: quote user-supplied options passed to shell
Michael Fyles <mf@vorston.net>
parents: 22117
diff changeset
   272
13660
a56c1b2bff18 Updating hgext.extdiff to use revsets
David Wolever <david@wolever.net>
parents: 12640
diff changeset
   273
Test with revsets:
a56c1b2bff18 Updating hgext.extdiff to use revsets
David Wolever <david@wolever.net>
parents: 12640
diff changeset
   274
a56c1b2bff18 Updating hgext.extdiff to use revsets
David Wolever <david@wolever.net>
parents: 12640
diff changeset
   275
  $ hg extdif -p echo -c "rev(1)"
13762
3740792dbe51 test-extdiff: fix 5c0e1222e7c0 temporary dir output
Patrick Mezard <pmezard@gmail.com>
parents: 13660
diff changeset
   276
  */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12304
diff changeset
   277
  [1]
13660
a56c1b2bff18 Updating hgext.extdiff to use revsets
David Wolever <david@wolever.net>
parents: 12640
diff changeset
   278
a56c1b2bff18 Updating hgext.extdiff to use revsets
David Wolever <david@wolever.net>
parents: 12640
diff changeset
   279
  $ hg extdif -p echo -r "0::1"
13762
3740792dbe51 test-extdiff: fix 5c0e1222e7c0 temporary dir output
Patrick Mezard <pmezard@gmail.com>
parents: 13660
diff changeset
   280
  */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
13660
a56c1b2bff18 Updating hgext.extdiff to use revsets
David Wolever <david@wolever.net>
parents: 12640
diff changeset
   281
  [1]
14024
92b768e9f80c merge with stable
Thomas Arendsen Hein <thomas@intevation.de>
parents: 13762 14021
diff changeset
   282
23150
aff73c777b0b extdiff: allow a preconfigured merge-tool to be invoked
Matt Harbison <matt_harbison@yahoo.com>
parents: 22117
diff changeset
   283
Fallback to merge-tools.tool.executable|regkey
aff73c777b0b extdiff: allow a preconfigured merge-tool to be invoked
Matt Harbison <matt_harbison@yahoo.com>
parents: 22117
diff changeset
   284
  $ mkdir dir
aff73c777b0b extdiff: allow a preconfigured merge-tool to be invoked
Matt Harbison <matt_harbison@yahoo.com>
parents: 22117
diff changeset
   285
  $ cat > 'dir/tool.sh' << EOF
aff73c777b0b extdiff: allow a preconfigured merge-tool to be invoked
Matt Harbison <matt_harbison@yahoo.com>
parents: 22117
diff changeset
   286
  > #!/bin/sh
aff73c777b0b extdiff: allow a preconfigured merge-tool to be invoked
Matt Harbison <matt_harbison@yahoo.com>
parents: 22117
diff changeset
   287
  > echo "** custom diff **"
aff73c777b0b extdiff: allow a preconfigured merge-tool to be invoked
Matt Harbison <matt_harbison@yahoo.com>
parents: 22117
diff changeset
   288
  > EOF
aff73c777b0b extdiff: allow a preconfigured merge-tool to be invoked
Matt Harbison <matt_harbison@yahoo.com>
parents: 22117
diff changeset
   289
  $ chmod +x dir/tool.sh
aff73c777b0b extdiff: allow a preconfigured merge-tool to be invoked
Matt Harbison <matt_harbison@yahoo.com>
parents: 22117
diff changeset
   290
  $ tool=`pwd`/dir/tool.sh
aff73c777b0b extdiff: allow a preconfigured merge-tool to be invoked
Matt Harbison <matt_harbison@yahoo.com>
parents: 22117
diff changeset
   291
  $ hg --debug tl --config extdiff.tl= --config merge-tools.tl.executable=$tool
aff73c777b0b extdiff: allow a preconfigured merge-tool to be invoked
Matt Harbison <matt_harbison@yahoo.com>
parents: 22117
diff changeset
   292
  making snapshot of 2 files from rev * (glob)
aff73c777b0b extdiff: allow a preconfigured merge-tool to be invoked
Matt Harbison <matt_harbison@yahoo.com>
parents: 22117
diff changeset
   293
    a
aff73c777b0b extdiff: allow a preconfigured merge-tool to be invoked
Matt Harbison <matt_harbison@yahoo.com>
parents: 22117
diff changeset
   294
    b
aff73c777b0b extdiff: allow a preconfigured merge-tool to be invoked
Matt Harbison <matt_harbison@yahoo.com>
parents: 22117
diff changeset
   295
  making snapshot of 2 files from working directory
aff73c777b0b extdiff: allow a preconfigured merge-tool to be invoked
Matt Harbison <matt_harbison@yahoo.com>
parents: 22117
diff changeset
   296
    a
aff73c777b0b extdiff: allow a preconfigured merge-tool to be invoked
Matt Harbison <matt_harbison@yahoo.com>
parents: 22117
diff changeset
   297
    b
23683
5edb387158a1 posix: quote the specified string only when it may have to be quoted
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 23682
diff changeset
   298
  running '$TESTTMP/a/dir/tool.sh a.* a' in */extdiff.* (glob)
23150
aff73c777b0b extdiff: allow a preconfigured merge-tool to be invoked
Matt Harbison <matt_harbison@yahoo.com>
parents: 22117
diff changeset
   299
  ** custom diff **
aff73c777b0b extdiff: allow a preconfigured merge-tool to be invoked
Matt Harbison <matt_harbison@yahoo.com>
parents: 22117
diff changeset
   300
  cleaning up temp directory
aff73c777b0b extdiff: allow a preconfigured merge-tool to be invoked
Matt Harbison <matt_harbison@yahoo.com>
parents: 22117
diff changeset
   301
  [1]
aff73c777b0b extdiff: allow a preconfigured merge-tool to be invoked
Matt Harbison <matt_harbison@yahoo.com>
parents: 22117
diff changeset
   302
14021
3eb632d9cf42 extdiff: fix broken symlinks handling (issue1909)
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   303
  $ cd ..
12304
41dd368b6fe8 tests: unify test-extdiff
Adrian Buehlmann <adrian@cadifra.com>
parents: 10775
diff changeset
   304
16899
8149ff405c78 tests: convert some 'hghave execbit' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 15442
diff changeset
   305
#endif
8149ff405c78 tests: convert some 'hghave execbit' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 15442
diff changeset
   306
8149ff405c78 tests: convert some 'hghave execbit' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 15442
diff changeset
   307
#if symlink
8149ff405c78 tests: convert some 'hghave execbit' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 15442
diff changeset
   308
14024
92b768e9f80c merge with stable
Thomas Arendsen Hein <thomas@intevation.de>
parents: 13762 14021
diff changeset
   309
Test symlinks handling (issue1909)
92b768e9f80c merge with stable
Thomas Arendsen Hein <thomas@intevation.de>
parents: 13762 14021
diff changeset
   310
14021
3eb632d9cf42 extdiff: fix broken symlinks handling (issue1909)
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   311
  $ hg init testsymlinks
3eb632d9cf42 extdiff: fix broken symlinks handling (issue1909)
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   312
  $ cd testsymlinks
3eb632d9cf42 extdiff: fix broken symlinks handling (issue1909)
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   313
  $ echo a > a
3eb632d9cf42 extdiff: fix broken symlinks handling (issue1909)
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   314
  $ hg ci -Am adda
3eb632d9cf42 extdiff: fix broken symlinks handling (issue1909)
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   315
  adding a
3eb632d9cf42 extdiff: fix broken symlinks handling (issue1909)
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   316
  $ echo a >> a
3eb632d9cf42 extdiff: fix broken symlinks handling (issue1909)
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   317
  $ ln -s missing linka
3eb632d9cf42 extdiff: fix broken symlinks handling (issue1909)
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   318
  $ hg add linka
3eb632d9cf42 extdiff: fix broken symlinks handling (issue1909)
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   319
  $ hg falabala -r 0 --traceback
3eb632d9cf42 extdiff: fix broken symlinks handling (issue1909)
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   320
  diffing testsymlinks.07f494440405 testsymlinks
3eb632d9cf42 extdiff: fix broken symlinks handling (issue1909)
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   321
  [1]
3eb632d9cf42 extdiff: fix broken symlinks handling (issue1909)
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   322
  $ cd ..
16899
8149ff405c78 tests: convert some 'hghave execbit' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 15442
diff changeset
   323
8149ff405c78 tests: convert some 'hghave execbit' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 15442
diff changeset
   324
#endif