tests/test-profile.t
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Tue, 02 Jun 2015 02:28:33 +0900
branchstable
changeset 25392 ed18f4acf435
parent 18765 cd2c82510aa2
child 26191 39a0b11158d8
permissions -rw-r--r--
templatekw: compare target context and its parent exactly (issue4690) Before this patch, template keywords `{file_mods}`, `{file_adds}` and `{file_dels}` use values gotten by `repo.status(ctx.p1().node(), ctx.node())`. But this doesn't work as expected if `ctx` is `memctx` or `workingcommitctx`. Typical case of templating with these contexts is customization of the text shown in the commit message editor by `[committemplate]` configuration. In this case, `ctx.node()` returns None and it causes comparison between `ctx.p1()` and `workingctx`. `workingctx` lists up all changed files in the working directory even at selective committing. BTW, `{files}` uses `ctx.files()` and it works as expected. To compare target context and its parent exactly, this patch passes `ctx.p1()` and `ctx` without `node()`-nize. This avoids unexpected comparison with `workingctx`. This patch uses a little redundant template configurations in `test-commit.t`, but they are needed to avoid regression around problems fixed by a4958cdb2202 and 1e6fb8db666e: accessing on `ctx` may break `ctx._status` field.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12478
bb665db49e32 tests: unify test-profile
Matt Mackall <mpm@selenic.com>
parents: 8024
diff changeset
     1
test --time
5099
105d4cf7ec24 Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     2
16933
30143c3dd102 dispatch: lowercase --time message
Martin Geisler <mg@aragost.com>
parents: 16913
diff changeset
     3
  $ hg --time help -q help 2>&1 | grep time > /dev/null
12478
bb665db49e32 tests: unify test-profile
Matt Mackall <mpm@selenic.com>
parents: 8024
diff changeset
     4
  $ hg init a
bb665db49e32 tests: unify test-profile
Matt Mackall <mpm@selenic.com>
parents: 8024
diff changeset
     5
  $ cd a
8022
4f3fdfaa3874 profiling: Adding profiling.output config variable
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8021
diff changeset
     6
16898
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
     7
#if lsprof
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
     8
12478
bb665db49e32 tests: unify test-profile
Matt Mackall <mpm@selenic.com>
parents: 8024
diff changeset
     9
test --profile
8022
4f3fdfaa3874 profiling: Adding profiling.output config variable
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8021
diff changeset
    10
16898
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    11
  $ hg --profile st 2>../out
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    12
  $ grep CallCount ../out > /dev/null || cat ../out
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    13
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    14
  $ hg --profile --config profiling.output=../out st
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    15
  $ grep CallCount ../out > /dev/null || cat ../out
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    16
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    17
  $ hg --profile --config profiling.format=text st 2>../out
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    18
  $ grep CallCount ../out > /dev/null || cat ../out
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    19
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    20
  $ echo "[profiling]" >> $HGRCPATH
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    21
  $ echo "format=kcachegrind" >> $HGRCPATH
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    22
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    23
  $ hg --profile st 2>../out
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    24
  $ grep 'events: Ticks' ../out > /dev/null || cat ../out
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    25
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    26
  $ hg --profile --config profiling.output=../out st
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    27
  $ grep 'events: Ticks' ../out > /dev/null || cat ../out
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    28
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    29
#endif
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16898
diff changeset
    30
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16898
diff changeset
    31
  $ cd ..