tests/test-mq-safety
author Patrick Mezard <pmezard@gmail.com>
Wed, 22 Sep 2010 23:51:10 +0200
branchstable
changeset 12378 ab237534d800
parent 10362 2e3ec7ef5349
permissions -rwxr-xr-x
mq: always require --force when pushing patches (issue2363) --force was not necessary when passing --rev since 55578a8d7e84, but this behaviour is usually harmful when branch names are passed instead of explicit revisions.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5980
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     1
#!/bin/sh
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     2
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     3
echo '[extensions]' >> $HGRCPATH
10119
bb5ea66789e3 tests: load with "ext =" instead of "hgext.ext ="
Martin Geisler <mg@lazybytes.net>
parents: 8523
diff changeset
     4
echo 'mq =' >> $HGRCPATH
5980
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     5
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     6
hg init repo
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     7
cd repo
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     8
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     9
echo foo > foo
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    10
hg ci -qAm 'add a file'
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    11
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    12
hg qinit
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    13
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    14
hg qnew foo
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    15
echo foo >> foo
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    16
hg qrefresh -m 'append foo'
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    17
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    18
hg qnew bar
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    19
echo bar >> foo
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    20
hg qrefresh -m 'append bar'
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    21
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    22
echo '% try to commit on top of a patch'
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    23
echo quux >> foo
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    24
hg ci -m 'append quux'
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    25
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    26
# cheat a bit...
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    27
mv .hg/patches .hg/patches2
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    28
hg ci -m 'append quux'
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    29
mv .hg/patches2 .hg/patches
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    30
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    31
echo '% qpop/qrefresh on the wrong revision'
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    32
hg qpop
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    33
hg qpop -n patches 2>&1 | sed -e 's/\(using patch queue:\).*/\1/'
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    34
hg qrefresh
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    35
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    36
hg up -C qtip
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    37
echo '% qpop'
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    38
hg qpop
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    39
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    40
echo '% qrefresh'
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    41
hg qrefresh
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    42
dcda0c90125c mq: pop/refresh: avoid losing revisions not managed by mq
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    43
echo '% tip:'
8523
5b7da468531b tests: replace #...# syntax with {...}
Martin Geisler <mg@lazybytes.net>
parents: 5980
diff changeset
    44
hg tip --template '{rev} {desc}\n'
10362
2e3ec7ef5349 mq: don't warn on qpush against a branch head
Dirkjan Ochtman <djc.ochtman@kentyde.com>
parents: 10119
diff changeset
    45
2e3ec7ef5349 mq: don't warn on qpush against a branch head
Dirkjan Ochtman <djc.ochtman@kentyde.com>
parents: 10119
diff changeset
    46
echo '% qpush warning branchheads'
2e3ec7ef5349 mq: don't warn on qpush against a branch head
Dirkjan Ochtman <djc.ochtman@kentyde.com>
parents: 10119
diff changeset
    47
cd ..
2e3ec7ef5349 mq: don't warn on qpush against a branch head
Dirkjan Ochtman <djc.ochtman@kentyde.com>
parents: 10119
diff changeset
    48
hg init branchy
2e3ec7ef5349 mq: don't warn on qpush against a branch head
Dirkjan Ochtman <djc.ochtman@kentyde.com>
parents: 10119
diff changeset
    49
cd branchy
2e3ec7ef5349 mq: don't warn on qpush against a branch head
Dirkjan Ochtman <djc.ochtman@kentyde.com>
parents: 10119
diff changeset
    50
echo q > q
2e3ec7ef5349 mq: don't warn on qpush against a branch head
Dirkjan Ochtman <djc.ochtman@kentyde.com>
parents: 10119
diff changeset
    51
hg add q
2e3ec7ef5349 mq: don't warn on qpush against a branch head
Dirkjan Ochtman <djc.ochtman@kentyde.com>
parents: 10119
diff changeset
    52
hg qnew -f qp
2e3ec7ef5349 mq: don't warn on qpush against a branch head
Dirkjan Ochtman <djc.ochtman@kentyde.com>
parents: 10119
diff changeset
    53
hg qpop
2e3ec7ef5349 mq: don't warn on qpush against a branch head
Dirkjan Ochtman <djc.ochtman@kentyde.com>
parents: 10119
diff changeset
    54
echo a > a
2e3ec7ef5349 mq: don't warn on qpush against a branch head
Dirkjan Ochtman <djc.ochtman@kentyde.com>
parents: 10119
diff changeset
    55
hg ci -Ama
2e3ec7ef5349 mq: don't warn on qpush against a branch head
Dirkjan Ochtman <djc.ochtman@kentyde.com>
parents: 10119
diff changeset
    56
hg up null
2e3ec7ef5349 mq: don't warn on qpush against a branch head
Dirkjan Ochtman <djc.ochtman@kentyde.com>
parents: 10119
diff changeset
    57
hg branch b
2e3ec7ef5349 mq: don't warn on qpush against a branch head
Dirkjan Ochtman <djc.ochtman@kentyde.com>
parents: 10119
diff changeset
    58
echo c > c
2e3ec7ef5349 mq: don't warn on qpush against a branch head
Dirkjan Ochtman <djc.ochtman@kentyde.com>
parents: 10119
diff changeset
    59
hg ci -Amc
2e3ec7ef5349 mq: don't warn on qpush against a branch head
Dirkjan Ochtman <djc.ochtman@kentyde.com>
parents: 10119
diff changeset
    60
hg merge default
2e3ec7ef5349 mq: don't warn on qpush against a branch head
Dirkjan Ochtman <djc.ochtman@kentyde.com>
parents: 10119
diff changeset
    61
