tests/test-log
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
Thu, 04 Oct 2007 23:21:37 -0300
changeset 5378 8a2915f57dfc
parent 4510 e0bc2c575044
permissions -rwxr-xr-x
convert: add a mode where mercurial_sink skips empty revisions. The getchanges function of some converter_source classes can return some false positives. I.e. they sometimes claim that a file "foo" was changed in some revision, even though its contents are still the same. convert_svn is particularly bad, but I think this can also happen with convert_cvs and, at least in theory, with mercurial_source. For regular conversions this is not really a problem - as long as getfile returns the right contents, we'll get a converted revision with the right contents. But when we use --filemap, this could lead to superfluous revisions being converted. Instead of fixing every converter_source, I decided to change mercurial_sink to work around this problem. When --filemap is used, we're interested only in revisions that touch some specific files. If a revision doesn't change any of these files, then we're not interested in it (at least for revisions with a single parent; merges are special). For mercurial_sink, we abuse this property and rollback a commit if the manifest text hasn't changed. This avoids duplicating the logic from localrepo.filecommit to detect unchanged files.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2741
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     2
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     3
hg init a
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     4
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     5
cd a
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     6
echo a > a
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     7
hg ci -Ama -d '1 0'
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     8
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     9
hg cp a b
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    10
hg ci -mb -d '2 0'
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    11
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    12
mkdir dir
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    13
hg mv b dir
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    14
hg ci -mc -d '3 0'
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    15
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    16
hg mv a b
3837
7df171ea50cd Fix log regression where log -p file showed diffs for other files
Matt Mackall <mpm@selenic.com>
parents: 3718
diff changeset
    17
echo a > d
7df171ea50cd Fix log regression where log -p file showed diffs for other files
Matt Mackall <mpm@selenic.com>
parents: 3718
diff changeset
    18
hg add d
2741
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    19
hg ci -md -d '4 0'
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    20
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    21
hg mv dir/b e
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    22
hg ci -me -d '5 0'
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    23
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    24
hg log a
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    25
echo % -f, directory
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    26
hg log -f dir
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    27
echo % -f, but no args
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    28
hg log -f
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    29
echo % one rename
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    30
hg log -vf a
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    31
echo % many renames
ae5ce3454ef5 log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    32
hg log -vf e
2780
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    33
3190
e18c3d08528d Show copies in hg log.
Brendan Cully <brendan@kublai.com>
parents: 2886
diff changeset
    34
echo % log copies
e18c3d08528d Show copies in hg log.
Brendan Cully <brendan@kublai.com>
parents: 2886
diff changeset
    35
hg log -vC --template '{rev} {file_copies%filecopy}\n'
e18c3d08528d Show copies in hg log.
Brendan Cully <brendan@kublai.com>
parents: 2886
diff changeset
    36
3382
c7c6f1a45348 Test case for log --copies on non-linear manifests (issue391)
Brendan Cully <brendan@kublai.com>
parents: 3190
diff changeset
    37
echo % log copies, non-linear manifest
c7c6f1a45348 Test case for log --copies on non-linear manifests (issue391)
Brendan Cully <brendan@kublai.com>
parents: 3190
diff changeset
    38
hg up -C 3
c7c6f1a45348 Test case for log --copies on non-linear manifests (issue391)
Brendan Cully <brendan@kublai.com>
parents: 3190
diff changeset
    39
hg mv dir/b e
c7c6f1a45348 Test case for log --copies on non-linear manifests (issue391)
Brendan Cully <brendan@kublai.com>
parents: 3190
diff changeset
    40
echo foo > foo
c7c6f1a45348 Test case for log --copies on non-linear manifests (issue391)
Brendan Cully <brendan@kublai.com>
parents: 3190
diff changeset
    41
hg ci -Ame2 -d '6 0'
c7c6f1a45348 Test case for log --copies on non-linear manifests (issue391)
Brendan Cully <brendan@kublai.com>
parents: 3190
diff changeset
    42
