tests/test-up-local-change
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
Thu, 04 Oct 2007 23:21:37 -0300
changeset 5378 8a2915f57dfc
parent 4659 7a7d4937272b
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:
544
3d4d5f2aba9a Remove bashisms and use /bin/sh instead of /bin/bash.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 485
diff changeset
     1
#!/bin/sh
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
     2
4361
46280c004f22 change tests to use simplemerge by default
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3192
diff changeset
     3
HGMERGE=true; export HGMERGE
46280c004f22 change tests to use simplemerge by default
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3192
diff changeset
     4
800
ec85f9e6f3b1 Don't use 'set -x', fix exports, sed and hexdump usage for Solaris.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
     5
set -e
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
     6
mkdir r1
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
     7
cd r1
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
     8
hg init
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
     9
echo a > a
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    10
hg addremove
1933
7544700fd931 Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1674
diff changeset
    11
hg commit -m "1" -d "1000000 0"
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    12
485
c5705ab9cebd [PATCH] add clone command
mpm@selenic.com
parents: 350
diff changeset
    13
hg clone . ../r2
c5705ab9cebd [PATCH] add clone command
mpm@selenic.com
parents: 350
diff changeset
    14
cd ../r2
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    15
hg up
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    16
echo abc > a
3192
096f1c73cdc3 Add -D/--nodates options to hg diff/export that removes dates from diff headers
Stephen Darnell <stephen@darnell.plus.com>
parents: 2283
diff changeset
    17
hg diff --nodates
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    18
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    19
cd ../r1
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    20
echo b > b
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    21
echo a2 > a
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    22
hg addremove
1933
7544700fd931 Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1674
diff changeset
    23
hg commit -m "2" -d "1000000 0"
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    24
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    25
cd ../r2
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    26
hg -q pull ../r1
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    27
hg status
1674
dee55c4a4963 abort when using 'update -m' and this is not a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1581
diff changeset
    28
hg parents
591
eb46971fc57f options: kill -d for debug
mpm@selenic.com
parents: 547
diff changeset
    29
hg --debug up
1674
dee55c4a4963 abort when using 'update -m' and this is not a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1581
diff changeset
    30
hg parents
dee55c4a4963 abort when using 'update -m' and this is not a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1581
diff changeset
    31
hg --debug up 0
dee55c4a4963 abort when using 'update -m' and this is not a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1581
diff changeset
    32
hg parents
2283
e506c14382fd deprecate 'update -m'. use 'merge' instead.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2065
diff changeset
    33
hg --debug merge || echo failed
1674
dee55c4a4963 abort when using 'update -m' and this is not a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1581
diff changeset
    34
hg parents
dee55c4a4963 abort when using 'update -m' and this is not a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1581
diff changeset
    35
hg --debug up
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    36
hg parents
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    37
hg -v history
3192
096f1c73cdc3 Add -D/--nodates options to hg diff/export that removes dates from diff headers
Stephen Darnell <stephen@darnell.plus.com>
parents: 2283
diff changeset
    38
hg diff --nodates
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    39
1674
dee55c4a4963 abort when using 'update -m' and this is not a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1581
diff changeset
    40
# create a second head
dee55c4a4963 abort when using 'update -m' and this is not a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1581
diff changeset
    41
cd ../r1
dee55c4a4963 abort when using 'update -m' and this is not a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1581
diff changeset
    42
hg up 0
dee55c4a4963 abort when using 'update -m' and this is not a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1581
diff changeset
    43
echo b2 > b
dee55c4a4963 abort when using 'update -m' and this is not a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1581
diff changeset
    44
echo a3 > a
dee55c4a4963 abort when using 'update -m' and this is not a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1581
diff changeset
    45
hg addremove
1933
7544700fd931 Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1674
diff changeset
    46
hg commit -m "3" -d "1000000 0"
1674
dee55c4a4963 abort when using 'update -m' and this is not a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1581
diff changeset
    47
dee55c4a4963 abort when using 'update -m' and this is not a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1581
diff changeset
    48
cd ../r2
dee55c4a4963 abort when using 'update -m' and this is not a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1581
diff changeset
    49
hg -q pull ../r1
dee55c4a4963 abort when using 'update -m' and this is not a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1581
diff changeset
    50
hg status
dee55c4a4963 abort when using 'update -m' and this is not a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1581
diff changeset
    51
hg parents
dee55c4a4963 abort when using 'update -m' and this is not a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1581
diff changeset
    52
hg --debug up || echo failed
2283
e506c14382fd deprecate 'update -m'. use 'merge' instead.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2065
diff changeset
    53
hg --debug merge || echo failed
e506c14382fd deprecate 'update -m'. use 'merge' instead.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2065
diff changeset
    54
hg --debug merge -f
1674
dee55c4a4963 abort when using 'update -m' and this is not a merge
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1581
diff changeset
    55
hg parents
3192
096f1c73cdc3 Add -D/--nodates options to hg diff/export that removes dates from diff headers
Stephen Darnell <stephen@darnell.plus.com>
parents: 2283
diff changeset
    56
hg diff --nodates
2065
2ff37e3bf780 fix update when a locally added file match the target revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    57
2ff37e3bf780 fix update when a locally added file match the target revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    58
# test a local add
2ff37e3bf780 fix update when a locally added file match the target revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    59
cd ..
2ff37e3bf780 fix update when a locally added file match the target revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    60
hg init a
2ff37e3bf780 fix update when a locally added file match the target revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    61
hg init b
2ff37e3bf780 fix update when a locally added file match the target revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    62
echo a > a/a
2ff37e3bf780 fix update when a locally added file match the target revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    63
echo a > b/a
2ff37e3bf780 fix update when a locally added file match the target revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    64
hg --cwd a commit -A -m a
2ff37e3bf780 fix update when a locally added file match the target revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    65
cd b
4659
7a7d4937272b Kill trailing spaces
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4361
diff changeset
    66
hg add a
2065
2ff37e3bf780 fix update when a locally added file match the target revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    67
hg pull -u ../a
2ff37e3bf780 fix update when a locally added file match the target revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    68
hg st