diff options
Diffstat (limited to 'tests/test-import.t')
-rw-r--r-- | tests/test-import.t | 263 |
1 files changed, 19 insertions, 244 deletions
diff --git a/tests/test-import.t b/tests/test-import.t index ccd35cc..a141c32 100644 --- a/tests/test-import.t +++ b/tests/test-import.t @@ -10,11 +10,6 @@ $ echo line 2 >> a/a $ hg --cwd a ci -u someone -d '1 0' -m'second change' -import with no args: - - $ hg --cwd a import - abort: need at least one patch to import - [255] generate patches for the test @@ -52,6 +47,7 @@ import exported patch with external patcher > print 'patching file a' > file('a', 'wb').write('line2\n') > EOF + $ chmod +x dummypatch.py $ hg clone -r0 a b adding changesets adding manifests @@ -203,6 +199,7 @@ import two patches in one stream $ hg init b $ hg --cwd a export 0:tip | hg --cwd b import - applying patch from stdin + applied 80971e65b431 $ hg --cwd a id 1d4bd90af0e4 tip $ hg --cwd b id @@ -232,7 +229,7 @@ override commit message > msg.set_payload('email commit message\n' + patch) > msg['Subject'] = 'email patch' > msg['From'] = 'email patcher' - > file(sys.argv[2], 'wb').write(msg.as_string()) + > sys.stdout.write(msg.as_string()) > EOF @@ -245,7 +242,7 @@ plain diff in email, subject, message body added 1 changesets with 2 changes to 2 files updating to branch default 2 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ python mkmsg.py diffed-tip.patch msg.patch + $ python mkmsg.py diffed-tip.patch > msg.patch $ hg --cwd b import ../msg.patch applying ../msg.patch $ hg --cwd b tip | grep email @@ -307,8 +304,7 @@ hg export in email, should use patch header added 1 changesets with 2 changes to 2 files updating to branch default 2 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ python mkmsg.py exported-tip.patch msg.patch - $ cat msg.patch | hg --cwd b import - + $ python mkmsg.py exported-tip.patch | hg --cwd b import - applying patch from stdin $ hg --cwd b tip | grep second summary: second change @@ -325,7 +321,7 @@ The '---' tests the gitsendmail handling without proper mail headers > msg.set_payload('email patch\n\nnext line\n---\n' + patch) > msg['Subject'] = '[PATCH] email patch' > msg['From'] = 'email patcher' - > file(sys.argv[2], 'wb').write(msg.as_string()) + > sys.stdout.write(msg.as_string()) > EOF @@ -338,8 +334,7 @@ plain diff in email, [PATCH] subject, message body with subject added 1 changesets with 2 changes to 2 files updating to branch default 2 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ python mkmsg2.py diffed-tip.patch msg.patch - $ cat msg.patch | hg --cwd b import - + $ python mkmsg2.py diffed-tip.patch | hg --cwd b import - applying patch from stdin $ hg --cwd b tip --template '{desc}\n' email patch @@ -361,20 +356,15 @@ patches: import patch1 patch2; rollback $ hg clone -qr0 a b $ hg --cwd b parents --template 'parent: {rev}\n' parent: 0 - $ hg --cwd b import -v ../patch1 ../patch2 + $ hg --cwd b import ../patch1 ../patch2 applying ../patch1 - patching file a - a - created 1d4bd90af0e4 applying ../patch2 - patching file a - a - created 6d019af21222 + applied 1d4bd90af0e4 $ hg --cwd b rollback - repository tip rolled back to revision 0 (undo import) - working directory now based on revision 0 + repository tip rolled back to revision 1 (undo commit) + working directory now based on revision 1 $ hg --cwd b parents --template 'parent: {rev}\n' - parent: 0 + parent: 1 $ rm -r b @@ -442,8 +432,7 @@ Test fuzziness (ambiguous patch location, fuzz=2) $ hg import --no-commit -v fuzzy-tip.patch applying fuzzy-tip.patch patching file a - Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines). - applied to working directory + Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines). $ hg revert -a reverting a @@ -459,8 +448,7 @@ test fuzziness with eol=auto $ hg --config patch.eol=auto import --no-commit -v fuzzy-tip.patch applying fuzzy-tip.patch patching file a - Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines). - applied to working directory + Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines). $ cd .. @@ -629,7 +617,7 @@ test paths outside repo root > rename to bar > EOF applying patch from stdin - abort: path contains illegal component: ../outside/foo (glob) + abort: path contains illegal component: ../outside/foo [255] $ cd .. @@ -660,9 +648,9 @@ test import with similarity and git and strip (issue295 et al.) applying ../rename.diff patching file a patching file b + removing a adding b recording removal of a as rename to b (88% similar) - applied to working directory $ hg st -C A b a @@ -675,8 +663,8 @@ test import with similarity and git and strip (issue295 et al.) applying ../rename.diff patching file a patching file b + removing a adding b - applied to working directory $ hg st -C A b R a @@ -692,7 +680,6 @@ Issue1495: add empty file from the end of patch adding a $ hg ci -m "commit" $ cat > a.patch <<EOF - > add a, b > diff --git a/a b/a > --- a/a > +++ b/a @@ -703,25 +690,9 @@ Issue1495: add empty file from the end of patch > EOF $ hg import --no-commit a.patch applying a.patch - -apply a good patch followed by an empty patch (mainly to ensure -that dirstate is *not* updated when import crashes) - $ hg update -q -C . - $ rm b - $ touch empty.patch - $ hg import a.patch empty.patch - applying a.patch - applying empty.patch - transaction abort! - rollback completed - abort: empty.patch: no diffs found - [255] - $ hg tip --template '{rev} {desc|firstline}\n' - 0 commit - $ hg -q status - M a $ cd .. + create file when source is not /dev/null $ cat > create.patch <<EOF @@ -754,7 +725,6 @@ some people have patches like the following too $ cat foo a - $ cd .. Issue1859: first line mistaken for email headers @@ -789,7 +759,7 @@ Issue1859: first line mistaken for email headers $ cd .. -in commit message +--- in commit message $ hg init commitconfusion $ cd commitconfusion @@ -905,16 +875,12 @@ Issue2102: hg export and hg import speak different languages > new mode 100755 > EOF applying patch from stdin - -#if execbit - $ hg sum parent: 1:d59915696727 tip help management of empty pkg and lib directories in perforce branch: default commit: (clean) update: (current) - $ hg diff --git -c tip diff --git a/lib/place-holder b/lib/place-holder new file mode 100644 @@ -933,39 +899,6 @@ Issue2102: hg export and hg import speak different languages diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash old mode 100644 new mode 100755 - -#else - - $ hg sum - parent: 1:28f089cc9ccc tip - help management of empty pkg and lib directories in perforce - branch: default - commit: (clean) - update: (current) - - $ hg diff --git -c tip - diff --git a/lib/place-holder b/lib/place-holder - new file mode 100644 - --- /dev/null - +++ b/lib/place-holder - @@ -0,0 +1,2 @@ - +perforce does not maintain empty directories. - +this file helps. - diff --git a/pkg/place-holder b/pkg/place-holder - new file mode 100644 - --- /dev/null - +++ b/pkg/place-holder - @@ -0,0 +1,2 @@ - +perforce does not maintain empty directories. - +this file helps. - -/* The mode change for mksys.bash is missing here, because on platforms */ -/* that don't support execbits, mode changes in patches are ignored when */ -/* they are imported. This is obviously also the reason for why the hash */ -/* in the created changeset is different to the one you see above the */ -/* #else clause */ - -#endif $ cd .. @@ -995,161 +928,3 @@ diff lines looking like headers $ diff want have $ cd .. -import a unified diff with no lines of context (diff -U0) - - $ hg init diffzero - $ cd diffzero - $ cat > f << EOF - > c2 - > c4 - > c5 - > EOF - $ hg commit -Am0 - adding f - - $ hg import --no-commit - << EOF - > # HG changeset patch - > # User test - > # Date 0 0 - > # Node ID f4974ab632f3dee767567b0576c0ec9a4508575c - > # Parent 8679a12a975b819fae5f7ad3853a2886d143d794 - > 1 - > diff -r 8679a12a975b -r f4974ab632f3 f - > --- a/f Thu Jan 01 00:00:00 1970 +0000 - > +++ b/f Thu Jan 01 00:00:00 1970 +0000 - > @@ -0,0 +1,1 @@ - > +c1 - > @@ -1,0 +3,1 @@ - > +c3 - > @@ -3,1 +4,0 @@ - > -c5 - > EOF - applying patch from stdin - - $ cat f - c1 - c2 - c3 - c4 - - $ cd .. - -no segfault while importing a unified diff which start line is zero but chunk -size is non-zero - - $ hg init startlinezero - $ cd startlinezero - $ echo foo > foo - $ hg commit -Amfoo - adding foo - - $ hg import --no-commit - << EOF - > diff a/foo b/foo - > --- a/foo - > +++ b/foo - > @@ -0,1 +0,1 @@ - > foo - > EOF - applying patch from stdin - - $ cd .. - -Test corner case involving fuzz and skew - - $ hg init morecornercases - $ cd morecornercases - - $ cat > 01-no-context-beginning-of-file.diff <<EOF - > diff --git a/a b/a - > --- a/a - > +++ b/a - > @@ -1,0 +1,1 @@ - > +line - > EOF - - $ cat > 02-no-context-middle-of-file.diff <<EOF - > diff --git a/a b/a - > --- a/a - > +++ b/a - > @@ -1,1 +1,1 @@ - > -2 - > +add some skew - > @@ -2,0 +2,1 @@ - > +line - > EOF - - $ cat > 03-no-context-end-of-file.diff <<EOF - > diff --git a/a b/a - > --- a/a - > +++ b/a - > @@ -10,0 +10,1 @@ - > +line - > EOF - - $ cat > 04-middle-of-file-completely-fuzzed.diff <<EOF - > diff --git a/a b/a - > --- a/a - > +++ b/a - > @@ -1,1 +1,1 @@ - > -2 - > +add some skew - > @@ -2,2 +2,3 @@ - > not matching, should fuzz - > ... a bit - > +line - > EOF - - $ cat > a <<EOF - > 1 - > 2 - > 3 - > 4 - > EOF - $ hg ci -Am adda a - $ for p in *.diff; do - > hg import -v --no-commit $p - > cat a - > hg revert -aqC a - > # patch -p1 < $p - > # cat a - > # hg revert -aC a - > done - applying 01-no-context-beginning-of-file.diff - patching file a - applied to working directory - 1 - line - 2 - 3 - 4 - applying 02-no-context-middle-of-file.diff - patching file a - Hunk #1 succeeded at 2 (offset 1 lines). - Hunk #2 succeeded at 4 (offset 1 lines). - applied to working directory - 1 - add some skew - 3 - line - 4 - applying 03-no-context-end-of-file.diff - patching file a - Hunk #1 succeeded at 5 (offset -6 lines). - applied to working directory - 1 - 2 - 3 - 4 - line - applying 04-middle-of-file-completely-fuzzed.diff - patching file a - Hunk #1 succeeded at 2 (offset 1 lines). - Hunk #2 succeeded at 5 with fuzz 2 (offset 1 lines). - applied to working directory - 1 - add some skew - 3 - 4 - line - - $ cd .. |