tests/test-push-warn
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
Thu, 04 Oct 2007 23:21:37 -0300
changeset 5378 8a2915f57dfc
parent 3925 27230c29bfec
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:
816
8674b7803714 Warn on pushing unsynced repo or adding new heads
mpm@selenic.com
parents:
diff changeset
     1
#!/bin/sh
8674b7803714 Warn on pushing unsynced repo or adding new heads
mpm@selenic.com
parents:
diff changeset
     2
8674b7803714 Warn on pushing unsynced repo or adding new heads
mpm@selenic.com
parents:
diff changeset
     3
mkdir a
8674b7803714 Warn on pushing unsynced repo or adding new heads
mpm@selenic.com
parents:
diff changeset
     4
cd a
8674b7803714 Warn on pushing unsynced repo or adding new heads
mpm@selenic.com
parents:
diff changeset
     5
hg init
8674b7803714 Warn on pushing unsynced repo or adding new heads
mpm@selenic.com
parents:
diff changeset
     6
echo foo > t1
8674b7803714 Warn on pushing unsynced repo or adding new heads
mpm@selenic.com
parents:
diff changeset
     7
hg add t1
1933
7544700fd931 Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 839
diff changeset
     8
hg commit -m "1" -d "1000000 0"
816
8674b7803714 Warn on pushing unsynced repo or adding new heads
mpm@selenic.com
parents:
diff changeset
     9
8674b7803714 Warn on pushing unsynced repo or adding new heads
mpm@selenic.com
parents:
diff changeset
    10
cd ..
8674b7803714 Warn on pushing unsynced repo or adding new heads
mpm@selenic.com
parents:
diff changeset
    11
hg clone a b
8674b7803714 Warn on pushing unsynced repo or adding new heads
mpm@selenic.com
parents:
diff changeset
    12
8674b7803714 Warn on pushing unsynced repo or adding new heads
mpm@selenic.com
parents:
diff changeset
    13
cd a
8674b7803714 Warn on pushing unsynced repo or adding new heads
mpm@selenic.com
parents:
diff changeset
    14
echo foo > t2
8674b7803714 Warn on pushing unsynced repo or adding new heads
mpm@selenic.com
parents:
diff changeset
    15
hg add t2
1933
7544700fd931 Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 839
diff changeset
    16
hg commit -m "2" -d "1000000 0"
816
8674b7803714 Warn on pushing unsynced repo or adding new heads
mpm@selenic.com
parents:
diff changeset
    17
8674b7803714 Warn on pushing unsynced repo or adding new heads
mpm@selenic.com
parents:
diff changeset
    18
cd ../b
8674b7803714 Warn on pushing unsynced repo or adding new heads
mpm@selenic.com
parents:
diff changeset
    19
echo foo > t3
8674b7803714 Warn on pushing unsynced repo or adding new heads
mpm@selenic.com
parents:
diff changeset
    20
hg add t3
1933
7544700fd931 Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 839
diff changeset
    21
hg commit -m "3" -d "1000000 0"
816
8674b7803714 Warn on pushing unsynced repo or adding new heads
mpm@selenic.com
parents:
diff changeset
    22
8674b7803714 Warn on pushing unsynced repo or adding new heads
mpm@selenic.com
parents:
diff changeset
    23
hg push ../a
8674b7803714 Warn on pushing unsynced repo or adding new heads
mpm@selenic.com
parents:
diff changeset
    24
hg pull ../a
8674b7803714 Warn on pushing unsynced repo or adding new heads
mpm@selenic.com
parents:
diff changeset
    25
hg push ../a
2283
e506c14382fd deprecate 'update -m'. use 'merge' instead.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2021
diff changeset
    26
hg merge
1933
7544700fd931 Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 839
diff changeset
    27
hg commit -m "4" -d "1000000 0"
816
8674b7803714 Warn on pushing unsynced repo or adding new heads
mpm@selenic.com
parents:
diff changeset
    28
hg push ../a
2021
fc22ed56afe3 Fix hg push and hg push -r sometimes creating new heads without --force.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
    29
