annotate tests/test-import-bypass.t @ 23344:6333412245ec stable

mq: when setting message in plain mode, separate it from header (issue4453) Fix inconsistent handling of plain header separation in mq patcheader - and contrary to c87f2a5a6e49, do it in the direction of having an empty line between header and description. Plain patches are like mails and should thus have an empty line between headers and body in compliance with RFC 822 3.1.
author Mads Kiilerich <madski@unity3d.com>
date Sun, 16 Nov 2014 19:57:40 +0100
parents c63a09b6b337
children 093e8a5e995f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14611
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
1 $ echo "[extensions]" >> $HGRCPATH
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
2 $ echo "purge=" >> $HGRCPATH
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
3
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
4 $ shortlog() {
20117
aa9385f983fa tests: don't load unnecessary graphlog extension
Martin Geisler <martin@geisler.net>
parents: 16913
diff changeset
5 > hg log -G --template '{rev}:{node|short} {author} {date|hgdate} - {branch} - {desc|firstline}\n'
14611
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
6 > }
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
7
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
8 Test --bypass with other options
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
9
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
10 $ hg init repo-options
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
11 $ cd repo-options
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
12 $ echo a > a
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
13 $ hg ci -Am adda
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
14 adding a
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
15 $ echo a >> a
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
16 $ hg branch foo
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
17 marked working directory as branch foo
15615
41885892796e branch: warn on branching
Matt Mackall <mpm@selenic.com>
parents: 15198
diff changeset
18 (branches are permanent and global, did you want a bookmark?)
14611
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
19 $ hg ci -Am changea
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
20 $ hg export . > ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
21 $ hg up null
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
22 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
23
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
24 Test importing an existing revision
22277
e116abad3afa import: disallow meaningless combination of "--exact" and "--edit"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21417
diff changeset
25 (this also tests that "hg import" disallows combination of '--exact'
e116abad3afa import: disallow meaningless combination of "--exact" and "--edit"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21417
diff changeset
26 and '--edit')
14611
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
27
22277
e116abad3afa import: disallow meaningless combination of "--exact" and "--edit"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21417
diff changeset
28 $ hg import --bypass --exact --edit ../test.diff
e116abad3afa import: disallow meaningless combination of "--exact" and "--edit"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21417
diff changeset
29 abort: cannot use --exact with --edit
e116abad3afa import: disallow meaningless combination of "--exact" and "--edit"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21417
diff changeset
30 [255]
e116abad3afa import: disallow meaningless combination of "--exact" and "--edit"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21417
diff changeset
31 $ hg import --bypass --exact ../test.diff
14611
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
32 applying ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
33 $ shortlog
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
34 o 1:4e322f7ce8e3 test 0 0 - foo - changea
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
35 |
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
36 o 0:07f494440405 test 0 0 - default - adda
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
37
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
38
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
39 Test failure without --exact
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
40
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
41 $ hg import --bypass ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
42 applying ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
43 unable to find 'a' for patching
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
44 abort: patch failed to apply
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
45 [255]
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
46 $ hg st
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
47 $ shortlog
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
48 o 1:4e322f7ce8e3 test 0 0 - foo - changea
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
49 |
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
50 o 0:07f494440405 test 0 0 - default - adda
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
51
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
52
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
53 Test --user, --date and --message
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
54
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
55 $ hg up 0
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
56 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
57 $ hg import --bypass --u test2 -d '1 0' -m patch2 ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
58 applying ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
59 $ cat .hg/last-message.txt
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
60 patch2 (no-eol)
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
61 $ shortlog
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
62 o 2:2e127d1da504 test2 1 0 - default - patch2
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
63 |
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
64 | o 1:4e322f7ce8e3 test 0 0 - foo - changea
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
65 |/
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
66 @ 0:07f494440405 test 0 0 - default - adda
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
67
15198
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
68 $ hg rollback
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
69 repository tip rolled back to revision 1 (undo import)
14611
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
70
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
71 Test --import-branch
22277
e116abad3afa import: disallow meaningless combination of "--exact" and "--edit"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21417
diff changeset
72 (this also tests that editor is not invoked for '--bypass', if the
e116abad3afa import: disallow meaningless combination of "--exact" and "--edit"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21417
diff changeset
73 patch contains the commit message, regardless of '--edit')
14611
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
74
22277
e116abad3afa import: disallow meaningless combination of "--exact" and "--edit"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21417
diff changeset
75 $ HGEDITOR=cat hg import --bypass --import-branch --edit ../test.diff
14611
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
76 applying ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
77 $ shortlog
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
78 o 1:4e322f7ce8e3 test 0 0 - foo - changea
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
79 |
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
80 @ 0:07f494440405 test 0 0 - default - adda
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
81
15198
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
82 $ hg rollback
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
83 repository tip rolled back to revision 1 (undo import)
14611
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
84
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
85 Test --strip
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
86
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
87 $ hg import --bypass --strip 0 - <<EOF
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
88 > # HG changeset patch
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
89 > # User test
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
90 > # Date 0 0
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
91 > # Branch foo
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
92 > # Node ID 4e322f7ce8e3e4203950eac9ece27bf7e45ffa6c
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
93 > # Parent 07f4944404050f47db2e5c5071e0e84e7a27bba9
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
94 > changea
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
95 >
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
96 > diff -r 07f494440405 -r 4e322f7ce8e3 a
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
97 > --- a Thu Jan 01 00:00:00 1970 +0000
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
98 > +++ a Thu Jan 01 00:00:00 1970 +0000
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
99 > @@ -1,1 +1,2 @@
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
100 > a
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
101 > +a
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
102 > EOF
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
103 applying patch from stdin
15198
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
104 $ hg rollback
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
105 repository tip rolled back to revision 1 (undo import)
14611
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
106
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
107 Test unsupported combinations
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
108
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
109 $ hg import --bypass --no-commit ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
110 abort: cannot use --no-commit with --bypass
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
111 [255]
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
112 $ hg import --bypass --similarity 50 ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
113 abort: cannot use --similarity with --bypass
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
114 [255]
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
115
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
116 Test commit editor
21417
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20117
diff changeset
117 (this also tests that editor is invoked, if the patch doesn't contain
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20117
diff changeset
118 the commit message, regardless of '--edit')
14611
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
119
16124
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 15623
diff changeset
120 $ cat > ../test.diff <<EOF
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 15623
diff changeset
121 > diff -r 07f494440405 -r 4e322f7ce8e3 a
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 15623
diff changeset
122 > --- a/a Thu Jan 01 00:00:00 1970 +0000
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 15623
diff changeset
123 > +++ b/a Thu Jan 01 00:00:00 1970 +0000
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 15623
diff changeset
124 > @@ -1,1 +1,2 @@
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 15623
diff changeset
125 > -a
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 15623
diff changeset
126 > +b
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 15623
diff changeset
127 > +c
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 15623
diff changeset
128 > EOF
14611
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
129 $ HGEDITOR=cat hg import --bypass ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
130 applying ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
131
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
132
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
133 HG: Enter commit message. Lines beginning with 'HG:' are removed.
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
134 HG: Leave message empty to abort commit.
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
135 HG: --
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
136 HG: user: test
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
137 HG: branch 'default'
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
138 HG: changed a
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
139 abort: empty commit message
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
140 [255]
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
141
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
142 Test patch.eol is handled
21417
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20117
diff changeset
143 (this also tests that editor is not invoked for '--bypass', if the
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20117
diff changeset
144 commit message is explicitly specified, regardless of '--edit')
14611
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
145
22947
c63a09b6b337 tests: use $PYTHON instead of hardcoding python
Augie Fackler <raf@durin42.com>
parents: 22278
diff changeset
146 $ $PYTHON -c 'file("a", "wb").write("a\r\n")'
14611
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
147 $ hg ci -m makeacrlf
21417
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20117
diff changeset
148 $ HGEDITOR=cat hg import -m 'should fail because of eol' --edit --bypass ../test.diff
14611
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
149 applying ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
150 patching file a
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
151 Hunk #1 FAILED at 0
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
152 abort: patch failed to apply
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
153 [255]
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
154 $ hg --config patch.eol=auto import -d '0 0' -m 'test patch.eol' --bypass ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
155 applying ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
156 $ shortlog
16124
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 15623
diff changeset
157 o 3:c606edafba99 test 0 0 - default - test patch.eol
14611
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
158 |
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
159 @ 2:872023de769d test 0 0 - default - makeacrlf
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
160 |
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
161 | o 1:4e322f7ce8e3 test 0 0 - foo - changea
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
162 |/
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
163 o 0:07f494440405 test 0 0 - default - adda
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
164
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
165
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
166 Test applying multiple patches
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
167
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
168 $ hg up -qC 0
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
169 $ echo e > e
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
170 $ hg ci -Am adde
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
171 adding e
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
172 created new head
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
173 $ hg export . > ../patch1.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
174 $ hg up -qC 1
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
175 $ echo f > f
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
176 $ hg ci -Am addf
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
177 adding f
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
178 $ hg export . > ../patch2.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
179 $ cd ..
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
180 $ hg clone -r1 repo-options repo-multi1
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
181 adding changesets
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
182 adding manifests
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
183 adding file changes
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
184 added 2 changesets with 2 changes to 1 files
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
185 updating to branch foo
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
186 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
187 $ cd repo-multi1
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
188 $ hg up 0
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
189 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
190 $ hg import --bypass ../patch1.diff ../patch2.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
191 applying ../patch1.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
192 applying ../patch2.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
193 $ shortlog
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
194 o 3:bc8ca3f8a7c4 test 0 0 - default - addf
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
195 |
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
196 o 2:16581080145e test 0 0 - default - adde
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
197 |
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
198 | o 1:4e322f7ce8e3 test 0 0 - foo - changea
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
199 |/
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
200 @ 0:07f494440405 test 0 0 - default - adda
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
201
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
202
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
203 Test applying multiple patches with --exact
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
204
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
205 $ cd ..
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
206 $ hg clone -r1 repo-options repo-multi2
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
207 adding changesets
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
208 adding manifests
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
209 adding file changes
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
210 added 2 changesets with 2 changes to 1 files
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
211 updating to branch foo
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
212 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
213 $ cd repo-multi2
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
214 $ hg import --bypass --exact ../patch1.diff ../patch2.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
215 applying ../patch1.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
216 applying ../patch2.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
217 $ shortlog
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
218 o 3:d60cb8989666 test 0 0 - foo - addf
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
219 |
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
220 | o 2:16581080145e test 0 0 - default - adde
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
221 | |
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
222 @ | 1:4e322f7ce8e3 test 0 0 - foo - changea
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
223 |/
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
224 o 0:07f494440405 test 0 0 - default - adda
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
225
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
226
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
227 $ cd ..
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
228
22278
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22277
diff changeset
229 Test avoiding editor invocation at applying the patch with --exact
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22277
diff changeset
230 even if commit message is empty
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22277
diff changeset
231
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22277
diff changeset
232 $ cd repo-options
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22277
diff changeset
233
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22277
diff changeset
234 $ echo a >> a
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22277
diff changeset
235 $ hg commit -m ' '
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22277
diff changeset
236 $ hg tip -T "{node}\n"
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22277
diff changeset
237 1b77bc7d1db9f0e7f1716d515b630516ab386c89
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22277
diff changeset
238 $ hg export -o ../empty-log.diff .
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22277
diff changeset
239 $ hg update -q -C ".^1"
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22277
diff changeset
240 $ hg --config extensions.strip= strip -q tip
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22277
diff changeset
241 $ HGEDITOR=cat hg import --exact --bypass ../empty-log.diff
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22277
diff changeset
242 applying ../empty-log.diff
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22277
diff changeset
243 $ hg tip -T "{node}\n"
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22277
diff changeset
244 1b77bc7d1db9f0e7f1716d515b630516ab386c89
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22277
diff changeset
245
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22277
diff changeset
246 $ cd ..
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22277
diff changeset
247
16899
8149ff405c78 tests: convert some 'hghave execbit' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 16124
diff changeset
248 #if symlink execbit
8149ff405c78 tests: convert some 'hghave execbit' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 16124
diff changeset
249
14611
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
250 Test complicated patch with --exact
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
251
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
252 $ hg init repo-exact
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
253 $ cd repo-exact
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
254 $ echo a > a
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
255 $ echo c > c
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
256 $ echo d > d
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
257 $ echo e > e
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
258 $ echo f > f
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
259 $ chmod +x f
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
260 $ ln -s c linkc
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
261 $ hg ci -Am t
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
262 adding a
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
263 adding c
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
264 adding d
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
265 adding e
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
266 adding f
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
267 adding linkc
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
268 $ hg cp a aa1
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
269 $ echo b >> a
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
270 $ echo b > b
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
271 $ hg add b
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
272 $ hg cp a aa2
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
273 $ echo aa >> aa2
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
274 $ chmod +x e
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
275 $ chmod -x f
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
276 $ ln -s a linka
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
277 $ hg rm d
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
278 $ hg rm linkc
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
279 $ hg mv c cc
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
280 $ hg ci -m patch
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
281 $ hg export --git . > ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
282 $ hg up -C null
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
283 0 files updated, 0 files merged, 7 files removed, 0 files unresolved
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
284 $ hg purge
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
285 $ hg st
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
286 $ hg import --bypass --exact ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
287 applying ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
288
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
289 The patch should have matched the exported revision and generated no additional
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
290 data. If not, diff both heads to debug it.
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
291
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
292 $ shortlog
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
293 o 1:2978fd5c8aa4 test 0 0 - default - patch
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
294 |
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
295 o 0:a0e19e636a43 test 0 0 - default - t
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
296
16899
8149ff405c78 tests: convert some 'hghave execbit' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 16124
diff changeset
297 #endif
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16899
diff changeset
298
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16899
diff changeset
299 $ cd ..