tests/test-mq-merge
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
Fri, 19 Feb 2010 02:23:38 +0100
branchstable
changeset 10510 f77f3383c666
parent 10190 9c2c94934f0d
child 10775 c52057614c72
permissions -rwxr-xr-x
i18n: mark more strings for translation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4333
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     2
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     3
# Test issue 529 - mq aborts when merging patch deleting files
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     4
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     5
rewrite_path()
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     6
{
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     7
    sed -e 's:\\:/:g' -e 's:[^ ]*/t/::g'
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     8
}
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     9
5527
0b3f910dfd17 mq: really remove undo after a qpush (and after a strip)
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4437
diff changeset
    10
checkundo()
0b3f910dfd17 mq: really remove undo after a qpush (and after a strip)
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4437
diff changeset
    11
{
0b3f910dfd17 mq: really remove undo after a qpush (and after a strip)
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4437
diff changeset
    12
    if [ -f .hg/store/undo ]; then
0b3f910dfd17 mq: really remove undo after a qpush (and after a strip)
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4437
diff changeset
    13
	echo ".hg/store/undo still exists after $1"
0b3f910dfd17 mq: really remove undo after a qpush (and after a strip)
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4437
diff changeset
    14
    fi
0b3f910dfd17 mq: really remove undo after a qpush (and after a strip)
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4437
diff changeset
    15
}
0b3f910dfd17 mq: really remove undo after a qpush (and after a strip)
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4437
diff changeset
    16
4333
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    17
echo "[extensions]" >> $HGRCPATH
10119
bb5ea66789e3 tests: load with "ext =" instead of "hgext.ext ="
Martin Geisler <mg@lazybytes.net>
parents: 6628
diff changeset
    18
echo "mq =" >> $HGRCPATH
10190
9c2c94934f0d mq: upgrade to git patch when necessary (issue767)
Patrick Mezard <pmezard@gmail.com>
parents: 10188
diff changeset
    19
echo "[mq]" >> $HGRCPATH
9c2c94934f0d mq: upgrade to git patch when necessary (issue767)
Patrick Mezard <pmezard@gmail.com>
parents: 10188
diff changeset
    20
echo "git = keep" >> $HGRCPATH
4333
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    21
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    22
# Commit two dummy files in "init" changeset
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    23
hg init t
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    24
cd t
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    25
echo a > a
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    26
echo b > b
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    27
hg ci -Am init
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    28
hg tag -l init
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    29
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    30
# Create a patch removing a
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    31
hg qnew rm_a
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    32
hg rm a
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    33
hg qrefresh -m "rm a"
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    34
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    35
# Save the patch queue so we can merge it later
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    36
hg qsave -c -e 2>&1 | rewrite_path
5527
0b3f910dfd17 mq: really remove undo after a qpush (and after a strip)
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4437
diff changeset
    37
checkundo qsave
4333
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    38
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    39
# Update b and commit in an "update" changeset
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    40
hg up -C init
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    41
echo b >> b
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    42
hg st
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    43
hg ci -m update
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    44
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    45
# Here, qpush used to abort with :
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    46
# The system cannot find the file specified => a
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    47
hg manifest
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    48
hg qpush -a -m 2>&1 | rewrite_path
5527
0b3f910dfd17 mq: really remove undo after a qpush (and after a strip)
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4437
diff changeset
    49
checkundo 'qpush -m'
4333
4f721e96f1de Add test for issue 529 - "mq aborts when merging patch deleting files".
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    50
hg manifest
4437
a210b40d0860 Make mergepatch save queue now that qpush isn't.
Brendan Cully <brendan@kublai.com>
parents: 4333
diff changeset
    51
a210b40d0860 Make mergepatch save queue now that qpush isn't.
Brendan Cully <brendan@kublai.com>
parents: 4333
diff changeset
    52
# ensure status is correct after merge
a210b40d0860 Make mergepatch save queue now that qpush isn't.
Brendan Cully <brendan@kublai.com>
parents: 4333
diff changeset
    53
hg qpop -a
6628
f18f14bae172 test-mq-merge: test mq merge and explicit patch queue
Patrick Mezard <pmezard@gmail.com>
parents: 5527
diff changeset
    54
cd ..
f18f14bae172 test-mq-merge: test mq merge and explicit patch queue
Patrick Mezard <pmezard@gmail.com>
parents: 5527
diff changeset
    55
f18f14bae172 test-mq-merge: test mq merge and explicit patch queue
Patrick Mezard <pmezard@gmail.com>
parents: 5527
diff changeset
    56
# Classic MQ merge sequence *with an explicit named queue*
f18f14bae172 test-mq-merge: test mq merge and explicit patch queue
Patrick Mezard <pmezard@gmail.com>
parents: 5527
diff changeset
    57
echo
f18f14bae172 test-mq-merge: test mq merge and explicit patch queue
Patrick Mezard <pmezard@gmail.com>
parents: 5527
diff changeset
    58
echo % init t2
f18f14bae172 test-mq-merge: test mq merge and explicit patch queue
Patrick Mezard <pmezard@gmail.com>
parents: 5527
diff changeset
    59