hg ci -mmerge
2e3ec7ef5349 mq: don't warn on qpush against a branch head
Dirkjan Ochtman <djc.ochtman@kentyde.com>
parents: 10119
diff changeset
    62
hg up default
2e3ec7ef5349 mq: don't warn on qpush against a branch head
Dirkjan Ochtman <djc.ochtman@kentyde.com>
parents: 10119
diff changeset
    63
hg log
2e3ec7ef5349 mq: don't warn on qpush against a branch head
Dirkjan Ochtman <djc.ochtman@kentyde.com>
parents: 10119
diff changeset
    64
hg qpush
12378
ab237534d800 mq: always require --force when pushing patches (issue2363)
Patrick Mezard <pmezard@gmail.com>
parents: 10362
diff changeset
    65
cd ..
ab237534d800 mq: always require --force when pushing patches (issue2363)
Patrick Mezard <pmezard@gmail.com>
parents: 10362
diff changeset
    66
ab237534d800 mq: always require --force when pushing patches (issue2363)
Patrick Mezard <pmezard@gmail.com>
parents: 10362
diff changeset
    67
echo '% testing applied patches, push and --force'
ab237534d800 mq: always require --force when pushing patches (issue2363)
Patrick Mezard <pmezard@gmail.com>
parents: 10362
diff changeset
    68
hg init forcepush
ab237534d800 mq: always require --force when pushing patches (issue2363)
Patrick Mezard <pmezard@gmail.com>
parents: 10362
diff changeset
    69
cd forcepush
ab237534d800 mq: always require --force when pushing patches (issue2363)
Patrick Mezard <pmezard@gmail.com>
parents: 10362
diff changeset
    70
echo a > a
ab237534d800 mq: always require --force when pushing patches (issue2363)
Patrick Mezard <pmezard@gmail.com>
parents: 10362
diff changeset
    71
hg ci -Am adda
ab237534d800 mq: always require --force when pushing patches (issue2363)
Patrick Mezard <pmezard@gmail.com>
parents: 10362
diff changeset
    72
echo a >> a
ab237534d800 mq: always require --force when pushing patches (issue2363)
Patrick Mezard <pmezard@gmail.com>
parents: 10362
diff changeset
    73
hg ci -m changea
ab237534d800 mq: always require --force when pushing patches (issue2363)
Patrick Mezard <pmezard@gmail.com>
parents: 10362
diff changeset
    74
hg up 0
ab237534d800 mq: always require --force when pushing patches (issue2363)
Patrick Mezard <pmezard@gmail.com>
parents: 10362
diff changeset
    75
hg branch branch
ab237534d800 mq: always require --force when pushing patches (issue2363)
Patrick Mezard <pmezard@gmail.com>
parents: 10362
diff changeset
    76
echo b > b
ab237534d800 mq: always require --force when pushing patches (issue2363)
Patrick Mezard <pmezard@gmail.com>
parents: 10362
diff changeset
    77
hg ci -Am addb
ab237534d800 mq: always require --force when pushing patches (issue2363)
Patrick Mezard <pmezard@gmail.com>
parents: 10362
diff changeset
    78
hg up 0
ab237534d800 mq: always require --force when pushing patches (issue2363)
Patrick Mezard <pmezard@gmail.com>
parents: 10362
diff changeset
    79
hg --cwd .. clone -r 0 forcepush forcepush2
ab237534d800 mq: always require --force when pushing patches (issue2363)
Patrick Mezard <pmezard@gmail.com>
parents: 10362
diff changeset
    80
echo a >> a
ab237534d800 mq: always require --force when pushing patches (issue2363)
Patrick Mezard <pmezard@gmail.com>
parents: 10362
diff changeset
    81
hg qnew patch
ab237534d800 mq: always require --force when pushing patches (issue2363)
Patrick Mezard <pmezard@gmail.com>
parents: 10362
diff changeset
    82
echo '% pushing applied patch with --rev without --force'
ab237534d800 mq: always require --force when pushing patches (issue2363)
Patrick Mezard <pmezard@gmail.com>
parents: 10362
diff changeset
    83
hg push -r default ../forcepush2
ab237534d800 mq: always require --force when pushing patches (issue2363)
Patrick Mezard <pmezard@gmail.com>
parents: 10362
diff changeset
    84
echo '% pushing applied patch with branchhash, without --force'
ab237534d800 mq: always require --force when pushing patches (issue2363)
Patrick Mezard <pmezard@gmail.com>
parents: 10362
diff changeset
    85
hg push ../forcepush2#default
ab237534d800 mq: always require --force when pushing patches (issue2363)
Patrick Mezard <pmezard@gmail.com>
parents: 10362
diff changeset
    86
echo '% pushing revs excluding applied patch'
ab237534d800 mq: always require --force when pushing patches (issue2363)
Patrick Mezard <pmezard@gmail.com>
parents: 10362
diff changeset
    87
hg push --new-branch -r branch -r 2 ../forcepush2
ab237534d800 mq: always require --force when pushing patches (issue2363)
Patrick Mezard <pmezard@gmail.com>
parents: 10362
diff changeset
    88
echo '% pushing applied patch with --force'
ab237534d800 mq: always require --force when pushing patches (issue2363)
Patrick Mezard <pmezard@gmail.com>
parents: 10362
diff changeset
    89
hg push --force -r default ../forcepush2
ab237534d800 mq: always require --force when pushing patches (issue2363)
Patrick Mezard <pmezard@gmail.com>
parents: 10362
diff changeset
    90
cd ..