hg log -vC --template '{rev} {file_copies%filecopy}\n' -r 5
c7c6f1a45348 Test case for log --copies on non-linear manifests (issue391)
Brendan Cully <brendan@kublai.com>
parents: 3190
diff changeset
    43
3837
7df171ea50cd Fix log regression where log -p file showed diffs for other files
Matt Mackall <mpm@selenic.com>
parents: 3718
diff changeset
    44
echo '% log -p d'
7df171ea50cd Fix log regression where log -p file showed diffs for other files
Matt Mackall <mpm@selenic.com>
parents: 3718
diff changeset
    45
hg log -pv d
7df171ea50cd Fix log regression where log -p file showed diffs for other files
Matt Mackall <mpm@selenic.com>
parents: 3718
diff changeset
    46
2780
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    47
# log --follow tests
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    48
hg init ../follow
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    49
cd ../follow
4510
e0bc2c575044 Issue a warning if "-r ." is used with two working directory parents.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4208
diff changeset
    50
2780
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    51
echo base > base
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    52
hg ci -Ambase -d '1 0'
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    53
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    54
echo r1 >> base
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    55
hg ci -Amr1 -d '1 0'
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    56
echo r2 >> base
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    57
hg ci -Amr2 -d '1 0'
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    58
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    59
hg up -C 1
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    60
echo b1 > b1
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    61
hg ci -Amb1 -d '1 0'
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    62
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    63
echo % log -f
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    64
hg log -f
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    65
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    66
hg up -C 0
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    67
echo b2 > b2
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    68
hg ci -Amb2 -d '1 0'
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    69
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    70
echo % log -f -r 1:tip
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    71
hg log -f -r 1:tip
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    72
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    73
hg up -C 3
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    74
hg merge tip
4510
e0bc2c575044 Issue a warning if "-r ." is used with two working directory parents.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4208
diff changeset
    75
e0bc2c575044 Issue a warning if "-r ." is used with two working directory parents.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4208
diff changeset
    76
echo % log -r .  with two parents
e0bc2c575044 Issue a warning if "-r ." is used with two working directory parents.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4208
diff changeset
    77
hg log -r .
e0bc2c575044 Issue a warning if "-r ." is used with two working directory parents.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4208
diff changeset
    78
2780
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    79
hg ci -mm12 -d '1 0'
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    80
4510
e0bc2c575044 Issue a warning if "-r ." is used with two working directory parents.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4208
diff changeset
    81
echo % log -r .  with one parent
e0bc2c575044 Issue a warning if "-r ." is used with two working directory parents.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4208
diff changeset
    82
hg log -r .
e0bc2c575044 Issue a warning if "-r ." is used with two working directory parents.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4208
diff changeset
    83
2780
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    84
echo postm >> b1
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    85
hg ci -Amb1.1 -d'1 0'
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    86
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    87
echo % log --follow-first
e7f70588af30 Test suite for log --follow and --follow-first.
Brendan Cully <brendan@kublai.com>
parents: 2741
diff changeset
    88
hg log --follow-first
2886
9826af4841ef Test for log --prune.
Brendan Cully <brendan@kublai.com>
parents: 2780
diff changeset
    89
9826af4841ef Test for log --prune.
Brendan Cully <brendan@kublai.com>
parents: 2780
diff changeset
    90
echo % log -P 2
9826af4841ef Test for log --prune.
Brendan Cully <brendan@kublai.com>
parents: 2780
diff changeset
    91
hg log -P 2
3718
7db88b094b14 fix hg log -r ''
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3382
diff changeset
    92
7db88b094b14 fix hg log -r ''
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3382
diff changeset
    93
echo '% log -r ""'
7db88b094b14 fix hg log -r ''
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3382
diff changeset
    94
hg log -r ''
7db88b094b14 fix hg log -r ''
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3382
diff changeset
    95
7db88b094b14 fix hg log -r ''
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3382
diff changeset
    96
exit 0