cd ..
fc22ed56afe3 Fix hg push and hg push -r sometimes creating new heads without --force.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
    30
fc22ed56afe3 Fix hg push and hg push -r sometimes creating new heads without --force.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
    31
hg init c
fc22ed56afe3 Fix hg push and hg push -r sometimes creating new heads without --force.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
    32
cd c
fc22ed56afe3 Fix hg push and hg push -r sometimes creating new heads without --force.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
    33
for i in 0 1 2; do
fc22ed56afe3 Fix hg push and hg push -r sometimes creating new heads without --force.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
    34
    echo $i >> foo
fc22ed56afe3 Fix hg push and hg push -r sometimes creating new heads without --force.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
    35
    hg ci -Am $i -d "1000000 0"
fc22ed56afe3 Fix hg push and hg push -r sometimes creating new heads without --force.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
    36
done
fc22ed56afe3 Fix hg push and hg push -r sometimes creating new heads without --force.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
    37
cd ..
fc22ed56afe3 Fix hg push and hg push -r sometimes creating new heads without --force.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
    38
fc22ed56afe3 Fix hg push and hg push -r sometimes creating new heads without --force.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
    39
hg clone c d
fc22ed56afe3 Fix hg push and hg push -r sometimes creating new heads without --force.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
    40
cd d
fc22ed56afe3 Fix hg push and hg push -r sometimes creating new heads without --force.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
    41
for i in 0 1; do
fc22ed56afe3 Fix hg push and hg push -r sometimes creating new heads without --force.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
    42
    hg co -C $i
fc22ed56afe3 Fix hg push and hg push -r sometimes creating new heads without --force.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
    43
    echo d-$i >> foo
fc22ed56afe3 Fix hg push and hg push -r sometimes creating new heads without --force.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
    44
    hg ci -m d-$i -d "1000000 0"
fc22ed56afe3 Fix hg push and hg push -r sometimes creating new heads without --force.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
    45
done
fc22ed56afe3 Fix hg push and hg push -r sometimes creating new heads without --force.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
    46
2283
e506c14382fd deprecate 'update -m'. use 'merge' instead.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2021
diff changeset
    47
HGMERGE=true hg merge 3
2021
fc22ed56afe3 Fix hg push and hg push -r sometimes creating new heads without --force.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
    48
hg ci -m c-d -d "1000000 0"
fc22ed56afe3 Fix hg push and hg push -r sometimes creating new heads without --force.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
    49
3797
2aef481ac73c Don't report an error when closing heads during local push (issue387)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3684
diff changeset
    50
hg push ../c; echo $?
2aef481ac73c Don't report an error when closing heads during local push (issue387)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3684
diff changeset
    51
hg push -r 2 ../c; echo $?
2aef481ac73c Don't report an error when closing heads during local push (issue387)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3684
diff changeset
    52
hg push -r 3 ../c; echo $?
2aef481ac73c Don't report an error when closing heads during local push (issue387)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3684
diff changeset
    53
hg push -r 3 -r 4 ../c; echo $?
2aef481ac73c Don't report an error when closing heads during local push (issue387)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3684
diff changeset
    54
hg push -f -r 3 -r 4 ../c; echo $?
2aef481ac73c Don't report an error when closing heads during local push (issue387)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3684
diff changeset
    55
hg push -r 5 ../c; echo $?
2021
fc22ed56afe3 Fix hg push and hg push -r sometimes creating new heads without --force.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
    56
3925
27230c29bfec fix calculation of new heads added during push with -r
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3797
diff changeset
    57
# issue 450
27230c29bfec fix calculation of new heads added during push with -r
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3797
diff changeset
    58
hg init ../e
27230c29bfec fix calculation of new heads added during push with -r
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3797
diff changeset
    59
hg push -r 0 ../e ; echo $?
27230c29bfec fix calculation of new heads added during push with -r
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3797
diff changeset
    60
hg push -r 1 ../e ; echo $?
27230c29bfec fix calculation of new heads added during push with -r
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3797
diff changeset
    61
2021
fc22ed56afe3 Fix hg push and hg push -r sometimes creating new heads without --force.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
    62
exit 0