Debian Codegraph @

tests/test-mq-git.t

raw
1 # Test the plumbing of mq.git option
2 # Automatic upgrade itself is tested elsewhere.
3
4 $ cat <<EOF >> $HGRCPATH
5 > [extensions]
6 > mq =
7 > [diff]
8 > nodates = 1
9 > EOF
10
11 $ hg init repo-auto
12 $ cd repo-auto
13
14 git=auto: regular patch creation:
15
16 $ echo a > a
17 $ hg add a
18 $ hg qnew -d '0 0' -f adda
19
20 $ cat .hg/patches/adda
21 # HG changeset patch
22 # Date 0 0
23 # Parent 0000000000000000000000000000000000000000
24
25 diff -r 000000000000 -r ef8dafc9fa4c a
26 --- /dev/null
27 +++ b/a
28 @@ -0,0 +1,1 @@
29 +a
30
31 git=auto: git patch creation with copy:
32
33 $ hg cp a b
34 $ hg qnew -d '0 0' -f copy
35
36 $ cat .hg/patches/copy
37 # HG changeset patch
38 # Date 0 0
39 # Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
40
41 diff --git a/a b/b
42 copy from a
43 copy to b
44
45 git=auto: git patch when using --git:
46
47 $ echo regular > regular
48 $ hg add regular
49 $ hg qnew -d '0 0' --git -f git
50
51 $ cat .hg/patches/git
52 # HG changeset patch
53 # Date 0 0
54 # Parent 99586d5f048c399e20f81cee41fbb3809c0e735d
55
56 diff --git a/regular b/regular
57 new file mode 100644
58 --- /dev/null
59 +++ b/regular
60 @@ -0,0 +1,1 @@
61 +regular
62
63 git=auto: regular patch after qrefresh without --git:
64
65 $ hg qrefresh -d '0 0'
66
67 $ cat .hg/patches/git
68 # HG changeset patch
69 # Date 0 0
70 # Parent 99586d5f048c399e20f81cee41fbb3809c0e735d
71
72 diff -r 99586d5f048c regular
73 --- /dev/null
74 +++ b/regular
75 @@ -0,0 +1,1 @@
76 +regular
77
78 $ cd ..
79
80 $ hg init repo-keep
81 $ cd repo-keep
82 $ echo '[mq]' > .hg/hgrc
83 $ echo 'git = KEEP' >> .hg/hgrc
84
85 git=keep: git patch with --git:
86
87 $ echo a > a
88 $ hg add a
89 $ hg qnew -d '0 0' -f --git git
90
91 $ cat .hg/patches/git
92 # HG changeset patch
93 # Date 0 0
94 # Parent 0000000000000000000000000000000000000000
95
96 diff --git a/a b/a
97 new file mode 100644
98 --- /dev/null
99 +++ b/a
100 @@ -0,0 +1,1 @@
101 +a
102
103 git=keep: git patch after qrefresh without --git:
104
105 $ echo a >> a
106 $ hg qrefresh -d '0 0'
107
108 $ cat .hg/patches/git
109 # HG changeset patch
110 # Date 0 0
111 # Parent 0000000000000000000000000000000000000000
112
113 diff --git a/a b/a
114 new file mode 100644
115 --- /dev/null
116 +++ b/a
117 @@ -0,0 +1,2 @@
118 +a
119 +a
120 $ cd ..
121
122 $ hg init repo-yes
123 $ cd repo-yes
124 $ echo '[mq]' > .hg/hgrc
125 $ echo 'git = yes' >> .hg/hgrc
126
127 git=yes: git patch:
128
129 $ echo a > a
130 $ hg add a
131 $ hg qnew -d '0 0' -f git
132
133 $ cat .hg/patches/git
134 # HG changeset patch
135 # Date 0 0
136 # Parent 0000000000000000000000000000000000000000
137
138 diff --git a/a b/a
139 new file mode 100644
140 --- /dev/null
141 +++ b/a
142 @@ -0,0 +1,1 @@
143 +a
144
145 git=yes: git patch after qrefresh:
146
147 $ echo a >> a
148 $ hg qrefresh -d '0 0'
149
150 $ cat .hg/patches/git
151 # HG changeset patch
152 # Date 0 0
153 # Parent 0000000000000000000000000000000000000000
154
155 diff --git a/a b/a
156 new file mode 100644
157 --- /dev/null
158 +++ b/a
159 @@ -0,0 +1,2 @@
160 +a
161 +a
162 $ cd ..
163
164 $ hg init repo-no
165 $ cd repo-no
166 $ echo '[diff]' > .hg/hgrc
167 $ echo 'git = True' >> .hg/hgrc
168 $ echo '[mq]' > .hg/hgrc
169 $ echo 'git = False' >> .hg/hgrc
170
171 git=no: regular patch with copy:
172
173 $ echo a > a
174 $ hg add a
175 $ hg qnew -d '0 0' -f adda
176 $ hg cp a b
177 $ hg qnew -d '0 0' -f regular
178
179 $ cat .hg/patches/regular
180 # HG changeset patch
181 # Date 0 0
182 # Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
183
184 diff -r ef8dafc9fa4c -r a70404f79ba3 b
185 --- /dev/null
186 +++ b/b
187 @@ -0,0 +1,1 @@
188 +a
189
190 git=no: regular patch after qrefresh with copy:
191
192 $ hg cp a c
193 $ hg qrefresh -d '0 0'
194
195 $ cat .hg/patches/regular
196 # HG changeset patch
197 # Date 0 0
198 # Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
199
200 diff -r ef8dafc9fa4c b
201 --- /dev/null
202 +++ b/b
203 @@ -0,0 +1,1 @@
204 +a
205 diff -r ef8dafc9fa4c c
206 --- /dev/null
207 +++ b/c
208 @@ -0,0 +1,1 @@
209 +a
210
211 Test how [diff] configuration influence and cause invalid or lossy patches:
212
213 $ cat <<EOF >> .hg/hgrc
214 > [mq]
215 > git = AUTO
216 > [diff]
217 > nobinary = True
218 > noprefix = True
219 > showfunc = True
220 > ignorews = True
221 > ignorewsamount = True
222 > ignoreblanklines = True
223 > unified = 1
224 > EOF
225
226 $ echo ' a' > a
227 $ hg qnew prepare -d '0 0'
228 $ echo ' a' > a
229 $ printf '\0' > b
230 $ echo >> c
231 $ hg qnew diff -d '0 0'
232
233 $ cat .hg/patches/prepare
234 # HG changeset patch
235 # Date 0 0
236 # Parent cf0bfe72686a47d8d7d7b4529a3adb8b0b449a9f
237
238 diff -r cf0bfe72686a -r fb9c4422b0f3 a
239 --- a/a
240 +++ b/a
241 @@ -1,1 +1,1 @@
242 -a
243 + a
244 $ cat .hg/patches/diff
245 # HG changeset patch
246 # Date 0 0
247 # Parent fb9c4422b0f37dd576522dd9a3f99b825c177efe
248
249 diff --git a/a b/a
250 --- a/a
251 +++ b/a
252 @@ -1,1 +1,1 @@
253 - a
254 + a
255 diff --git a/b b/b
256 index 78981922613b2afb6025042ff6bd878ac1994e85..f76dd238ade08917e6712764a16a22005a50573d
257 GIT binary patch
258 literal 1
259 Ic${MZ000310RR91
260
261 diff --git a/c b/c
262 --- a/c
263 +++ b/c
264 @@ -1,1 +1,2 @@
265 a
266 +
267
268 $ cd ..
269