Mercurial > hg
annotate tests/test-addremove.t @ 20836:a8b4541bb961
grep: reuse the first "util.binary()" result for efficiency
Before this patch, to check whether the file in the specified revision
is binary or not, "util.binary()" is invoked via internal function
"binary()" of "hg grep" once per a line of "hg grep" output, even
though binary-ness is not changed in the same file.
This patch reuses the first "util.binary()" invocation result by
annotating internal function "binary()" with "@util.cachefunc".
Performance improvement measured by "hgperf grep -r 88d8e568add1 vfs
mercurial/scmutil.py":
before this patch:
! wall 0.024000 comb 0.015600 user 0.015600 sys 0.000000 (best of 118)
after this patch:
! wall 0.023000 comb 0.015600 user 0.015600 sys 0.000000 (best of 123)
Status of recent(88d8e568add1) "mercurial/scmutil.py":
# of lines: 919 (may affect cost of search)
# of bytes: 29633 (may affect cost of "util.binary()")
# of matches: 22 (may affect frequency of "util.binary()")
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Sat, 15 Feb 2014 19:52:36 +0900 |
parents | 6ef3107c661e |
children | 9f4778027bc2 |
rev | line source |
---|---|
11850
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
1 $ hg init rep |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
2 $ cd rep |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
3 $ mkdir dir |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
4 $ touch foo dir/bar |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
5 $ hg -v addremove |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
6 adding dir/bar |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
7 adding foo |
12156
4c94b6d0fb1c
tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents:
11850
diff
changeset
|
8 $ hg -v commit -m "add 1" |
11850
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
9 dir/bar |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
10 foo |
12156
4c94b6d0fb1c
tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents:
11850
diff
changeset
|
11 committed changeset 0:6f7f953567a2 |
11850
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
12 $ cd dir/ |
16874
8017ac7a0e8f
test-addremove: remove bits about con.xml
Adrian Buehlmann <adrian@cadifra.com>
parents:
15444
diff
changeset
|
13 $ touch ../foo_2 bar_2 |
11850
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
14 $ hg -v addremove |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
15 adding dir/bar_2 |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
16 adding foo_2 |
12156
4c94b6d0fb1c
tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents:
11850
diff
changeset
|
17 $ hg -v commit -m "add 2" |
11850
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
18 dir/bar_2 |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
19 foo_2 |
16874
8017ac7a0e8f
test-addremove: remove bits about con.xml
Adrian Buehlmann <adrian@cadifra.com>
parents:
15444
diff
changeset
|
20 committed changeset 1:e65414bf35c5 |
16912
6ef3107c661e
tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents:
16874
diff
changeset
|
21 $ cd ../.. |
2958
ff3ea21a981a
addremove: add -s/--similarity option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1933
diff
changeset
|
22 |
11850
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
23 $ hg init sim |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
24 $ cd sim |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
25 $ echo a > a |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
26 $ echo a >> a |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
27 $ echo a >> a |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
28 $ echo c > c |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
29 $ hg commit -Ama |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
30 adding a |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
31 adding c |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
32 $ mv a b |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
33 $ rm c |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
34 $ echo d > d |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
35 $ hg addremove -n -s 50 # issue 1696 |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
36 removing a |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
37 adding b |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
38 removing c |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
39 adding d |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
40 recording removal of a as rename to b (100% similar) |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
41 $ hg addremove -s 50 |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
42 removing a |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
43 adding b |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
44 removing c |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
45 adding d |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
46 recording removal of a as rename to b (100% similar) |
54dbf16b401f
tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents:
8990
diff
changeset
|
47 $ hg commit -mb |
16912
6ef3107c661e
tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents:
16874
diff
changeset
|
48 $ cd .. |