Skip to content
Snippets Groups Projects
Commit 2852843947da authored by Nicolas Dumazet's avatar Nicolas Dumazet
Browse files

tests: do not export several times the same patch/diff in test-import

parent 81ecc951f57b
No related branches found
No related tags found
No related merge requests found
...@@ -11,6 +11,12 @@ ...@@ -11,6 +11,12 @@
$ hg --cwd a ci -u someone -d '1 0' -m'second change' $ hg --cwd a ci -u someone -d '1 0' -m'second change'
generate patches for the test
$ hg --cwd a export tip > exported-tip.patch
$ hg --cwd a diff -r0:1 > diffed-tip.patch
import exported patch import exported patch
$ hg clone -r0 a b $ hg clone -r0 a b
...@@ -20,7 +26,6 @@ ...@@ -20,7 +26,6 @@
added 1 changesets with 2 changes to 2 files added 1 changesets with 2 changes to 2 files
updating to branch default updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg --cwd a export tip > tip.patch $ hg --cwd b import ../exported-tip.patch
$ hg --cwd b import ../tip.patch applying ../exported-tip.patch
applying ../tip.patch
...@@ -26,3 +31,3 @@ ...@@ -26,3 +31,3 @@
message should be same message and committer should be same
...@@ -28,3 +33,7 @@ ...@@ -28,3 +33,7 @@
$ hg --cwd b tip | grep 'second change' $ hg --cwd b tip
changeset: 1:1d4bd90af0e4
tag: tip
user: someone
date: Thu Jan 01 00:00:01 1970 +0000
summary: second change summary: second change
...@@ -30,9 +39,5 @@ ...@@ -30,9 +39,5 @@
summary: second change summary: second change
committer should be same
$ hg --cwd b tip | grep someone
user: someone
$ rm -r b $ rm -r b
...@@ -50,9 +55,8 @@ ...@@ -50,9 +55,8 @@
added 1 changesets with 2 changes to 2 files added 1 changesets with 2 changes to 2 files
updating to branch default updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg --cwd a export tip > tip.patch $ hg --config ui.patch='python ../dummypatch.py' --cwd b import ../exported-tip.patch
$ hg --config ui.patch='python ../dummypatch.py' --cwd b import ../tip.patch applying ../exported-tip.patch
applying ../tip.patch
$ cat b/a $ cat b/a
line2 line2
$ rm -r b $ rm -r b
...@@ -67,9 +71,8 @@ ...@@ -67,9 +71,8 @@
added 1 changesets with 2 changes to 2 files added 1 changesets with 2 changes to 2 files
updating to branch default updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg --cwd a diff -r0:1 > tip.patch $ hg --cwd b import ../diffed-tip.patch
$ hg --cwd b import ../tip.patch applying ../diffed-tip.patch
applying ../tip.patch
abort: empty commit message abort: empty commit message
[255] [255]
$ rm -r b $ rm -r b
...@@ -84,9 +87,8 @@ ...@@ -84,9 +87,8 @@
added 1 changesets with 2 changes to 2 files added 1 changesets with 2 changes to 2 files
updating to branch default updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg --cwd a diff -r0:1 > tip.patch $ hg --cwd b import -mpatch ../diffed-tip.patch
$ hg --cwd b import -mpatch ../tip.patch applying ../diffed-tip.patch
applying ../tip.patch
$ rm -r b $ rm -r b
...@@ -99,9 +101,8 @@ ...@@ -99,9 +101,8 @@
added 1 changesets with 2 changes to 2 files added 1 changesets with 2 changes to 2 files
updating to branch default updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg --cwd a diff -r0:1 > tip.patch $ hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../diffed-tip.patch
$ hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../tip.patch applying ../diffed-tip.patch
applying ../tip.patch
$ hg -R b tip -pv $ hg -R b tip -pv
changeset: 1:ca68f19f3a40 changeset: 1:ca68f19f3a40
tag: tip tag: tip
...@@ -131,9 +132,8 @@ ...@@ -131,9 +132,8 @@
added 1 changesets with 2 changes to 2 files added 1 changesets with 2 changes to 2 files
updating to branch default updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg --cwd a diff -r0:1 > tip.patch $ hg --cwd b import --no-commit ../diffed-tip.patch
$ hg --cwd b import --no-commit ../tip.patch applying ../diffed-tip.patch
applying ../tip.patch
$ hg --cwd b diff --nodates $ hg --cwd b diff --nodates
diff -r 80971e65b431 a diff -r 80971e65b431 a
--- a/a --- a/a
...@@ -153,8 +153,7 @@ ...@@ -153,8 +153,7 @@
added 1 changesets with 2 changes to 2 files added 1 changesets with 2 changes to 2 files
updating to branch default updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg --cwd a diff -r0:1 > tip.patch $ sed 's/1,1/foo/' < diffed-tip.patch > broken.patch
$ sed 's/1,1/foo/' < tip.patch > broken.patch
$ hg --cwd b import -mpatch ../broken.patch $ hg --cwd b import -mpatch ../broken.patch
applying ../broken.patch applying ../broken.patch
abort: bad hunk #1 abort: bad hunk #1
...@@ -174,5 +173,4 @@ ...@@ -174,5 +173,4 @@
added 1 changesets with 2 changes to 2 files added 1 changesets with 2 changes to 2 files
updating to branch default updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg --cwd a export tip > dir/tip.patch
$ cd dir $ cd dir
...@@ -178,6 +176,6 @@ ...@@ -178,6 +176,6 @@
$ cd dir $ cd dir
$ hg -R b import tip.patch $ hg -R b import ../exported-tip.patch
applying tip.patch applying ../exported-tip.patch
$ cd .. $ cd ..
$ rm -r dir $ rm -r dir
...@@ -191,7 +189,7 @@ ...@@ -191,7 +189,7 @@
added 1 changesets with 2 changes to 2 files added 1 changesets with 2 changes to 2 files
updating to branch default updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg --cwd a export tip | hg --cwd b import - $ hg --cwd b import - < exported-tip.patch
applying patch from stdin applying patch from stdin
$ rm -r b $ rm -r b
...@@ -218,7 +216,7 @@ ...@@ -218,7 +216,7 @@
added 1 changesets with 2 changes to 2 files added 1 changesets with 2 changes to 2 files
updating to branch default updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg --cwd a export tip | hg --cwd b import -m 'override' - $ hg --cwd b import -m 'override' - < exported-tip.patch
applying patch from stdin applying patch from stdin
$ hg --cwd b tip | grep override $ hg --cwd b tip | grep override
summary: override summary: override
...@@ -227,7 +225,8 @@ ...@@ -227,7 +225,8 @@
$ cat > mkmsg.py <<EOF $ cat > mkmsg.py <<EOF
> import email.Message, sys > import email.Message, sys
> msg = email.Message.Message() > msg = email.Message.Message()
> msg.set_payload('email commit message\n' + open('tip.patch', 'rb').read()) > patch = open(sys.argv[1], 'rb').read()
> msg.set_payload('email commit message\n' + patch)
> msg['Subject'] = 'email patch' > msg['Subject'] = 'email patch'
> msg['From'] = 'email patcher' > msg['From'] = 'email patcher'
> sys.stdout.write(msg.as_string()) > sys.stdout.write(msg.as_string())
...@@ -243,8 +242,7 @@ ...@@ -243,8 +242,7 @@
added 1 changesets with 2 changes to 2 files added 1 changesets with 2 changes to 2 files
updating to branch default updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg --cwd a diff -r0:1 > tip.patch $ python mkmsg.py diffed-tip.patch > msg.patch
$ python mkmsg.py > msg.patch
$ hg --cwd b import ../msg.patch $ hg --cwd b import ../msg.patch
applying ../msg.patch applying ../msg.patch
$ hg --cwd b tip | grep email $ hg --cwd b tip | grep email
...@@ -306,8 +304,7 @@ ...@@ -306,8 +304,7 @@
added 1 changesets with 2 changes to 2 files added 1 changesets with 2 changes to 2 files
updating to branch default updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg --cwd a export tip > tip.patch $ python mkmsg.py exported-tip.patch | hg --cwd b import -
$ python mkmsg.py | hg --cwd b import -
applying patch from stdin applying patch from stdin
$ hg --cwd b tip | grep second $ hg --cwd b tip | grep second
summary: second change summary: second change
...@@ -320,7 +317,8 @@ ...@@ -320,7 +317,8 @@
$ cat > mkmsg2.py <<EOF $ cat > mkmsg2.py <<EOF
> import email.Message, sys > import email.Message, sys
> msg = email.Message.Message() > msg = email.Message.Message()
> msg.set_payload('email patch\n\nnext line\n---\n' + open('tip.patch').read()) > patch = open(sys.argv[1], 'rb').read()
> msg.set_payload('email patch\n\nnext line\n---\n' + patch)
> msg['Subject'] = '[PATCH] email patch' > msg['Subject'] = '[PATCH] email patch'
> msg['From'] = 'email patcher' > msg['From'] = 'email patcher'
> sys.stdout.write(msg.as_string()) > sys.stdout.write(msg.as_string())
...@@ -336,8 +334,7 @@ ...@@ -336,8 +334,7 @@
added 1 changesets with 2 changes to 2 files added 1 changesets with 2 changes to 2 files
updating to branch default updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg --cwd a diff -r0:1 > tip.patch $ python mkmsg2.py diffed-tip.patch | hg --cwd b import -
$ python mkmsg2.py | hg --cwd b import -
applying patch from stdin applying patch from stdin
$ hg --cwd b tip --template '{desc}\n' $ hg --cwd b tip --template '{desc}\n'
email patch email patch
...@@ -386,6 +383,6 @@ ...@@ -386,6 +383,6 @@
updating to branch default updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg --cwd a export tip > tmp $ hg --cwd a export tip > tmp
$ sed -e 's/d1\/d2\///' < tmp > tip.patch $ sed -e 's/d1\/d2\///' < tmp > subdir-tip.patch
$ dir=`pwd` $ dir=`pwd`
$ cd b/d1/d2 2>&1 > /dev/null $ cd b/d1/d2 2>&1 > /dev/null
...@@ -390,7 +387,7 @@ ...@@ -390,7 +387,7 @@
$ dir=`pwd` $ dir=`pwd`
$ cd b/d1/d2 2>&1 > /dev/null $ cd b/d1/d2 2>&1 > /dev/null
$ hg import ../../../tip.patch $ hg import ../../../subdir-tip.patch
applying ../../../tip.patch applying ../../../subdir-tip.patch
$ cd "$dir" $ cd "$dir"
message should be 'subdir change' message should be 'subdir change'
...@@ -394,9 +391,5 @@ ...@@ -394,9 +391,5 @@
$ cd "$dir" $ cd "$dir"
message should be 'subdir change' message should be 'subdir change'
$ hg --cwd b tip | grep 'subdir change'
summary: subdir change
committer should be 'someoneelse' committer should be 'someoneelse'
...@@ -401,4 +394,6 @@ ...@@ -401,4 +394,6 @@
committer should be 'someoneelse' committer should be 'someoneelse'
$ hg --cwd b tip | grep someoneelse $ hg --cwd b tip
changeset: 1:3577f5aea227
tag: tip
user: someoneelse user: someoneelse
...@@ -404,4 +399,7 @@ ...@@ -404,4 +399,7 @@
user: someoneelse user: someoneelse
date: Thu Jan 01 00:00:01 1970 +0000
summary: subdir change
should be empty should be empty
...@@ -422,7 +420,7 @@ ...@@ -422,7 +420,7 @@
$ echo line0 >> a $ echo line0 >> a
$ echo line3 >> a $ echo line3 >> a
$ hg ci -m change a $ hg ci -m change a
$ hg export tip > tip.patch $ hg export tip > fuzzy-tip.patch
$ hg up -C 0 $ hg up -C 0
1 files updated, 0 files merged, 0 files removed, 0 files unresolved 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo line1 > a $ echo line1 > a
...@@ -431,8 +429,8 @@ ...@@ -431,8 +429,8 @@
$ echo line0 >> a $ echo line0 >> a
$ hg ci -m brancha $ hg ci -m brancha
created new head created new head
$ hg import --no-commit -v tip.patch $ hg import --no-commit -v fuzzy-tip.patch
applying tip.patch applying fuzzy-tip.patch
patching file a patching file a
Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines). Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines).
$ hg revert -a $ hg revert -a
...@@ -447,8 +445,8 @@ ...@@ -447,8 +445,8 @@
test fuzziness with eol=auto test fuzziness with eol=auto
$ hg --config patch.eol=auto import --no-commit -v tip.patch $ hg --config patch.eol=auto import --no-commit -v fuzzy-tip.patch
applying tip.patch applying fuzzy-tip.patch
patching file a patching file a
Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines). Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines).
$ cd .. $ cd ..
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment