tests/test-import
changeset 3988 9dcf9d45cab8
parent 2843 0b9ac7dfcf56
child 4230 c93562fb12cc
equal deleted inserted replaced
3987:c6f10448278f 3988:9dcf9d45cab8
    16 hg --cwd b import ../tip.patch
    16 hg --cwd b import ../tip.patch
    17 echo % message should be same
    17 echo % message should be same
    18 hg --cwd b tip | grep 'second change'
    18 hg --cwd b tip | grep 'second change'
    19 echo % committer should be same
    19 echo % committer should be same
    20 hg --cwd b tip | grep someone
    20 hg --cwd b tip | grep someone
    21 rm -rf b
    21 rm -r b
    22 
    22 
    23 echo % import of plain diff should fail without message
    23 echo % import of plain diff should fail without message
    24 hg clone -r0 a b
    24 hg clone -r0 a b
    25 hg --cwd a diff -r0:1 > tip.patch
    25 hg --cwd a diff -r0:1 > tip.patch
    26 hg --cwd b import ../tip.patch
    26 hg --cwd b import ../tip.patch
    27 rm -rf b
    27 rm -r b
    28 
    28 
    29 echo % import of plain diff should be ok with message
    29 echo % import of plain diff should be ok with message
    30 hg clone -r0 a b
    30 hg clone -r0 a b
    31 hg --cwd a diff -r0:1 > tip.patch
    31 hg --cwd a diff -r0:1 > tip.patch
    32 hg --cwd b import -mpatch ../tip.patch
    32 hg --cwd b import -mpatch ../tip.patch
    33 rm -rf b
    33 rm -r b
    34 
    34 
    35 echo % import from stdin
    35 echo % import from stdin
    36 hg clone -r0 a b
    36 hg clone -r0 a b
    37 hg --cwd a export tip | hg --cwd b import -
    37 hg --cwd a export tip | hg --cwd b import -
    38 rm -rf b
    38 rm -r b
    39 
    39 
    40 echo % override commit message
    40 echo % override commit message
    41 hg clone -r0 a b
    41 hg clone -r0 a b
    42 hg --cwd a export tip | hg --cwd b import -m 'override' -
    42 hg --cwd a export tip | hg --cwd b import -m 'override' -
    43 hg --cwd b tip | grep override
    43 hg --cwd b tip | grep override
    44 rm -rf b
    44 rm -r b
    45 
    45 
    46 cat > mkmsg.py <<EOF
    46 cat > mkmsg.py <<EOF
    47 import email.Message, sys
    47 import email.Message, sys
    48 msg = email.Message.Message()
    48 msg = email.Message.Message()
    49 msg.set_payload('email commit message\n' + open('tip.patch').read())
    49 msg.set_payload('email commit message\n' + open('tip.patch').read())
    56 hg clone -r0 a b
    56 hg clone -r0 a b
    57 hg --cwd a diff -r0:1 > tip.patch
    57 hg --cwd a diff -r0:1 > tip.patch
    58 python mkmsg.py > msg.patch
    58 python mkmsg.py > msg.patch
    59 hg --cwd b import ../msg.patch
    59 hg --cwd b import ../msg.patch
    60 hg --cwd b tip | grep email
    60 hg --cwd b tip | grep email
    61 rm -rf b
    61 rm -r b
    62 
    62 
    63 echo % plain diff in email, no subject, message body
    63 echo % plain diff in email, no subject, message body
    64 hg clone -r0 a b
    64 hg clone -r0 a b
    65 grep -v '^Subject:' msg.patch | hg --cwd b import -
    65 grep -v '^Subject:' msg.patch | hg --cwd b import -
    66 rm -rf b
    66 rm -r b
    67 
    67 
    68 echo % plain diff in email, subject, no message body
    68 echo % plain diff in email, subject, no message body
    69 hg clone -r0 a b
    69 hg clone -r0 a b
    70 grep -v '^email ' msg.patch | hg --cwd b import -
    70 grep -v '^email ' msg.patch | hg --cwd b import -
    71 rm -rf b
    71 rm -r b
    72 
    72 
    73 echo % plain diff in email, no subject, no message body, should fail
    73 echo % plain diff in email, no subject, no message body, should fail
    74 hg clone -r0 a b
    74 hg clone -r0 a b
    75 egrep -v '^(Subject|email)' msg.patch | hg --cwd b import -
    75 egrep -v '^(Subject|email)' msg.patch | hg --cwd b import -
    76 rm -rf b
    76 rm -r b
    77 
    77 
    78 echo % hg export in email, should use patch header
    78 echo % hg export in email, should use patch header
    79 hg clone -r0 a b
    79 hg clone -r0 a b
    80 hg --cwd a export tip > tip.patch
    80 hg --cwd a export tip > tip.patch
    81 python mkmsg.py | hg --cwd b import -
    81 python mkmsg.py | hg --cwd b import -
    82 hg --cwd b tip | grep second
    82 hg --cwd b tip | grep second
    83 rm -rf b
    83 rm -r b
    84 
    84 
    85 # bug non regression test
    85 # bug non regression test
    86 # importing a patch in a subdirectory failed at the commit stage
    86 # importing a patch in a subdirectory failed at the commit stage
    87 echo line 2 >> a/d1/d2/a
    87 echo line 2 >> a/d1/d2/a
    88 hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change'
    88 hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change'