tests/test-churn.t
author Manuel Jacob <me@manueljacob.de>
Sun, 22 May 2022 03:50:34 +0200
changeset 49269 395f28064826
parent 46430 b84c3d43ff2e
permissions -rw-r--r--
worker: avoid potential partial write of pickled data Previously, the code wrote the pickled data using os.write(). However, os.write() can write less bytes than passed to it. To trigger the problem, the pickled data had to be larger than 2147479552 bytes on my system. Instead, open a file object and pass it to pickle.dump(). This also has the advantage that it doesn’t buffer the whole pickled data in memory. Note that the opened file must be buffered because pickle doesn’t support unbuffered streams because unbuffered streams’ write() method might write less bytes than passed to it (like os.write()) but pickle.dump() relies on that all bytes are written (see https://github.com/python/cpython/issues/93050). The side effect of using a file object and a with statement is that wfd is explicitly closed now while it seems like before it was implicitly closed by process exit.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12095
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
     1
  $ echo "[extensions]" >> $HGRCPATH
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
     2
  $ echo "churn=" >> $HGRCPATH
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
     3
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
     4
create test repository
6348
f8feaa665319 Make churn an official extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     5
12095
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
     6
  $ hg init repo
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
     7
  $ cd repo
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
     8
  $ echo a > a
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
     9
  $ hg ci -Am adda -u user1 -d 6:00
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    10
  adding a
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    11
  $ echo b >> a
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    12
  $ echo b > b
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    13
  $ hg ci -m changeba -u user2 -d 9:00 a
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    14
  $ hg ci -Am addb -u user2 -d 9:30
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    15
  adding b
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    16
  $ echo c >> a
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    17
  $ echo c >> b
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    18
  $ echo c > c
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    19
  $ hg ci -m changeca -u user3 -d 12:00 a
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    20
  $ hg ci -m changecb -u user3 -d 12:15 b
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    21
  $ hg ci -Am addc -u user3 -d 12:30
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    22
  adding c
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    23
  $ mkdir -p d/e
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    24
  $ echo abc > d/e/f1.txt
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    25
  $ hg ci -Am "add d/e/f1.txt" -u user1 -d 12:45 d/e/f1.txt
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    26
  $ mkdir -p d/g
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    27
  $ echo def > d/g/f2.txt
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    28
  $ hg ci -Am "add d/g/f2.txt" -u user1 -d 13:00 d/g/f2.txt
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    29
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    30
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    31
churn separate directories
6348
f8feaa665319 Make churn an official extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    32
12095
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    33
  $ cd d
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    34
  $ hg churn e
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    35
  user1      1 ***************************************************************
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    36
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    37
churn all
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    38
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    39
  $ hg churn
18369
2150e70c0ee1 churn: sort users with same churn by name
Mads Kiilerich <mads@kiilerich.com>
parents: 16913
diff changeset
    40
  user1      3 ***************************************************************
12095
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    41
  user3      3 ***************************************************************
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    42
  user2      2 ******************************************
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    43
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    44
churn excluding one dir
6348
f8feaa665319 Make churn an official extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    45
12095
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    46
  $ hg churn -X e
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    47
  user3      3 ***************************************************************
18369
2150e70c0ee1 churn: sort users with same churn by name
Mads Kiilerich <mads@kiilerich.com>
parents: 16913
diff changeset
    48
  user1      2 ******************************************
12095
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    49
  user2      2 ******************************************
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    50
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    51
churn up to rev 2
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    52
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    53
  $ hg churn -r :2
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    54
  user2      2 ***************************************************************
40241
81e4f039a0cd churn: use integer division consistently
Augie Fackler <augie@google.com>
parents: 26781
diff changeset
    55
  user1      1 *******************************
12095
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    56
  $ cd ..
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    57
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    58
churn with aliases
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    59
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    60
  $ cat > ../aliases <<EOF
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    61
  > user1 alias1
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    62
  > user3 alias3
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    63
  > not-an-alias
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    64
  > EOF
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    65
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    66
churn with .hgchurn
12068
2e7647d25458 churn: do not crash on empty lines in alias file
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents: 11265
diff changeset
    67
12095
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    68
  $ mv ../aliases .hgchurn
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    69
  $ hg churn
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    70
  skipping malformed alias: not-an-alias
18369
2150e70c0ee1 churn: sort users with same churn by name
Mads Kiilerich <mads@kiilerich.com>
parents: 16913
diff changeset
    71
  alias1      3 **************************************************************
12095
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    72
  alias3      3 **************************************************************
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    73
  user2       2 *****************************************
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    74
  $ rm .hgchurn
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    75
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    76
churn with column specifier
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    77
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    78
  $ COLUMNS=40 hg churn
18369
2150e70c0ee1 churn: sort users with same churn by name
Mads Kiilerich <mads@kiilerich.com>
parents: 16913
diff changeset
    79
  user1      3 ***********************
12095
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    80
  user3      3 ***********************
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    81
  user2      2 ***************
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    82
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    83
churn by hour
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    84
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    85
  $ hg churn -f '%H' -s
40241
81e4f039a0cd churn: use integer division consistently
Augie Fackler <augie@google.com>
parents: 26781
diff changeset
    86
  06      1 ****************
12095
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    87
  09      2 *********************************
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    88
  12      4 ******************************************************************
40241
81e4f039a0cd churn: use integer division consistently
Augie Fackler <augie@google.com>
parents: 26781
diff changeset
    89
  13      1 ****************
12095
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    90
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    91
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    92
churn with separated added/removed lines
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    93
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    94
  $ hg rm d/g/f2.txt
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    95
  $ hg ci -Am "removed d/g/f2.txt" -u user1 -d 14:00 d/g/f2.txt
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    96
  $ hg churn --diffstat
40241
81e4f039a0cd churn: use integer division consistently
Augie Fackler <augie@google.com>
parents: 26781
diff changeset
    97
  user1           +3/-1 ++++++++++++++++++++++++++++++++++++++++-------------
81e4f039a0cd churn: use integer division consistently
Augie Fackler <augie@google.com>
parents: 26781
diff changeset
    98
  user3           +3/-0 ++++++++++++++++++++++++++++++++++++++++
12095
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
    99
  user2           +2/-0 +++++++++++++++++++++++++++
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   100
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   101
churn --diffstat with color
6348
f8feaa665319 Make churn an official extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   102
12095
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   103
  $ hg --config extensions.color= churn --config color.mode=ansi \
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   104
  >     --diffstat --color=always
40241
81e4f039a0cd churn: use integer division consistently
Augie Fackler <augie@google.com>
parents: 26781
diff changeset
   105
  user1           +3/-1 \x1b[0;32m++++++++++++++++++++++++++++++++++++++++\x1b[0m\x1b[0;31m-------------\x1b[0m (esc)
81e4f039a0cd churn: use integer division consistently
Augie Fackler <augie@google.com>
parents: 26781
diff changeset
   106
  user3           +3/-0 \x1b[0;32m++++++++++++++++++++++++++++++++++++++++\x1b[0m (esc)
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12399
diff changeset
   107
  user2           +2/-0 \x1b[0;32m+++++++++++++++++++++++++++\x1b[0m (esc)
12095
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   108
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   109
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   110
changeset number churn
9669
9b127e888640 churn: ability to display added/removed lines separately
Alexander Solovyov <piranha@piranha.org.ua>
parents: 9389
diff changeset
   111
12095
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   112
  $ hg churn -c
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   113
  user1      4 ***************************************************************
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   114
  user3      3 ***********************************************
40241
81e4f039a0cd churn: use integer division consistently
Augie Fackler <augie@google.com>
parents: 26781
diff changeset
   115
  user2      2 *******************************
12095
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   116
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   117
  $ echo 'with space = no-space' >> ../aliases
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   118
  $ echo a >> a
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   119
  $ hg commit -m a -u 'with space' -d 15:00
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   120
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   121
churn with space in alias
9670
7d56b6ffef72 churn: fix changeset count (broken by 9b127e888640)
Alexander Solovyov <piranha@piranha.org.ua>
parents: 9669
diff changeset
   122
12095
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   123
  $ hg churn --aliases ../aliases -r tip
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   124
  no-space      1 ************************************************************
11264
30c620e48d1c churn: support spaces in aliases (issue2222)
Alexander Solovyov <piranha@piranha.org.ua>
parents: 11141
diff changeset
   125
12095
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   126
  $ cd ..
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   127
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   128
12399
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12095
diff changeset
   129
Issue833: ZeroDivisionError
9388
f7968bba2307 churn: issue833 was reintroduced in 9bc46d069a76, correct it and add a test
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8254
diff changeset
   130
12095
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   131
  $ hg init issue-833
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   132
  $ cd issue-833
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   133
  $ touch foo
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   134
  $ hg ci -Am foo
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   135
  adding foo
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   136
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   137
this was failing with a ZeroDivisionError
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   138
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   139
  $ hg churn
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   140
  test      0 
80b0865b3fa5 tests: unify test-churn
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12069
diff changeset
   141
  $ cd ..
13123
2506658c3927 churn: ignore trailing and leading spaces (issue2546)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12942
diff changeset
   142
2506658c3927 churn: ignore trailing and leading spaces (issue2546)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12942
diff changeset
   143
Ignore trailing or leading spaces in emails
2506658c3927 churn: ignore trailing and leading spaces (issue2546)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12942
diff changeset
   144
2506658c3927 churn: ignore trailing and leading spaces (issue2546)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12942
diff changeset
   145
  $ cd repo
2506658c3927 churn: ignore trailing and leading spaces (issue2546)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12942
diff changeset
   146
  $ touch bar
2506658c3927 churn: ignore trailing and leading spaces (issue2546)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12942
diff changeset
   147
  $ hg ci -Am'bar' -u 'user4 <user4@x.com>'
2506658c3927 churn: ignore trailing and leading spaces (issue2546)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12942
diff changeset
   148
  adding bar
2506658c3927 churn: ignore trailing and leading spaces (issue2546)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12942
diff changeset
   149
  $ touch foo
2506658c3927 churn: ignore trailing and leading spaces (issue2546)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12942
diff changeset
   150
  $ hg ci -Am'foo' -u 'user4 < user4@x.com >'
2506658c3927 churn: ignore trailing and leading spaces (issue2546)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12942
diff changeset
   151
  adding foo
2506658c3927 churn: ignore trailing and leading spaces (issue2546)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12942
diff changeset
   152
  $ hg log -l2 --template '[{author|email}]\n'
2506658c3927 churn: ignore trailing and leading spaces (issue2546)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12942
diff changeset
   153
  [ user4@x.com ]
2506658c3927 churn: ignore trailing and leading spaces (issue2546)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12942
diff changeset
   154
  [user4@x.com]
2506658c3927 churn: ignore trailing and leading spaces (issue2546)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12942
diff changeset
   155
  $ hg churn -c
2506658c3927 churn: ignore trailing and leading spaces (issue2546)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12942
diff changeset
   156
  user1            4 *********************************************************
40241
81e4f039a0cd churn: use integer division consistently
Augie Fackler <augie@google.com>
parents: 26781
diff changeset
   157
  user3            3 ******************************************
81e4f039a0cd churn: use integer division consistently
Augie Fackler <augie@google.com>
parents: 26781
diff changeset
   158
  user2            2 ****************************
81e4f039a0cd churn: use integer division consistently
Augie Fackler <augie@google.com>
parents: 26781
diff changeset
   159
  user4@x.com      2 ****************************
13123
2506658c3927 churn: ignore trailing and leading spaces (issue2546)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12942
diff changeset
   160
  with space       1 **************
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 13123
diff changeset
   161
21163
9846b40d01e7 churn: compute padding with unicode strings
Isaac Jurado <diptongo@gmail.com>
parents: 18369
diff changeset
   162
Test multibyte sequences in names
9846b40d01e7 churn: compute padding with unicode strings
Isaac Jurado <diptongo@gmail.com>
parents: 18369
diff changeset
   163
9846b40d01e7 churn: compute padding with unicode strings
Isaac Jurado <diptongo@gmail.com>
parents: 18369
diff changeset
   164
  $ echo bar >> bar
9846b40d01e7 churn: compute padding with unicode strings
Isaac Jurado <diptongo@gmail.com>
parents: 18369
diff changeset
   165
  $ hg --encoding utf-8 ci -m'changed bar' -u 'El Niño <nino@x.com>'
9846b40d01e7 churn: compute padding with unicode strings
Isaac Jurado <diptongo@gmail.com>
parents: 18369
diff changeset
   166
  $ hg --encoding utf-8 churn -ct '{author|person}'
9846b40d01e7 churn: compute padding with unicode strings
Isaac Jurado <diptongo@gmail.com>
parents: 18369
diff changeset
   167
  user1           4 **********************************************************
40241
81e4f039a0cd churn: use integer division consistently
Augie Fackler <augie@google.com>
parents: 26781
diff changeset
   168
  user3           3 *******************************************
21163
9846b40d01e7 churn: compute padding with unicode strings
Isaac Jurado <diptongo@gmail.com>
parents: 18369
diff changeset
   169
  user2           2 *****************************
9846b40d01e7 churn: compute padding with unicode strings
Isaac Jurado <diptongo@gmail.com>
parents: 18369
diff changeset
   170
  user4           2 *****************************
40241
81e4f039a0cd churn: use integer division consistently
Augie Fackler <augie@google.com>
parents: 26781
diff changeset
   171
  El Ni\xc3\xb1o         1 ************** (esc)
81e4f039a0cd churn: use integer division consistently
Augie Fackler <augie@google.com>
parents: 26781
diff changeset
   172
  with space      1 **************
21163
9846b40d01e7 churn: compute padding with unicode strings
Isaac Jurado <diptongo@gmail.com>
parents: 18369
diff changeset
   173
26781
1aee2ab0f902 spelling: trivial spell checking
Mads Kiilerich <madski@unity3d.com>
parents: 24139
diff changeset
   174
Test --template argument, with backwards compatibility
24139
73b3218bb078 churn: deprecate -t option in favour of -T
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 21163
diff changeset
   175
73b3218bb078 churn: deprecate -t option in favour of -T
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 21163
diff changeset
   176
  $ hg churn -t '{author|user}'
73b3218bb078 churn: deprecate -t option in favour of -T
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 21163
diff changeset
   177
  user1      4 ***************************************************************
73b3218bb078 churn: deprecate -t option in favour of -T
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 21163
diff changeset
   178
  user3      3 ***********************************************
40241
81e4f039a0cd churn: use integer division consistently
Augie Fackler <augie@google.com>
parents: 26781
diff changeset
   179
  user2      2 *******************************
81e4f039a0cd churn: use integer division consistently
Augie Fackler <augie@google.com>
parents: 26781
diff changeset
   180
  nino       1 ***************
81e4f039a0cd churn: use integer division consistently
Augie Fackler <augie@google.com>
parents: 26781
diff changeset
   181
  with       1 ***************
24139
73b3218bb078 churn: deprecate -t option in favour of -T
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 21163
diff changeset
   182
             0 
73b3218bb078 churn: deprecate -t option in favour of -T
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 21163
diff changeset
   183
  user4      0 
73b3218bb078 churn: deprecate -t option in favour of -T
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 21163
diff changeset
   184
  $ hg churn -T '{author|user}'
73b3218bb078 churn: deprecate -t option in favour of -T
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 21163
diff changeset
   185
  user1      4 ***************************************************************
73b3218bb078 churn: deprecate -t option in favour of -T
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 21163
diff changeset
   186
  user3      3 ***********************************************
40241
81e4f039a0cd churn: use integer division consistently
Augie Fackler <augie@google.com>
parents: 26781
diff changeset
   187
  user2      2 *******************************
81e4f039a0cd churn: use integer division consistently
Augie Fackler <augie@google.com>
parents: 26781
diff changeset
   188
  nino       1 ***************
81e4f039a0cd churn: use integer division consistently
Augie Fackler <augie@google.com>
parents: 26781
diff changeset
   189
  with       1 ***************
24139
73b3218bb078 churn: deprecate -t option in favour of -T
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 21163
diff changeset
   190
             0 
73b3218bb078 churn: deprecate -t option in favour of -T
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 21163
diff changeset
   191
  user4      0 
73b3218bb078 churn: deprecate -t option in favour of -T
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 21163
diff changeset
   192
  $ hg churn -t 'alltogether'
73b3218bb078 churn: deprecate -t option in favour of -T
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 21163
diff changeset
   193
  alltogether     11 *********************************************************
73b3218bb078 churn: deprecate -t option in favour of -T
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 21163
diff changeset
   194
  $ hg churn -T 'alltogether'
73b3218bb078 churn: deprecate -t option in favour of -T
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 21163
diff changeset
   195
  alltogether     11 *********************************************************
73b3218bb078 churn: deprecate -t option in favour of -T
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 21163
diff changeset
   196
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 13123
diff changeset
   197
  $ cd ..
46430
b84c3d43ff2e churn: count lines that look like diff headers but are not
Aay Jay Chan <aayjaychan@itopia.com.hk>
parents: 40241
diff changeset
   198
b84c3d43ff2e churn: count lines that look like diff headers but are not
Aay Jay Chan <aayjaychan@itopia.com.hk>
parents: 40241
diff changeset
   199
count lines that look like headings but are not
b84c3d43ff2e churn: count lines that look like diff headers but are not
Aay Jay Chan <aayjaychan@itopia.com.hk>
parents: 40241
diff changeset
   200
b84c3d43ff2e churn: count lines that look like diff headers but are not
Aay Jay Chan <aayjaychan@itopia.com.hk>
parents: 40241
diff changeset
   201
  $ hg init not-headers
b84c3d43ff2e churn: count lines that look like diff headers but are not
Aay Jay Chan <aayjaychan@itopia.com.hk>
parents: 40241
diff changeset
   202
  $ cd not-headers
b84c3d43ff2e churn: count lines that look like diff headers but are not
Aay Jay Chan <aayjaychan@itopia.com.hk>
parents: 40241
diff changeset
   203
  $ cat > a <<EOF
b84c3d43ff2e churn: count lines that look like diff headers but are not
Aay Jay Chan <aayjaychan@itopia.com.hk>
parents: 40241
diff changeset
   204
  > diff
b84c3d43ff2e churn: count lines that look like diff headers but are not
Aay Jay Chan <aayjaychan@itopia.com.hk>
parents: 40241
diff changeset
   205
  > @@ -195,3 +195,21 @@
b84c3d43ff2e churn: count lines that look like diff headers but are not
Aay Jay Chan <aayjaychan@itopia.com.hk>
parents: 40241
diff changeset
   206
  > -- a/tests/test-churn.t
b84c3d43ff2e churn: count lines that look like diff headers but are not
Aay Jay Chan <aayjaychan@itopia.com.hk>
parents: 40241
diff changeset
   207
  > ++ b/tests/test-churn.t
b84c3d43ff2e churn: count lines that look like diff headers but are not
Aay Jay Chan <aayjaychan@itopia.com.hk>
parents: 40241
diff changeset
   208
  > EOF
b84c3d43ff2e churn: count lines that look like diff headers but are not
Aay Jay Chan <aayjaychan@itopia.com.hk>
parents: 40241
diff changeset
   209
  $ hg ci -Am adda -u user1
b84c3d43ff2e churn: count lines that look like diff headers but are not
Aay Jay Chan <aayjaychan@itopia.com.hk>
parents: 40241
diff changeset
   210
  adding a
b84c3d43ff2e churn: count lines that look like diff headers but are not
Aay Jay Chan <aayjaychan@itopia.com.hk>
parents: 40241
diff changeset
   211
  $ hg churn --diffstat
b84c3d43ff2e churn: count lines that look like diff headers but are not
Aay Jay Chan <aayjaychan@itopia.com.hk>
parents: 40241
diff changeset
   212
  user1           +4/-0 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
b84c3d43ff2e churn: count lines that look like diff headers but are not
Aay Jay Chan <aayjaychan@itopia.com.hk>
parents: 40241
diff changeset
   213
  $ hg rm a
b84c3d43ff2e churn: count lines that look like diff headers but are not
Aay Jay Chan <aayjaychan@itopia.com.hk>
parents: 40241
diff changeset
   214
  $ hg ci -Am removea -u user1
b84c3d43ff2e churn: count lines that look like diff headers but are not
Aay Jay Chan <aayjaychan@itopia.com.hk>
parents: 40241
diff changeset
   215
  $ hg churn --diffstat
b84c3d43ff2e churn: count lines that look like diff headers but are not
Aay Jay Chan <aayjaychan@itopia.com.hk>
parents: 40241
diff changeset
   216
  user1           +4/-4 +++++++++++++++++++++++++++---------------------------