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

tests: unify test-transplant

parent ddebb6a6
No related branches found
No related tags found
No related merge requests found
adding r1
adding r2
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
adding b1
created new head
adding b2
adding b3
4 b3
3 b2
2 0:17ab29e464c6 b1
1 r2
0 r1
updating to branch default
4 files updated, 0 files merged, 0 files removed, 0 files unresolved
1 files updated, 0 files merged, 3 files removed, 0 files unresolved
% rebase b onto r1
applying 37a1297eb21b
37a1297eb21b transplanted to e234d668f844
applying 722f4667af76
722f4667af76 transplanted to 539f377d78df
applying a53251cdf717
a53251cdf717 transplanted to ffd6818a3975
7 b3
6 b2
5 1:d11e3596cc1a b1
4 b3
3 b2
2 0:17ab29e464c6 b1
1 r2
0 r1
updating to branch default
4 files updated, 0 files merged, 0 files removed, 0 files unresolved
1 files updated, 0 files merged, 3 files removed, 0 files unresolved
% rebase b onto r1, skipping b2
applying 37a1297eb21b
37a1297eb21b transplanted to e234d668f844
applying a53251cdf717
a53251cdf717 transplanted to 7275fda4d04f
6 b3
5 1:d11e3596cc1a b1
4 b3
3 b2
2 0:17ab29e464c6 b1
1 r2
0 r1
% remote transplant
requesting all changes
adding changesets
adding manifests
adding file changes
added 2 changesets with 2 changes to 2 files
updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
searching for changes
applying 37a1297eb21b
37a1297eb21b transplanted to c19cf0ccb069
applying a53251cdf717
a53251cdf717 transplanted to f7fe5bf98525
3 b3
(transplanted from a53251cdf717679d1907b289f991534be05c997a)
2 b1
(transplanted from 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21)
1 r2
0 r1
% skip previous transplants
searching for changes
applying 722f4667af76
722f4667af76 transplanted to 47156cd86c0b
4 b2
3 b3
(transplanted from a53251cdf717679d1907b289f991534be05c997a)
2 b1
(transplanted from 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21)
1 r2
0 r1
% skip local changes transplanted to the source
adding b4
updating to branch default
4 files updated, 0 files merged, 0 files removed, 0 files unresolved
searching for changes
applying 4333daefcb15
4333daefcb15 transplanted to 5f42c04e07cc
% remote transplant with pull
requesting all changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
searching for changes
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
applying a53251cdf717
a53251cdf717 transplanted to 8d9279348abb
2 b3
1 b1
0 r1
% transplant --continue
adding foo
adding toremove
adding added
removing toremove
adding bar
2 files updated, 0 files merged, 2 files removed, 0 files unresolved
created new head
applying a1e30dd1b8e7
patching file foo
Hunk #1 FAILED at 0
1 out of 1 hunks FAILED -- saving rejects to file foo.rej
patch failed to apply
abort: Fix up the merge and run hg transplant --continue
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
applying a1e30dd1b8e7
patching file foo
Hunk #1 FAILED at 0
1 out of 1 hunks FAILED -- saving rejects to file foo.rej
patch failed to apply
abort: Fix up the merge and run hg transplant --continue
a1e30dd1b8e7 transplanted as f1563cf27039
skipping already applied revision 1:a1e30dd1b8e7
applying 1739ac5f6139
1739ac5f6139 transplanted to d649c221319f
applying 0282d5fbbe02
0282d5fbbe02 transplanted to 77418277ccb3
added
bar
foo
% test transplant merge
adding a
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
created new head
% tranplant
applying 42dc4432fd35
1:42dc4432fd35 merged at a9f4acbac129
% test transplant into empty repository
requesting all changes
adding changesets
adding manifests
adding file changes
added 4 changesets with 4 changes to 4 files
% test filter
filtering
applying 17ab29e464c6
17ab29e464c6 transplanted to e9ffc54ea104
filtering
applying 37a1297eb21b
37a1297eb21b transplanted to 348b36d0b6a5
filtering
applying 722f4667af76
722f4667af76 transplanted to 0aa6979afb95
filtering
applying a53251cdf717
a53251cdf717 transplanted to 14f8512272b5
3 b3
2 b2
1 b1
0 r2
% test filter with failed patch
0 files updated, 0 files merged, 3 files removed, 0 files unresolved
adding b1
adding test-filter
created new head
file b1 already exists
1 out of 1 hunks FAILED -- saving rejects to file b1.rej
abort: Fix up the merge and run hg transplant --continue
filtering
applying 348b36d0b6a5
patch failed to apply
% test with a win32ext like setup (differing EOLs)
adding a
adding b
nothing changed
applying 2e849d776c17
2e849d776c17 transplanted to 589cea8ba85b
'a\r\nb\r\n'
#!/bin/sh $ cat <<EOF >> $HGRCPATH
> [extensions]
> transplant=
> EOF
...@@ -2,6 +5,12 @@ ...@@ -2,6 +5,12 @@
cat <<EOF >> $HGRCPATH $ hg init t
[extensions] $ cd t
transplant= $ echo r1 > r1
EOF $ hg ci -Amr1 -d'0 0'
adding r1
$ echo r2 > r2
$ hg ci -Amr2 -d'1 0'
adding r2
$ hg up 0
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
...@@ -7,9 +16,27 @@ ...@@ -7,9 +16,27 @@
hg init t $ echo b1 > b1
cd t $ hg ci -Amb1 -d '0 0'
echo r1 > r1 adding b1
hg ci -Amr1 -d'0 0' created new head
echo r2 > r2 $ echo b2 > b2
hg ci -Amr2 -d'1 0' $ hg ci -Amb2 -d '1 0'
hg up 0 adding b2
$ echo b3 > b3
$ hg ci -Amb3 -d '2 0'
adding b3
$ hg log --template '{rev} {parents} {desc}\n'
4 b3
3 b2
2 0:17ab29e464c6 b1
1 r2
0 r1
$ hg clone . ../rebase
updating to branch default
4 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd ../rebase
$ hg up -C 1
1 files updated, 0 files merged, 3 files removed, 0 files unresolved
...@@ -15,8 +42,20 @@ ...@@ -15,8 +42,20 @@
echo b1 > b1 rebase b onto r1
hg ci -Amb1 -d '0 0'
echo b2 > b2 $ hg transplant -a -b tip
hg ci -Amb2 -d '1 0' applying 37a1297eb21b
echo b3 > b3 37a1297eb21b transplanted to e234d668f844
hg ci -Amb3 -d '2 0' applying 722f4667af76
722f4667af76 transplanted to 539f377d78df
applying a53251cdf717
a53251cdf717 transplanted to ffd6818a3975
$ hg log --template '{rev} {parents} {desc}\n'
7 b3
6 b2
5 1:d11e3596cc1a b1
4 b3
3 b2
2 0:17ab29e464c6 b1
1 r2
0 r1
...@@ -22,3 +61,6 @@ ...@@ -22,3 +61,6 @@
hg log --template '{rev} {parents} {desc}\n' $ hg clone ../t ../prune
updating to branch default
4 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd ../prune
...@@ -24,4 +66,6 @@ ...@@ -24,4 +66,6 @@
hg clone . ../rebase $ hg up -C 1
cd ../rebase 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
rebase b onto r1, skipping b2
...@@ -27,6 +71,15 @@ ...@@ -27,6 +71,15 @@
hg up -C 1 $ hg transplant -a -b tip -p 3
echo '% rebase b onto r1' applying 37a1297eb21b
hg transplant -a -b tip 37a1297eb21b transplanted to e234d668f844
hg log --template '{rev} {parents} {desc}\n' applying a53251cdf717
a53251cdf717 transplanted to 7275fda4d04f
$ hg log --template '{rev} {parents} {desc}\n'
6 b3
5 1:d11e3596cc1a b1
4 b3
3 b2
2 0:17ab29e464c6 b1
1 r2
0 r1
...@@ -32,4 +85,4 @@ ...@@ -32,4 +85,4 @@
hg clone ../t ../prune
cd ../prune remote transplant
...@@ -35,6 +88,24 @@ ...@@ -35,6 +88,24 @@
hg up -C 1 $ hg clone -r 1 ../t ../remote
echo '% rebase b onto r1, skipping b2' requesting all changes
hg transplant -a -b tip -p 3 adding changesets
hg log --template '{rev} {parents} {desc}\n' adding manifests
adding file changes
added 2 changesets with 2 changes to 2 files
updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd ../remote
$ hg transplant --log -s ../t 2 4
searching for changes
applying 37a1297eb21b
37a1297eb21b transplanted to c19cf0ccb069
applying a53251cdf717
a53251cdf717 transplanted to f7fe5bf98525
$ hg log --template '{rev} {parents} {desc}\n'
3 b3
(transplanted from a53251cdf717679d1907b289f991534be05c997a)
2 b1
(transplanted from 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21)
1 r2
0 r1
...@@ -40,7 +111,18 @@ ...@@ -40,7 +111,18 @@
echo '% remote transplant' skip previous transplants
hg clone -r 1 ../t ../remote
cd ../remote $ hg transplant -s ../t -a -b 4
hg transplant --log -s ../t 2 4 searching for changes
hg log --template '{rev} {parents} {desc}\n' applying 722f4667af76
722f4667af76 transplanted to 47156cd86c0b
$ hg log --template '{rev} {parents} {desc}\n'
4 b2
3 b3
(transplanted from a53251cdf717679d1907b289f991534be05c997a)
2 b1
(transplanted from 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21)
1 r2
0 r1
skip local changes transplanted to the source
...@@ -46,5 +128,19 @@ ...@@ -46,5 +128,19 @@
echo '% skip previous transplants' $ echo b4 > b4
hg transplant -s ../t -a -b 4 $ hg ci -Amb4 -d '3 0'
hg log --template '{rev} {parents} {desc}\n' adding b4
$ hg clone ../t ../pullback
updating to branch default
4 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd ../pullback
$ hg transplant -s ../remote -a -b tip
searching for changes
applying 4333daefcb15
4333daefcb15 transplanted to 5f42c04e07cc
remote transplant with pull
$ hg -R ../t serve -p $HGPORT -d --pid-file=../t.pid
$ cat ../t.pid >> $DAEMON_PIDS
...@@ -50,8 +146,24 @@ ...@@ -50,8 +146,24 @@
echo '% skip local changes transplanted to the source' $ hg clone -r 0 ../t ../rp
echo b4 > b4 requesting all changes
hg ci -Amb4 -d '3 0' adding changesets
hg clone ../t ../pullback adding manifests
cd ../pullback adding file changes
hg transplant -s ../remote -a -b tip added 1 changesets with 1 changes to 1 files
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd ../rp
$ hg transplant -s http://localhost:$HGPORT/ 2 4
searching for changes
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
applying a53251cdf717
a53251cdf717 transplanted to 8d9279348abb
$ hg log --template '{rev} {parents} {desc}\n'
2 b3
1 b1
0 r1
...@@ -57,10 +169,3 @@ ...@@ -57,10 +169,3 @@
echo '% remote transplant with pull' transplant --continue
hg -R ../t serve -p $HGPORT -d --pid-file=../t.pid
cat ../t.pid >> $DAEMON_PIDS
hg clone -r 0 ../t ../rp
cd ../rp
hg transplant -s http://localhost:$HGPORT/ 2 4
hg log --template '{rev} {parents} {desc}\n'
...@@ -66,36 +171,91 @@ ...@@ -66,36 +171,91 @@
echo '% transplant --continue' $ hg init ../tc
hg init ../tc $ cd ../tc
cd ../tc $ cat <<EOF > foo
cat <<EOF > foo > foo
foo > bar
bar > baz
baz > EOF
EOF $ echo toremove > toremove
echo toremove > toremove $ hg ci -Amfoo
hg ci -Amfoo adding foo
cat <<EOF > foo adding toremove
foo2 $ cat <<EOF > foo
bar2 > foo2
baz2 > bar2
EOF > baz2
rm toremove > EOF
echo added > added $ rm toremove
hg ci -Amfoo2 $ echo added > added
echo bar > bar $ hg ci -Amfoo2
hg ci -Ambar adding added
echo bar2 >> bar removing toremove
hg ci -mbar2 $ echo bar > bar
hg up 0 $ hg ci -Ambar
echo foobar > foo adding bar
hg ci -mfoobar $ echo bar2 >> bar
hg transplant 1:3 $ hg ci -mbar2
# transplant -c shouldn't use an old changeset $ hg up 0
hg up -C 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
rm added $ echo foobar > foo
hg transplant 1 $ hg ci -mfoobar
hg transplant --continue created new head
hg transplant 1:3 $ hg transplant 1:3
hg locate applying a1e30dd1b8e7
cd .. patching file foo
Hunk #1 FAILED at 0
1 out of 1 hunks FAILED -- saving rejects to file foo.rej
patch failed to apply
abort: Fix up the merge and run hg transplant --continue
transplant -c shouldn't use an old changeset
$ hg up -C
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ rm added
$ hg transplant 1
applying a1e30dd1b8e7
patching file foo
Hunk #1 FAILED at 0
1 out of 1 hunks FAILED -- saving rejects to file foo.rej
patch failed to apply
abort: Fix up the merge and run hg transplant --continue
$ hg transplant --continue
a1e30dd1b8e7 transplanted as f1563cf27039
$ hg transplant 1:3
skipping already applied revision 1:a1e30dd1b8e7
applying 1739ac5f6139
1739ac5f6139 transplanted to d649c221319f
applying 0282d5fbbe02
0282d5fbbe02 transplanted to 77418277ccb3
$ hg locate
added
bar
foo
$ cd ..
Test transplant --merge (issue 1111)
test transplant merge
$ hg init t1111
$ cd t1111
$ echo a > a
$ hg ci -Am adda
adding a
$ echo b >> a
$ hg ci -m appendb
$ echo c >> a
$ hg ci -m appendc
$ hg up -C 0
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo d >> a
$ hg ci -m appendd
created new head
tranplant
$ hg transplant -m 1
applying 42dc4432fd35
1:42dc4432fd35 merged at a9f4acbac129
$ cd ..
...@@ -101,18 +261,16 @@ ...@@ -101,18 +261,16 @@
# Test transplant --merge (issue 1111) test transplant into empty repository
echo % test transplant merge
hg init t1111 $ hg init empty
cd t1111 $ cd empty
echo a > a $ hg transplant -s ../t -b tip -a
hg ci -Am adda requesting all changes
echo b >> a adding changesets
hg ci -m appendb adding manifests
echo c >> a adding file changes
hg ci -m appendc added 4 changesets with 4 changes to 4 files
hg up -C 0 $ cd ..
echo d >> a
hg ci -m appendd
echo % tranplant test filter
hg transplant -m 1
cd ..
...@@ -118,7 +276,32 @@ ...@@ -118,7 +276,32 @@
echo '% test transplant into empty repository' $ hg init filter
hg init empty $ cd filter
cd empty $ cat <<'EOF' >test-filter
hg transplant -s ../t -b tip -a > #!/bin/sh
cd .. > sed 's/r1/r2/' $1 > $1.new
> mv $1.new $1
> EOF
$ chmod +x test-filter
$ hg transplant -s ../t -b tip -a --filter ./test-filter
filtering .*
applying 17ab29e464c6
17ab29e464c6 transplanted to e9ffc54ea104
filtering .*
applying 37a1297eb21b
37a1297eb21b transplanted to 348b36d0b6a5
filtering .*
applying 722f4667af76
722f4667af76 transplanted to 0aa6979afb95
filtering .*
applying a53251cdf717
a53251cdf717 transplanted to 14f8512272b5
$ hg log --template '{rev} {parents} {desc}\n'
3 b3
2 b2
1 b1
0 r2
$ cd ..
test filter with failed patch
...@@ -124,15 +307,21 @@ ...@@ -124,15 +307,21 @@
echo '% test filter' $ cd filter
hg init filter $ hg up 0
cd filter 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
cat <<'EOF' >test-filter $ echo foo > b1
#!/bin/sh $ hg ci -d '0 0' -Am foo
sed 's/r1/r2/' $1 > $1.new adding b1
mv $1.new $1 adding test-filter
EOF created new head
chmod +x test-filter $ hg transplant 1 --filter ./test-filter
hg transplant -s ../t -b tip -a --filter ./test-filter |\ filtering .*
sed 's/filtering.*/filtering/g' applying 348b36d0b6a5
hg log --template '{rev} {parents} {desc}\n' file b1 already exists
cd .. 1 out of 1 hunks FAILED -- saving rejects to file b1.rej
patch failed to apply
abort: Fix up the merge and run hg transplant --continue
$ cd ..
test with a win32ext like setup (differing EOLs)
...@@ -138,10 +327,14 @@ ...@@ -138,10 +327,14 @@
echo '% test filter with failed patch' $ hg init twin1
cd filter $ cd twin1
hg up 0 $ echo a > a
echo foo > b1 $ echo b > b
hg ci -d '0 0' -Am foo $ echo b >> b
hg transplant 1 --filter ./test-filter |\ $ hg ci -Am t
sed 's/filtering.*/filtering/g' adding a
cd .. adding b
$ echo a > b
$ echo b >> b
$ hg ci -m changeb
$ cd ..
...@@ -147,22 +340,14 @@ ...@@ -147,22 +340,14 @@
echo '% test with a win32ext like setup (differing EOLs)' $ hg init twin2
hg init twin1 $ cd twin2
cd twin1 $ echo '[patch]' >> .hg/hgrc
echo a > a $ echo 'eol = crlf' >> .hg/hgrc
echo b > b $ python -c "file('b', 'wb').write('b\r\nb\r\n')"
echo b >> b $ hg ci -m addb
hg ci -Am t nothing changed
echo a > b $ hg transplant -s ../twin1 tip
echo b >> b applying 2e849d776c17
hg ci -m changeb 2e849d776c17 transplanted to 589cea8ba85b
cd .. $ python -c "print repr(file('b', 'rb').read())"
'a\r\nb\r\n'
hg init twin2 $ cd ..
cd twin2
echo '[patch]' >> .hg/hgrc
echo 'eol = crlf' >> .hg/hgrc
python -c "file('b', 'wb').write('b\r\nb\r\n')"
hg ci -m addb
hg transplant -s ../twin1 tip
python -c "print repr(file('b', 'rb').read())"
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