hg init t2
f18f14bae172 test-mq-merge: test mq merge and explicit patch queue
Patrick Mezard <pmezard@gmail.com>
parents: 5527
diff changeset
    60
cd t2
10185
7637fe4f525d mq: preserve --git flag when merging patches
Patrick Mezard <pmezard@gmail.com>
parents: 6628
diff changeset
    61
echo '[diff]' > .hg/hgrc
7637fe4f525d mq: preserve --git flag when merging patches
Patrick Mezard <pmezard@gmail.com>
parents: 6628
diff changeset
    62
echo 'nodates = 1' >> .hg/hgrc
6628
f18f14bae172 test-mq-merge: test mq merge and explicit patch queue
Patrick Mezard <pmezard@gmail.com>
parents: 5527
diff changeset
    63
echo a > a
f18f14bae172 test-mq-merge: test mq merge and explicit patch queue
Patrick Mezard <pmezard@gmail.com>
parents: 5527
diff changeset
    64
hg ci -Am init
10185
7637fe4f525d mq: preserve --git flag when merging patches
Patrick Mezard <pmezard@gmail.com>
parents: 6628
diff changeset
    65
echo b > a
6628
f18f14bae172 test-mq-merge: test mq merge and explicit patch queue
Patrick Mezard <pmezard@gmail.com>
parents: 5527
diff changeset
    66
hg ci -m changea
f18f14bae172 test-mq-merge: test mq merge and explicit patch queue
Patrick Mezard <pmezard@gmail.com>
parents: 5527
diff changeset
    67
hg up -C 0
10185
7637fe4f525d mq: preserve --git flag when merging patches
Patrick Mezard <pmezard@gmail.com>
parents: 6628
diff changeset
    68
hg cp a aa
6628
f18f14bae172 test-mq-merge: test mq merge and explicit patch queue
Patrick Mezard <pmezard@gmail.com>
parents: 5527
diff changeset
    69
echo c >> a
10185
7637fe4f525d mq: preserve --git flag when merging patches
Patrick Mezard <pmezard@gmail.com>
parents: 6628
diff changeset
    70
hg qnew --git -f -e patcha
7637fe4f525d mq: preserve --git flag when merging patches
Patrick Mezard <pmezard@gmail.com>
parents: 6628
diff changeset
    71
echo d >> a
7637fe4f525d mq: preserve --git flag when merging patches
Patrick Mezard <pmezard@gmail.com>
parents: 6628
diff changeset
    72
hg qnew -d '0 0' -f -e patcha2
6628
f18f14bae172 test-mq-merge: test mq merge and explicit patch queue
Patrick Mezard <pmezard@gmail.com>
parents: 5527
diff changeset
    73
echo % create the reference queue
f18f14bae172 test-mq-merge: test mq merge and explicit patch queue
Patrick Mezard <pmezard@gmail.com>
parents: 5527
diff changeset
    74
hg qsave -c -e -n refqueue 2> /dev/null
f18f14bae172 test-mq-merge: test mq merge and explicit patch queue
Patrick Mezard <pmezard@gmail.com>
parents: 5527
diff changeset
    75
hg up -C 1
f18f14bae172 test-mq-merge: test mq merge and explicit patch queue
Patrick Mezard <pmezard@gmail.com>
parents: 5527
diff changeset
    76
echo % merge
10185
7637fe4f525d mq: preserve --git flag when merging patches
Patrick Mezard <pmezard@gmail.com>
parents: 6628
diff changeset
    77
HGMERGE=internal:other hg qpush -a -m -n refqueue 2>&1 | \
6628
f18f14bae172 test-mq-merge: test mq merge and explicit patch queue
Patrick Mezard <pmezard@gmail.com>
parents: 5527
diff changeset
    78
    sed 's/merging with queue at.*refqueue/merging with queue at refqueue/'
10185
7637fe4f525d mq: preserve --git flag when merging patches
Patrick Mezard <pmezard@gmail.com>
parents: 6628
diff changeset
    79
echo % check patcha is still a git patch
7637fe4f525d mq: preserve --git flag when merging patches
Patrick Mezard <pmezard@gmail.com>
parents: 6628
diff changeset
    80
cat .hg/patches/patcha
7637fe4f525d mq: preserve --git flag when merging patches
Patrick Mezard <pmezard@gmail.com>
parents: 6628
diff changeset
    81
echo % check patcha2 is still a regular patch
7637fe4f525d mq: preserve --git flag when merging patches
Patrick Mezard <pmezard@gmail.com>
parents: 6628
diff changeset
    82
grep git .hg/patches/patcha2 && echo 'git patch found!'
6628
f18f14bae172 test-mq-merge: test mq merge and explicit patch queue
Patrick Mezard <pmezard@gmail.com>
parents: 5527
diff changeset
    83
cd ..
f18f14bae172 test-mq-merge: test mq merge and explicit patch queue
Patrick Mezard <pmezard@gmail.com>
parents: 5527
diff changeset
    84