##// END OF EJS Templates
pass repo.root to util.pathto() in preparation for the next patch
pass repo.root to util.pathto() in preparation for the next patch

File last commit:

r3988:9dcf9d45 default
r4229:24c22a3f default
Show More
test-import
101 lines | 2.5 KiB | text/plain | TextLexer
Vadim Gelfer
import: added tests, fixed bugs found by tests and asak.
r2513 #!/bin/sh
hg init a
"Mathieu Clabaut "
Import say a file is not tracked after patching : test case
r2773 mkdir a/d1
mkdir a/d1/d2
Vadim Gelfer
import: added tests, fixed bugs found by tests and asak.
r2513 echo line 1 > a/a
"Mathieu Clabaut "
Import say a file is not tracked after patching : test case
r2773 echo line 1 > a/d1/d2/a
Vadim Gelfer
import: added tests, fixed bugs found by tests and asak.
r2513 hg --cwd a ci -d '0 0' -Ama
echo line 2 >> a/a
hg --cwd a ci -u someone -d '1 0' -m'second change'
echo % import exported patch
hg clone -r0 a b
hg --cwd a export tip > tip.patch
hg --cwd b import ../tip.patch
echo % message should be same
hg --cwd b tip | grep 'second change'
echo % committer should be same
hg --cwd b tip | grep someone
Thomas Arendsen Hein
Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
r3988 rm -r b
Vadim Gelfer
import: added tests, fixed bugs found by tests and asak.
r2513
echo % import of plain diff should fail without message
hg clone -r0 a b
hg --cwd a diff -r0:1 > tip.patch
hg --cwd b import ../tip.patch
Thomas Arendsen Hein
Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
r3988 rm -r b
Vadim Gelfer
import: added tests, fixed bugs found by tests and asak.
r2513
echo % import of plain diff should be ok with message
hg clone -r0 a b
hg --cwd a diff -r0:1 > tip.patch
hg --cwd b import -mpatch ../tip.patch
Thomas Arendsen Hein
Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
r3988 rm -r b
Vadim Gelfer
import: added tests, fixed bugs found by tests and asak.
r2513
echo % import from stdin
hg clone -r0 a b
hg --cwd a export tip | hg --cwd b import -
Thomas Arendsen Hein
Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
r3988 rm -r b
Vadim Gelfer
import: added tests, fixed bugs found by tests and asak.
r2513
echo % override commit message
hg clone -r0 a b
hg --cwd a export tip | hg --cwd b import -m 'override' -
hg --cwd b tip | grep override
Thomas Arendsen Hein
Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
r3988 rm -r b
Vadim Gelfer
import: added tests, fixed bugs found by tests and asak.
r2513
cat > mkmsg.py <<EOF
import email.Message, sys
msg = email.Message.Message()
msg.set_payload('email commit message\n' + open('tip.patch').read())
msg['Subject'] = 'email patch'
msg['From'] = 'email patcher'
sys.stdout.write(msg.as_string())
EOF
echo % plain diff in email, subject, message body
hg clone -r0 a b
hg --cwd a diff -r0:1 > tip.patch
python mkmsg.py > msg.patch
hg --cwd b import ../msg.patch
hg --cwd b tip | grep email
Thomas Arendsen Hein
Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
r3988 rm -r b
Vadim Gelfer
import: added tests, fixed bugs found by tests and asak.
r2513
echo % plain diff in email, no subject, message body
hg clone -r0 a b
grep -v '^Subject:' msg.patch | hg --cwd b import -
Thomas Arendsen Hein
Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
r3988 rm -r b
Vadim Gelfer
import: added tests, fixed bugs found by tests and asak.
r2513
echo % plain diff in email, subject, no message body
hg clone -r0 a b
grep -v '^email ' msg.patch | hg --cwd b import -
Thomas Arendsen Hein
Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
r3988 rm -r b
Vadim Gelfer
import: added tests, fixed bugs found by tests and asak.
r2513
echo % plain diff in email, no subject, no message body, should fail
hg clone -r0 a b
Danek Duvall
Fix some tests for portability.
r2843 egrep -v '^(Subject|email)' msg.patch | hg --cwd b import -
Thomas Arendsen Hein
Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
r3988 rm -r b
Vadim Gelfer
import: added tests, fixed bugs found by tests and asak.
r2513
echo % hg export in email, should use patch header
hg clone -r0 a b
hg --cwd a export tip > tip.patch
python mkmsg.py | hg --cwd b import -
hg --cwd b tip | grep second
Thomas Arendsen Hein
Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
r3988 rm -r b
Vadim Gelfer
import: added tests, fixed bugs found by tests and asak.
r2513
"Mathieu Clabaut "
Import say a file is not tracked after patching : test case
r2773 # bug non regression test
# importing a patch in a subdirectory failed at the commit stage
echo line 2 >> a/d1/d2/a
hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change'
echo % hg import in a subdirectory
hg clone -r0 a b
hg --cwd a export tip | sed -e 's/d1\/d2\///' > tip.patch
Danek Duvall
Fix some tests for portability.
r2843 dir=`pwd`
cd b/d1/d2 2>&1 > /dev/null
"Mathieu Clabaut "
Import say a file is not tracked after patching : test case
r2773 hg import ../../../tip.patch
Danek Duvall
Fix some tests for portability.
r2843 cd $dir
"Mathieu Clabaut "
Import say a file is not tracked after patching : test case
r2773 echo "% message should be 'subdir change'"
hg --cwd b tip | grep 'subdir change'
echo "% committer should be 'someoneelse'"
hg --cwd b tip | grep someoneelse
echo "% should be empty"
hg --cwd b status