Show More
@@ -1,290 +1,290 b'' | |||
|
1 | 1 | #require execbit |
|
2 | 2 | |
|
3 | 3 | $ cat <<EOF >> $HGRCPATH |
|
4 | 4 | > [extensions] |
|
5 | 5 | > autodiff = $TESTDIR/autodiff.py |
|
6 | 6 | > [diff] |
|
7 | 7 | > nodates = 1 |
|
8 | 8 | > EOF |
|
9 | 9 | |
|
10 | 10 | $ hg init repo |
|
11 | 11 | $ cd repo |
|
12 | 12 | |
|
13 | 13 | |
|
14 | 14 | |
|
15 | 15 | make a combination of new, changed and deleted file |
|
16 | 16 | |
|
17 | 17 | $ echo regular > regular |
|
18 | 18 | $ echo rmregular > rmregular |
|
19 | 19 | $ "$PYTHON" -c "open('bintoregular', 'wb').write(b'\0')" |
|
20 | 20 | $ touch rmempty |
|
21 | 21 | $ echo exec > exec |
|
22 | 22 | $ chmod +x exec |
|
23 | 23 | $ echo rmexec > rmexec |
|
24 | 24 | $ chmod +x rmexec |
|
25 | 25 | $ echo setexec > setexec |
|
26 | 26 | $ echo unsetexec > unsetexec |
|
27 | 27 | $ chmod +x unsetexec |
|
28 | 28 | $ echo binary > binary |
|
29 | 29 | $ "$PYTHON" -c "open('rmbinary', 'wb').write(b'\0')" |
|
30 | 30 | $ hg ci -Am addfiles |
|
31 | 31 | adding binary |
|
32 | 32 | adding bintoregular |
|
33 | 33 | adding exec |
|
34 | 34 | adding regular |
|
35 | 35 | adding rmbinary |
|
36 | 36 | adding rmempty |
|
37 | 37 | adding rmexec |
|
38 | 38 | adding rmregular |
|
39 | 39 | adding setexec |
|
40 | 40 | adding unsetexec |
|
41 | 41 | $ echo regular >> regular |
|
42 | 42 | $ echo newregular >> newregular |
|
43 | 43 | $ rm rmempty |
|
44 | 44 | $ touch newempty |
|
45 | 45 | $ rm rmregular |
|
46 | 46 | $ echo exec >> exec |
|
47 | 47 | $ echo newexec > newexec |
|
48 | 48 | $ echo bintoregular > bintoregular |
|
49 | 49 | $ chmod +x newexec |
|
50 | 50 | $ rm rmexec |
|
51 | 51 | $ chmod +x setexec |
|
52 | 52 | $ chmod -x unsetexec |
|
53 | 53 | $ "$PYTHON" -c "open('binary', 'wb').write(b'\0\0')" |
|
54 | 54 | $ "$PYTHON" -c "open('newbinary', 'wb').write(b'\0')" |
|
55 | 55 | $ rm rmbinary |
|
56 | 56 | $ hg addremove -s 0 |
|
57 | 57 | adding newbinary |
|
58 | 58 | adding newempty |
|
59 | 59 | adding newexec |
|
60 | 60 | adding newregular |
|
61 | 61 | removing rmbinary |
|
62 | 62 | removing rmempty |
|
63 | 63 | removing rmexec |
|
64 | 64 | removing rmregular |
|
65 | 65 | |
|
66 | 66 | git=no: regular diff for all files |
|
67 | 67 | |
|
68 | 68 | $ hg autodiff --git=no |
|
69 | 69 | diff -r a66d19b9302d binary |
|
70 | 70 | Binary file binary has changed |
|
71 | 71 | diff -r a66d19b9302d bintoregular |
|
72 | 72 | Binary file bintoregular has changed |
|
73 | 73 | diff -r a66d19b9302d exec |
|
74 | 74 | --- a/exec |
|
75 | 75 | +++ b/exec |
|
76 | 76 | @@ -1,1 +1,2 @@ |
|
77 | 77 | exec |
|
78 | 78 | +exec |
|
79 | 79 | diff -r a66d19b9302d newbinary |
|
80 | 80 | Binary file newbinary has changed |
|
81 | 81 | diff -r a66d19b9302d newexec |
|
82 | 82 | --- /dev/null |
|
83 | 83 | +++ b/newexec |
|
84 | 84 | @@ -0,0 +1,1 @@ |
|
85 | 85 | +newexec |
|
86 | 86 | diff -r a66d19b9302d newregular |
|
87 | 87 | --- /dev/null |
|
88 | 88 | +++ b/newregular |
|
89 | 89 | @@ -0,0 +1,1 @@ |
|
90 | 90 | +newregular |
|
91 | 91 | diff -r a66d19b9302d regular |
|
92 | 92 | --- a/regular |
|
93 | 93 | +++ b/regular |
|
94 | 94 | @@ -1,1 +1,2 @@ |
|
95 | 95 | regular |
|
96 | 96 | +regular |
|
97 | 97 | diff -r a66d19b9302d rmbinary |
|
98 | 98 | Binary file rmbinary has changed |
|
99 | 99 | diff -r a66d19b9302d rmexec |
|
100 | 100 | --- a/rmexec |
|
101 | 101 | +++ /dev/null |
|
102 | 102 | @@ -1,1 +0,0 @@ |
|
103 | 103 | -rmexec |
|
104 | 104 | diff -r a66d19b9302d rmregular |
|
105 | 105 | --- a/rmregular |
|
106 | 106 | +++ /dev/null |
|
107 | 107 | @@ -1,1 +0,0 @@ |
|
108 | 108 | -rmregular |
|
109 | 109 | |
|
110 | 110 | git=yes: git diff for single regular file |
|
111 | 111 | |
|
112 | 112 | $ hg autodiff --git=yes regular |
|
113 | 113 | diff --git a/regular b/regular |
|
114 | 114 | --- a/regular |
|
115 | 115 | +++ b/regular |
|
116 | 116 | @@ -1,1 +1,2 @@ |
|
117 | 117 | regular |
|
118 | 118 | +regular |
|
119 | 119 | |
|
120 | 120 | git=auto: regular diff for regular files and non-binary removals |
|
121 | 121 | |
|
122 | 122 | $ hg autodiff --git=auto regular newregular rmregular rmexec |
|
123 | 123 | diff -r a66d19b9302d newregular |
|
124 | 124 | --- /dev/null |
|
125 | 125 | +++ b/newregular |
|
126 | 126 | @@ -0,0 +1,1 @@ |
|
127 | 127 | +newregular |
|
128 | 128 | diff -r a66d19b9302d regular |
|
129 | 129 | --- a/regular |
|
130 | 130 | +++ b/regular |
|
131 | 131 | @@ -1,1 +1,2 @@ |
|
132 | 132 | regular |
|
133 | 133 | +regular |
|
134 | 134 | diff -r a66d19b9302d rmexec |
|
135 | 135 | --- a/rmexec |
|
136 | 136 | +++ /dev/null |
|
137 | 137 | @@ -1,1 +0,0 @@ |
|
138 | 138 | -rmexec |
|
139 | 139 | diff -r a66d19b9302d rmregular |
|
140 | 140 | --- a/rmregular |
|
141 | 141 | +++ /dev/null |
|
142 | 142 | @@ -1,1 +0,0 @@ |
|
143 | 143 | -rmregular |
|
144 | 144 | |
|
145 | 145 | $ for f in exec newexec setexec unsetexec binary newbinary newempty rmempty rmbinary bintoregular; do |
|
146 | 146 | > echo |
|
147 | 147 | > echo '% git=auto: git diff for' $f |
|
148 | 148 | > hg autodiff --git=auto $f |
|
149 | 149 | > done |
|
150 | 150 | |
|
151 | 151 | % git=auto: git diff for exec |
|
152 | 152 | diff -r a66d19b9302d exec |
|
153 | 153 | --- a/exec |
|
154 | 154 | +++ b/exec |
|
155 | 155 | @@ -1,1 +1,2 @@ |
|
156 | 156 | exec |
|
157 | 157 | +exec |
|
158 | 158 | |
|
159 | 159 | % git=auto: git diff for newexec |
|
160 | 160 | diff --git a/newexec b/newexec |
|
161 | 161 | new file mode 100755 |
|
162 | 162 | --- /dev/null |
|
163 | 163 | +++ b/newexec |
|
164 | 164 | @@ -0,0 +1,1 @@ |
|
165 | 165 | +newexec |
|
166 | 166 | |
|
167 | 167 | % git=auto: git diff for setexec |
|
168 | 168 | diff --git a/setexec b/setexec |
|
169 | 169 | old mode 100644 |
|
170 | 170 | new mode 100755 |
|
171 | 171 | |
|
172 | 172 | % git=auto: git diff for unsetexec |
|
173 | 173 | diff --git a/unsetexec b/unsetexec |
|
174 | 174 | old mode 100755 |
|
175 | 175 | new mode 100644 |
|
176 | 176 | |
|
177 | 177 | % git=auto: git diff for binary |
|
178 | 178 | diff --git a/binary b/binary |
|
179 | 179 | index a9128c283485202893f5af379dd9beccb6e79486..09f370e38f498a462e1ca0faa724559b6630c04f |
|
180 | 180 | GIT binary patch |
|
181 | 181 | literal 2 |
|
182 | 182 | Jc${Nk0000200961 |
|
183 | 183 | |
|
184 | 184 | |
|
185 | 185 | % git=auto: git diff for newbinary |
|
186 | 186 | diff --git a/newbinary b/newbinary |
|
187 | 187 | new file mode 100644 |
|
188 | index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..f76dd238ade08917e6712764a16a22005a50573d | |
|
188 | index 0000000000000000000000000000000000000000..f76dd238ade08917e6712764a16a22005a50573d | |
|
189 | 189 | GIT binary patch |
|
190 | 190 | literal 1 |
|
191 | 191 | Ic${MZ000310RR91 |
|
192 | 192 | |
|
193 | 193 | |
|
194 | 194 | % git=auto: git diff for newempty |
|
195 | 195 | diff --git a/newempty b/newempty |
|
196 | 196 | new file mode 100644 |
|
197 | 197 | |
|
198 | 198 | % git=auto: git diff for rmempty |
|
199 | 199 | diff --git a/rmempty b/rmempty |
|
200 | 200 | deleted file mode 100644 |
|
201 | 201 | |
|
202 | 202 | % git=auto: git diff for rmbinary |
|
203 | 203 | diff --git a/rmbinary b/rmbinary |
|
204 | 204 | deleted file mode 100644 |
|
205 | index f76dd238ade08917e6712764a16a22005a50573d..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 | |
|
205 | index f76dd238ade08917e6712764a16a22005a50573d..0000000000000000000000000000000000000000 | |
|
206 | 206 | GIT binary patch |
|
207 | 207 | literal 0 |
|
208 | 208 | Hc$@<O00001 |
|
209 | 209 | |
|
210 | 210 | |
|
211 | 211 | % git=auto: git diff for bintoregular |
|
212 | 212 | diff --git a/bintoregular b/bintoregular |
|
213 | 213 | index f76dd238ade08917e6712764a16a22005a50573d..9c42f2b6427d8bf034b7bc23986152dc01bfd3ab |
|
214 | 214 | GIT binary patch |
|
215 | 215 | literal 13 |
|
216 | 216 | Uc$`bh%qz(+N=+}#Ni5<5043uE82|tP |
|
217 | 217 | |
|
218 | 218 | |
|
219 | 219 | |
|
220 | 220 | git=warn: regular diff with data loss warnings |
|
221 | 221 | |
|
222 | 222 | $ hg autodiff --git=warn |
|
223 | 223 | diff -r a66d19b9302d binary |
|
224 | 224 | Binary file binary has changed |
|
225 | 225 | diff -r a66d19b9302d bintoregular |
|
226 | 226 | Binary file bintoregular has changed |
|
227 | 227 | diff -r a66d19b9302d exec |
|
228 | 228 | --- a/exec |
|
229 | 229 | +++ b/exec |
|
230 | 230 | @@ -1,1 +1,2 @@ |
|
231 | 231 | exec |
|
232 | 232 | +exec |
|
233 | 233 | diff -r a66d19b9302d newbinary |
|
234 | 234 | Binary file newbinary has changed |
|
235 | 235 | diff -r a66d19b9302d newexec |
|
236 | 236 | --- /dev/null |
|
237 | 237 | +++ b/newexec |
|
238 | 238 | @@ -0,0 +1,1 @@ |
|
239 | 239 | +newexec |
|
240 | 240 | diff -r a66d19b9302d newregular |
|
241 | 241 | --- /dev/null |
|
242 | 242 | +++ b/newregular |
|
243 | 243 | @@ -0,0 +1,1 @@ |
|
244 | 244 | +newregular |
|
245 | 245 | diff -r a66d19b9302d regular |
|
246 | 246 | --- a/regular |
|
247 | 247 | +++ b/regular |
|
248 | 248 | @@ -1,1 +1,2 @@ |
|
249 | 249 | regular |
|
250 | 250 | +regular |
|
251 | 251 | diff -r a66d19b9302d rmbinary |
|
252 | 252 | Binary file rmbinary has changed |
|
253 | 253 | diff -r a66d19b9302d rmexec |
|
254 | 254 | --- a/rmexec |
|
255 | 255 | +++ /dev/null |
|
256 | 256 | @@ -1,1 +0,0 @@ |
|
257 | 257 | -rmexec |
|
258 | 258 | diff -r a66d19b9302d rmregular |
|
259 | 259 | --- a/rmregular |
|
260 | 260 | +++ /dev/null |
|
261 | 261 | @@ -1,1 +0,0 @@ |
|
262 | 262 | -rmregular |
|
263 | 263 | data lost for: binary |
|
264 | 264 | data lost for: bintoregular |
|
265 | 265 | data lost for: newbinary |
|
266 | 266 | data lost for: newempty |
|
267 | 267 | data lost for: newexec |
|
268 | 268 | data lost for: rmbinary |
|
269 | 269 | data lost for: rmempty |
|
270 | 270 | data lost for: setexec |
|
271 | 271 | data lost for: unsetexec |
|
272 | 272 | |
|
273 | 273 | git=abort: fail on execute bit change |
|
274 | 274 | |
|
275 | 275 | $ hg autodiff --git=abort regular setexec |
|
276 | 276 | abort: losing data for setexec |
|
277 | 277 | [255] |
|
278 | 278 | |
|
279 | 279 | git=abort: succeed on regular file |
|
280 | 280 | |
|
281 | 281 | $ hg autodiff --git=abort regular |
|
282 | 282 | diff -r a66d19b9302d regular |
|
283 | 283 | --- a/regular |
|
284 | 284 | +++ b/regular |
|
285 | 285 | @@ -1,1 +1,2 @@ |
|
286 | 286 | regular |
|
287 | 287 | +regular |
|
288 | 288 | |
|
289 | 289 | $ cd .. |
|
290 | 290 |
@@ -1,294 +1,294 b'' | |||
|
1 | 1 | $ hg init repo |
|
2 | 2 | $ cd repo |
|
3 | 3 | $ i=0; while [ "$i" -lt 213 ]; do echo a >> a; i=`expr $i + 1`; done |
|
4 | 4 | $ hg add a |
|
5 | 5 | $ cp a b |
|
6 | 6 | $ hg add b |
|
7 | 7 | |
|
8 | 8 | Wide diffstat: |
|
9 | 9 | |
|
10 | 10 | $ hg diff --stat |
|
11 | 11 | a | 213 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
12 | 12 | b | 213 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
13 | 13 | 2 files changed, 426 insertions(+), 0 deletions(-) |
|
14 | 14 | |
|
15 | 15 | diffstat width: |
|
16 | 16 | |
|
17 | 17 | $ COLUMNS=24 hg diff --config ui.interactive=true --stat |
|
18 | 18 | a | 213 ++++++++++++++ |
|
19 | 19 | b | 213 ++++++++++++++ |
|
20 | 20 | 2 files changed, 426 insertions(+), 0 deletions(-) |
|
21 | 21 | |
|
22 | 22 | $ hg ci -m adda |
|
23 | 23 | |
|
24 | 24 | $ cat >> a <<EOF |
|
25 | 25 | > a |
|
26 | 26 | > a |
|
27 | 27 | > a |
|
28 | 28 | > EOF |
|
29 | 29 | |
|
30 | 30 | Narrow diffstat: |
|
31 | 31 | |
|
32 | 32 | $ hg diff --stat |
|
33 | 33 | a | 3 +++ |
|
34 | 34 | 1 files changed, 3 insertions(+), 0 deletions(-) |
|
35 | 35 | |
|
36 | 36 | $ hg ci -m appenda |
|
37 | 37 | |
|
38 | 38 | >>> open("c", "wb").write(b"\0") and None |
|
39 | 39 | $ touch d |
|
40 | 40 | $ hg add c d |
|
41 | 41 | |
|
42 | 42 | Binary diffstat: |
|
43 | 43 | |
|
44 | 44 | $ hg diff --stat |
|
45 | 45 | c | Bin |
|
46 | 46 | 1 files changed, 0 insertions(+), 0 deletions(-) |
|
47 | 47 | |
|
48 | 48 | Binary git diffstat: |
|
49 | 49 | |
|
50 | 50 | $ hg diff --stat --git |
|
51 | 51 | c | Bin |
|
52 | 52 | d | 0 |
|
53 | 53 | 2 files changed, 0 insertions(+), 0 deletions(-) |
|
54 | 54 | |
|
55 | 55 | $ hg ci -m createb |
|
56 | 56 | |
|
57 | 57 | >>> open("file with spaces", "wb").write(b"\0") and None |
|
58 | 58 | $ hg add "file with spaces" |
|
59 | 59 | |
|
60 | 60 | Filename with spaces diffstat: |
|
61 | 61 | |
|
62 | 62 | $ hg diff --stat |
|
63 | 63 | file with spaces | Bin |
|
64 | 64 | 1 files changed, 0 insertions(+), 0 deletions(-) |
|
65 | 65 | |
|
66 | 66 | Filename with spaces git diffstat: |
|
67 | 67 | |
|
68 | 68 | $ hg diff --stat --git |
|
69 | 69 | file with spaces | Bin |
|
70 | 70 | 1 files changed, 0 insertions(+), 0 deletions(-) |
|
71 | 71 | |
|
72 | 72 | Filename without "a/" or "b/" (issue5759): |
|
73 | 73 | |
|
74 | 74 | $ hg diff --config 'diff.noprefix=1' -c1 --stat --git |
|
75 | 75 | a | 3 +++ |
|
76 | 76 | 1 files changed, 3 insertions(+), 0 deletions(-) |
|
77 | 77 | $ hg diff --config 'diff.noprefix=1' -c2 --stat --git |
|
78 | 78 | c | Bin |
|
79 | 79 | d | 0 |
|
80 | 80 | 2 files changed, 0 insertions(+), 0 deletions(-) |
|
81 | 81 | |
|
82 | 82 | $ hg log --config 'diff.noprefix=1' -r '1:' -p --stat --git |
|
83 | 83 | changeset: 1:3a95b07bb77f |
|
84 | 84 | user: test |
|
85 | 85 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
86 | 86 | summary: appenda |
|
87 | 87 | |
|
88 | 88 | a | 3 +++ |
|
89 | 89 | 1 files changed, 3 insertions(+), 0 deletions(-) |
|
90 | 90 | |
|
91 | 91 | diff --git a a |
|
92 | 92 | --- a |
|
93 | 93 | +++ a |
|
94 | 94 | @@ -211,3 +211,6 @@ |
|
95 | 95 | a |
|
96 | 96 | a |
|
97 | 97 | a |
|
98 | 98 | +a |
|
99 | 99 | +a |
|
100 | 100 | +a |
|
101 | 101 | |
|
102 | 102 | changeset: 2:c60a6c753773 |
|
103 | 103 | tag: tip |
|
104 | 104 | user: test |
|
105 | 105 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
106 | 106 | summary: createb |
|
107 | 107 | |
|
108 | 108 | c | Bin |
|
109 | 109 | d | 0 |
|
110 | 110 | 2 files changed, 0 insertions(+), 0 deletions(-) |
|
111 | 111 | |
|
112 | 112 | diff --git c c |
|
113 | 113 | new file mode 100644 |
|
114 | index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..f76dd238ade08917e6712764a16a22005a50573d | |
|
114 | index 0000000000000000000000000000000000000000..f76dd238ade08917e6712764a16a22005a50573d | |
|
115 | 115 | GIT binary patch |
|
116 | 116 | literal 1 |
|
117 | 117 | Ic${MZ000310RR91 |
|
118 | 118 | |
|
119 | 119 | diff --git d d |
|
120 | 120 | new file mode 100644 |
|
121 | 121 | |
|
122 | 122 | |
|
123 | 123 | diffstat within directories: |
|
124 | 124 | |
|
125 | 125 | $ hg rm -f 'file with spaces' |
|
126 | 126 | |
|
127 | 127 | $ mkdir dir1 dir2 |
|
128 | 128 | $ echo new1 > dir1/new |
|
129 | 129 | $ echo new2 > dir2/new |
|
130 | 130 | $ hg add dir1/new dir2/new |
|
131 | 131 | $ hg diff --stat |
|
132 | 132 | dir1/new | 1 + |
|
133 | 133 | dir2/new | 1 + |
|
134 | 134 | 2 files changed, 2 insertions(+), 0 deletions(-) |
|
135 | 135 | |
|
136 | 136 | $ hg diff --stat --root dir1 |
|
137 | 137 | new | 1 + |
|
138 | 138 | 1 files changed, 1 insertions(+), 0 deletions(-) |
|
139 | 139 | |
|
140 | 140 | $ hg diff --stat --root dir1 dir2 |
|
141 | 141 | warning: dir2 not inside relative root dir1 |
|
142 | 142 | |
|
143 | 143 | $ hg diff --stat --root dir1 -I dir1/old |
|
144 | 144 | |
|
145 | 145 | $ cd dir1 |
|
146 | 146 | $ hg diff --stat . |
|
147 | 147 | dir1/new | 1 + |
|
148 | 148 | 1 files changed, 1 insertions(+), 0 deletions(-) |
|
149 | 149 | $ hg diff --stat . --config ui.relative-paths=yes |
|
150 | 150 | new | 1 + |
|
151 | 151 | 1 files changed, 1 insertions(+), 0 deletions(-) |
|
152 | 152 | $ hg diff --stat --root . |
|
153 | 153 | new | 1 + |
|
154 | 154 | 1 files changed, 1 insertions(+), 0 deletions(-) |
|
155 | 155 | |
|
156 | 156 | $ hg diff --stat --root . --config ui.relative-paths=yes |
|
157 | 157 | new | 1 + |
|
158 | 158 | 1 files changed, 1 insertions(+), 0 deletions(-) |
|
159 | 159 | --root trumps ui.relative-paths |
|
160 | 160 | $ hg diff --stat --root .. --config ui.relative-paths=yes |
|
161 | 161 | new | 1 + |
|
162 | 162 | ../dir2/new | 1 + |
|
163 | 163 | 2 files changed, 2 insertions(+), 0 deletions(-) |
|
164 | 164 | $ hg diff --stat --root ../dir1 ../dir2 |
|
165 | 165 | warning: ../dir2 not inside relative root . |
|
166 | 166 | |
|
167 | 167 | $ hg diff --stat --root . -I old |
|
168 | 168 | |
|
169 | 169 | $ cd .. |
|
170 | 170 | |
|
171 | 171 | Files with lines beginning with '--' or '++' should be properly counted in diffstat |
|
172 | 172 | |
|
173 | 173 | $ hg up -Cr tip |
|
174 | 174 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
175 | 175 | $ rm dir1/new |
|
176 | 176 | $ rm dir2/new |
|
177 | 177 | $ rm "file with spaces" |
|
178 | 178 | $ cat > file << EOF |
|
179 | 179 | > line 1 |
|
180 | 180 | > line 2 |
|
181 | 181 | > line 3 |
|
182 | 182 | > EOF |
|
183 | 183 | $ hg commit -Am file |
|
184 | 184 | adding file |
|
185 | 185 | |
|
186 | 186 | Lines added starting with '--' should count as additions |
|
187 | 187 | $ cat > file << EOF |
|
188 | 188 | > line 1 |
|
189 | 189 | > -- line 2, with dashes |
|
190 | 190 | > line 3 |
|
191 | 191 | > EOF |
|
192 | 192 | |
|
193 | 193 | $ hg diff --root . |
|
194 | 194 | diff -r be1569354b24 file |
|
195 | 195 | --- a/file Thu Jan 01 00:00:00 1970 +0000 |
|
196 | 196 | +++ b/file * (glob) |
|
197 | 197 | @@ -1,3 +1,3 @@ |
|
198 | 198 | line 1 |
|
199 | 199 | -line 2 |
|
200 | 200 | +-- line 2, with dashes |
|
201 | 201 | line 3 |
|
202 | 202 | |
|
203 | 203 | $ hg diff --root . --stat |
|
204 | 204 | file | 2 +- |
|
205 | 205 | 1 files changed, 1 insertions(+), 1 deletions(-) |
|
206 | 206 | |
|
207 | 207 | Lines changed starting with '--' should count as deletions |
|
208 | 208 | $ hg commit -m filev2 |
|
209 | 209 | $ cat > file << EOF |
|
210 | 210 | > line 1 |
|
211 | 211 | > -- line 2, with dashes, changed again |
|
212 | 212 | > line 3 |
|
213 | 213 | > EOF |
|
214 | 214 | |
|
215 | 215 | $ hg diff --root . |
|
216 | 216 | diff -r 160f7c034df6 file |
|
217 | 217 | --- a/file Thu Jan 01 00:00:00 1970 +0000 |
|
218 | 218 | +++ b/file * (glob) |
|
219 | 219 | @@ -1,3 +1,3 @@ |
|
220 | 220 | line 1 |
|
221 | 221 | --- line 2, with dashes |
|
222 | 222 | +-- line 2, with dashes, changed again |
|
223 | 223 | line 3 |
|
224 | 224 | |
|
225 | 225 | $ hg diff --root . --stat |
|
226 | 226 | file | 2 +- |
|
227 | 227 | 1 files changed, 1 insertions(+), 1 deletions(-) |
|
228 | 228 | |
|
229 | 229 | Lines changed starting with '--' should count as deletions |
|
230 | 230 | and starting with '++' should count as additions |
|
231 | 231 | $ cat > file << EOF |
|
232 | 232 | > line 1 |
|
233 | 233 | > ++ line 2, switched dashes to plusses |
|
234 | 234 | > line 3 |
|
235 | 235 | > EOF |
|
236 | 236 | |
|
237 | 237 | $ hg diff --root . |
|
238 | 238 | diff -r 160f7c034df6 file |
|
239 | 239 | --- a/file Thu Jan 01 00:00:00 1970 +0000 |
|
240 | 240 | +++ b/file * (glob) |
|
241 | 241 | @@ -1,3 +1,3 @@ |
|
242 | 242 | line 1 |
|
243 | 243 | --- line 2, with dashes |
|
244 | 244 | +++ line 2, switched dashes to plusses |
|
245 | 245 | line 3 |
|
246 | 246 | |
|
247 | 247 | $ hg diff --root . --stat |
|
248 | 248 | file | 2 +- |
|
249 | 249 | 1 files changed, 1 insertions(+), 1 deletions(-) |
|
250 | 250 | |
|
251 | 251 | When a file is renamed, --git shouldn't loss the info about old file |
|
252 | 252 | $ hg init issue6025 |
|
253 | 253 | $ cd issue6025 |
|
254 | 254 | $ echo > a |
|
255 | 255 | $ hg ci -Am 'add a' |
|
256 | 256 | adding a |
|
257 | 257 | $ hg mv a b |
|
258 | 258 | $ hg diff --git |
|
259 | 259 | diff --git a/a b/b |
|
260 | 260 | rename from a |
|
261 | 261 | rename to b |
|
262 | 262 | $ hg diff --stat |
|
263 | 263 | a | 1 - |
|
264 | 264 | b | 1 + |
|
265 | 265 | 2 files changed, 1 insertions(+), 1 deletions(-) |
|
266 | 266 | $ hg diff --stat --git |
|
267 | 267 | a => b | 0 |
|
268 | 268 | 1 files changed, 0 insertions(+), 0 deletions(-) |
|
269 | 269 | -- filename may contain whitespaces |
|
270 | 270 | $ echo > c |
|
271 | 271 | $ hg ci -Am 'add c' |
|
272 | 272 | adding c |
|
273 | 273 | $ hg mv c 'new c' |
|
274 | 274 | $ hg diff --git |
|
275 | 275 | diff --git a/c b/new c |
|
276 | 276 | rename from c |
|
277 | 277 | rename to new c |
|
278 | 278 | $ hg diff --stat |
|
279 | 279 | c | 1 - |
|
280 | 280 | new c | 1 + |
|
281 | 281 | 2 files changed, 1 insertions(+), 1 deletions(-) |
|
282 | 282 | $ hg diff --stat --git |
|
283 | 283 | c => new c | 0 |
|
284 | 284 | 1 files changed, 0 insertions(+), 0 deletions(-) |
|
285 | 285 | |
|
286 | 286 | Make sure `diff --stat -q --config diff.git-0` shows stat (issue4037) |
|
287 | 287 | |
|
288 | 288 | $ hg status |
|
289 | 289 | A new c |
|
290 | 290 | R c |
|
291 | 291 | $ hg diff --stat -q |
|
292 | 292 | c | 1 - |
|
293 | 293 | new c | 1 + |
|
294 | 294 | 2 files changed, 1 insertions(+), 1 deletions(-) |
@@ -1,615 +1,615 b'' | |||
|
1 | 1 | $ hg init |
|
2 | 2 | $ echo start > start |
|
3 | 3 | $ hg ci -Amstart |
|
4 | 4 | adding start |
|
5 | 5 | |
|
6 | 6 | New file: |
|
7 | 7 | |
|
8 | 8 | $ mkdir dir1 |
|
9 | 9 | $ echo new > dir1/new |
|
10 | 10 | $ hg ci -Amnew |
|
11 | 11 | adding dir1/new |
|
12 | 12 | $ hg diff --git -r 0 |
|
13 | 13 | diff --git a/dir1/new b/dir1/new |
|
14 | 14 | new file mode 100644 |
|
15 | 15 | --- /dev/null |
|
16 | 16 | +++ b/dir1/new |
|
17 | 17 | @@ -0,0 +1,1 @@ |
|
18 | 18 | +new |
|
19 | 19 | |
|
20 | 20 | Copy: |
|
21 | 21 | |
|
22 | 22 | $ mkdir dir2 |
|
23 | 23 | $ hg cp dir1/new dir1/copy |
|
24 | 24 | $ echo copy1 >> dir1/copy |
|
25 | 25 | $ hg cp dir1/new dir2/copy |
|
26 | 26 | $ echo copy2 >> dir2/copy |
|
27 | 27 | $ hg ci -mcopy |
|
28 | 28 | $ hg diff --git -r 1:tip |
|
29 | 29 | diff --git a/dir1/new b/dir1/copy |
|
30 | 30 | copy from dir1/new |
|
31 | 31 | copy to dir1/copy |
|
32 | 32 | --- a/dir1/new |
|
33 | 33 | +++ b/dir1/copy |
|
34 | 34 | @@ -1,1 +1,2 @@ |
|
35 | 35 | new |
|
36 | 36 | +copy1 |
|
37 | 37 | diff --git a/dir1/new b/dir2/copy |
|
38 | 38 | copy from dir1/new |
|
39 | 39 | copy to dir2/copy |
|
40 | 40 | --- a/dir1/new |
|
41 | 41 | +++ b/dir2/copy |
|
42 | 42 | @@ -1,1 +1,2 @@ |
|
43 | 43 | new |
|
44 | 44 | +copy2 |
|
45 | 45 | |
|
46 | 46 | Cross and same-directory copies with a relative root: |
|
47 | 47 | |
|
48 | 48 | $ hg diff --git --root .. -r 1:tip |
|
49 | 49 | abort: .. not under root '$TESTTMP' |
|
50 | 50 | [255] |
|
51 | 51 | $ hg diff --git --root doesnotexist -r 1:tip |
|
52 | 52 | $ hg diff --git --root . -r 1:tip |
|
53 | 53 | diff --git a/dir1/new b/dir1/copy |
|
54 | 54 | copy from dir1/new |
|
55 | 55 | copy to dir1/copy |
|
56 | 56 | --- a/dir1/new |
|
57 | 57 | +++ b/dir1/copy |
|
58 | 58 | @@ -1,1 +1,2 @@ |
|
59 | 59 | new |
|
60 | 60 | +copy1 |
|
61 | 61 | diff --git a/dir1/new b/dir2/copy |
|
62 | 62 | copy from dir1/new |
|
63 | 63 | copy to dir2/copy |
|
64 | 64 | --- a/dir1/new |
|
65 | 65 | +++ b/dir2/copy |
|
66 | 66 | @@ -1,1 +1,2 @@ |
|
67 | 67 | new |
|
68 | 68 | +copy2 |
|
69 | 69 | $ hg diff --git --root dir1 -r 1:tip |
|
70 | 70 | diff --git a/new b/copy |
|
71 | 71 | copy from new |
|
72 | 72 | copy to copy |
|
73 | 73 | --- a/new |
|
74 | 74 | +++ b/copy |
|
75 | 75 | @@ -1,1 +1,2 @@ |
|
76 | 76 | new |
|
77 | 77 | +copy1 |
|
78 | 78 | |
|
79 | 79 | $ hg diff --git --root dir2/ -r 1:tip |
|
80 | 80 | diff --git a/copy b/copy |
|
81 | 81 | new file mode 100644 |
|
82 | 82 | --- /dev/null |
|
83 | 83 | +++ b/copy |
|
84 | 84 | @@ -0,0 +1,2 @@ |
|
85 | 85 | +new |
|
86 | 86 | +copy2 |
|
87 | 87 | |
|
88 | 88 | $ hg diff --git --root dir1 -r 1:tip -I '**/copy' |
|
89 | 89 | diff --git a/new b/copy |
|
90 | 90 | copy from new |
|
91 | 91 | copy to copy |
|
92 | 92 | --- a/new |
|
93 | 93 | +++ b/copy |
|
94 | 94 | @@ -1,1 +1,2 @@ |
|
95 | 95 | new |
|
96 | 96 | +copy1 |
|
97 | 97 | |
|
98 | 98 | $ hg diff --git --root dir1 -r 1:tip dir2 |
|
99 | 99 | warning: dir2 not inside relative root dir1 |
|
100 | 100 | |
|
101 | 101 | $ hg diff --git --root dir1 -r 1:tip 'dir2/{copy}' |
|
102 | 102 | warning: dir2/{copy} not inside relative root dir1 |
|
103 | 103 | |
|
104 | 104 | $ cd dir1 |
|
105 | 105 | $ hg diff --git --root .. -r 1:tip |
|
106 | 106 | diff --git a/dir1/new b/dir1/copy |
|
107 | 107 | copy from dir1/new |
|
108 | 108 | copy to dir1/copy |
|
109 | 109 | --- a/dir1/new |
|
110 | 110 | +++ b/dir1/copy |
|
111 | 111 | @@ -1,1 +1,2 @@ |
|
112 | 112 | new |
|
113 | 113 | +copy1 |
|
114 | 114 | diff --git a/dir1/new b/dir2/copy |
|
115 | 115 | copy from dir1/new |
|
116 | 116 | copy to dir2/copy |
|
117 | 117 | --- a/dir1/new |
|
118 | 118 | +++ b/dir2/copy |
|
119 | 119 | @@ -1,1 +1,2 @@ |
|
120 | 120 | new |
|
121 | 121 | +copy2 |
|
122 | 122 | |
|
123 | 123 | $ hg diff --git --root ../.. -r 1:tip |
|
124 | 124 | abort: ../.. not under root '$TESTTMP' |
|
125 | 125 | [255] |
|
126 | 126 | $ hg diff --git --root ../doesnotexist -r 1:tip |
|
127 | 127 | $ hg diff --git --root .. -r 1:tip |
|
128 | 128 | diff --git a/dir1/new b/dir1/copy |
|
129 | 129 | copy from dir1/new |
|
130 | 130 | copy to dir1/copy |
|
131 | 131 | --- a/dir1/new |
|
132 | 132 | +++ b/dir1/copy |
|
133 | 133 | @@ -1,1 +1,2 @@ |
|
134 | 134 | new |
|
135 | 135 | +copy1 |
|
136 | 136 | diff --git a/dir1/new b/dir2/copy |
|
137 | 137 | copy from dir1/new |
|
138 | 138 | copy to dir2/copy |
|
139 | 139 | --- a/dir1/new |
|
140 | 140 | +++ b/dir2/copy |
|
141 | 141 | @@ -1,1 +1,2 @@ |
|
142 | 142 | new |
|
143 | 143 | +copy2 |
|
144 | 144 | |
|
145 | 145 | $ hg diff --git --root . -r 1:tip |
|
146 | 146 | diff --git a/new b/copy |
|
147 | 147 | copy from new |
|
148 | 148 | copy to copy |
|
149 | 149 | --- a/new |
|
150 | 150 | +++ b/copy |
|
151 | 151 | @@ -1,1 +1,2 @@ |
|
152 | 152 | new |
|
153 | 153 | +copy1 |
|
154 | 154 | $ hg diff --git --root . -r 1:tip copy |
|
155 | 155 | diff --git a/new b/copy |
|
156 | 156 | copy from new |
|
157 | 157 | copy to copy |
|
158 | 158 | --- a/new |
|
159 | 159 | +++ b/copy |
|
160 | 160 | @@ -1,1 +1,2 @@ |
|
161 | 161 | new |
|
162 | 162 | +copy1 |
|
163 | 163 | $ hg diff --git --root . -r 1:tip ../dir2 |
|
164 | 164 | warning: ../dir2 not inside relative root . |
|
165 | 165 | $ hg diff --git --root . -r 1:tip '../dir2/*' |
|
166 | 166 | warning: ../dir2/* not inside relative root . (glob) |
|
167 | 167 | $ cd .. |
|
168 | 168 | |
|
169 | 169 | Rename: |
|
170 | 170 | |
|
171 | 171 | $ hg mv dir1/copy dir1/rename1 |
|
172 | 172 | $ echo rename1 >> dir1/rename1 |
|
173 | 173 | $ hg mv dir2/copy dir1/rename2 |
|
174 | 174 | $ echo rename2 >> dir1/rename2 |
|
175 | 175 | $ hg ci -mrename |
|
176 | 176 | $ hg diff --git -r 2:tip |
|
177 | 177 | diff --git a/dir1/copy b/dir1/rename1 |
|
178 | 178 | rename from dir1/copy |
|
179 | 179 | rename to dir1/rename1 |
|
180 | 180 | --- a/dir1/copy |
|
181 | 181 | +++ b/dir1/rename1 |
|
182 | 182 | @@ -1,2 +1,3 @@ |
|
183 | 183 | new |
|
184 | 184 | copy1 |
|
185 | 185 | +rename1 |
|
186 | 186 | diff --git a/dir2/copy b/dir1/rename2 |
|
187 | 187 | rename from dir2/copy |
|
188 | 188 | rename to dir1/rename2 |
|
189 | 189 | --- a/dir2/copy |
|
190 | 190 | +++ b/dir1/rename2 |
|
191 | 191 | @@ -1,2 +1,3 @@ |
|
192 | 192 | new |
|
193 | 193 | copy2 |
|
194 | 194 | +rename2 |
|
195 | 195 | |
|
196 | 196 | Cross and same-directory renames with a relative root: |
|
197 | 197 | |
|
198 | 198 | $ hg diff --root dir1 --git -r 2:tip |
|
199 | 199 | diff --git a/copy b/rename1 |
|
200 | 200 | rename from copy |
|
201 | 201 | rename to rename1 |
|
202 | 202 | --- a/copy |
|
203 | 203 | +++ b/rename1 |
|
204 | 204 | @@ -1,2 +1,3 @@ |
|
205 | 205 | new |
|
206 | 206 | copy1 |
|
207 | 207 | +rename1 |
|
208 | 208 | diff --git a/rename2 b/rename2 |
|
209 | 209 | new file mode 100644 |
|
210 | 210 | --- /dev/null |
|
211 | 211 | +++ b/rename2 |
|
212 | 212 | @@ -0,0 +1,3 @@ |
|
213 | 213 | +new |
|
214 | 214 | +copy2 |
|
215 | 215 | +rename2 |
|
216 | 216 | |
|
217 | 217 | $ hg diff --root dir2 --git -r 2:tip |
|
218 | 218 | diff --git a/copy b/copy |
|
219 | 219 | deleted file mode 100644 |
|
220 | 220 | --- a/copy |
|
221 | 221 | +++ /dev/null |
|
222 | 222 | @@ -1,2 +0,0 @@ |
|
223 | 223 | -new |
|
224 | 224 | -copy2 |
|
225 | 225 | |
|
226 | 226 | $ hg diff --root dir1 --git -r 2:tip -I '**/copy' |
|
227 | 227 | diff --git a/copy b/copy |
|
228 | 228 | deleted file mode 100644 |
|
229 | 229 | --- a/copy |
|
230 | 230 | +++ /dev/null |
|
231 | 231 | @@ -1,2 +0,0 @@ |
|
232 | 232 | -new |
|
233 | 233 | -copy1 |
|
234 | 234 | |
|
235 | 235 | $ hg diff --root dir1 --git -r 2:tip -I '**/rename*' |
|
236 | 236 | diff --git a/copy b/rename1 |
|
237 | 237 | copy from copy |
|
238 | 238 | copy to rename1 |
|
239 | 239 | --- a/copy |
|
240 | 240 | +++ b/rename1 |
|
241 | 241 | @@ -1,2 +1,3 @@ |
|
242 | 242 | new |
|
243 | 243 | copy1 |
|
244 | 244 | +rename1 |
|
245 | 245 | diff --git a/rename2 b/rename2 |
|
246 | 246 | new file mode 100644 |
|
247 | 247 | --- /dev/null |
|
248 | 248 | +++ b/rename2 |
|
249 | 249 | @@ -0,0 +1,3 @@ |
|
250 | 250 | +new |
|
251 | 251 | +copy2 |
|
252 | 252 | +rename2 |
|
253 | 253 | |
|
254 | 254 | Delete: |
|
255 | 255 | |
|
256 | 256 | $ hg rm dir1/* |
|
257 | 257 | $ hg ci -mdelete |
|
258 | 258 | $ hg diff --git -r 3:tip |
|
259 | 259 | diff --git a/dir1/new b/dir1/new |
|
260 | 260 | deleted file mode 100644 |
|
261 | 261 | --- a/dir1/new |
|
262 | 262 | +++ /dev/null |
|
263 | 263 | @@ -1,1 +0,0 @@ |
|
264 | 264 | -new |
|
265 | 265 | diff --git a/dir1/rename1 b/dir1/rename1 |
|
266 | 266 | deleted file mode 100644 |
|
267 | 267 | --- a/dir1/rename1 |
|
268 | 268 | +++ /dev/null |
|
269 | 269 | @@ -1,3 +0,0 @@ |
|
270 | 270 | -new |
|
271 | 271 | -copy1 |
|
272 | 272 | -rename1 |
|
273 | 273 | diff --git a/dir1/rename2 b/dir1/rename2 |
|
274 | 274 | deleted file mode 100644 |
|
275 | 275 | --- a/dir1/rename2 |
|
276 | 276 | +++ /dev/null |
|
277 | 277 | @@ -1,3 +0,0 @@ |
|
278 | 278 | -new |
|
279 | 279 | -copy2 |
|
280 | 280 | -rename2 |
|
281 | 281 | |
|
282 | 282 | $ cat > src <<EOF |
|
283 | 283 | > 1 |
|
284 | 284 | > 2 |
|
285 | 285 | > 3 |
|
286 | 286 | > 4 |
|
287 | 287 | > 5 |
|
288 | 288 | > EOF |
|
289 | 289 | $ hg ci -Amsrc |
|
290 | 290 | adding src |
|
291 | 291 | |
|
292 | 292 | #if execbit |
|
293 | 293 | |
|
294 | 294 | chmod 644: |
|
295 | 295 | |
|
296 | 296 | $ chmod +x src |
|
297 | 297 | $ hg ci -munexec |
|
298 | 298 | $ hg diff --git -r 5:tip |
|
299 | 299 | diff --git a/src b/src |
|
300 | 300 | old mode 100644 |
|
301 | 301 | new mode 100755 |
|
302 | 302 | |
|
303 | 303 | Rename+mod+chmod: |
|
304 | 304 | |
|
305 | 305 | $ hg mv src dst |
|
306 | 306 | $ chmod -x dst |
|
307 | 307 | $ echo a >> dst |
|
308 | 308 | $ hg ci -mrenamemod |
|
309 | 309 | $ hg diff --git -r 6:tip |
|
310 | 310 | diff --git a/src b/dst |
|
311 | 311 | old mode 100755 |
|
312 | 312 | new mode 100644 |
|
313 | 313 | rename from src |
|
314 | 314 | rename to dst |
|
315 | 315 | --- a/src |
|
316 | 316 | +++ b/dst |
|
317 | 317 | @@ -3,3 +3,4 @@ |
|
318 | 318 | 3 |
|
319 | 319 | 4 |
|
320 | 320 | 5 |
|
321 | 321 | +a |
|
322 | 322 | |
|
323 | 323 | Nonexistent in tip+chmod: |
|
324 | 324 | |
|
325 | 325 | $ hg diff --git -r 5:6 |
|
326 | 326 | diff --git a/src b/src |
|
327 | 327 | old mode 100644 |
|
328 | 328 | new mode 100755 |
|
329 | 329 | |
|
330 | 330 | #else |
|
331 | 331 | |
|
332 | 332 | Dummy changes when no exec bit, mocking the execbit commit structure |
|
333 | 333 | |
|
334 | 334 | $ echo change >> src |
|
335 | 335 | $ hg ci -munexec |
|
336 | 336 | $ hg mv src dst |
|
337 | 337 | $ hg ci -mrenamemod |
|
338 | 338 | |
|
339 | 339 | #endif |
|
340 | 340 | |
|
341 | 341 | Binary diff: |
|
342 | 342 | |
|
343 | 343 | $ cp "$TESTDIR/binfile.bin" . |
|
344 | 344 | $ hg add binfile.bin |
|
345 | 345 | $ hg diff --git > b.diff |
|
346 | 346 | $ cat b.diff |
|
347 | 347 | diff --git a/binfile.bin b/binfile.bin |
|
348 | 348 | new file mode 100644 |
|
349 | index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..37ba3d1c6f17137d9c5f5776fa040caf5fe73ff9 | |
|
349 | index 0000000000000000000000000000000000000000..37ba3d1c6f17137d9c5f5776fa040caf5fe73ff9 | |
|
350 | 350 | GIT binary patch |
|
351 | 351 | literal 593 |
|
352 | 352 | zc$@)I0<QguP)<h;3K|Lk000e1NJLTq000mG000mO0ssI2kdbIM00009a7bBm000XU |
|
353 | 353 | z000XU0RWnu7ytkO2XskIMF-Uh9TW;VpMjwv0005-Nkl<ZD9@FWPs=e;7{<>W$NUkd |
|
354 | 354 | zX$nnYLt$-$V!?uy+1V%`z&Eh=ah|duER<4|QWhju3gb^nF*8iYobxWG-qqXl=2~5M |
|
355 | 355 | z*IoDB)sG^CfNuoBmqLTVU^<;@nwHP!1wrWd`{(mHo6VNXWtyh{alzqmsH*yYzpvLT |
|
356 | 356 | zLdY<T=ks|woh-`&01!ej#(xbV1f|pI*=%;d-%F*E*X#ZH`4I%6SS+$EJDE&ct=8po |
|
357 | 357 | ziN#{?_j|kD%Cd|oiqds`xm@;oJ-^?NG3Gdqrs?5u*zI;{nogxsx~^|Fn^Y?Gdc6<; |
|
358 | 358 | zfMJ+iF1J`LMx&A2?dEwNW8ClebzPTbIh{@$hS6*`kH@1d%Lo7fA#}N1)oN7`gm$~V |
|
359 | 359 | z+wDx#)OFqMcE{s!JN0-xhG8ItAjVkJwEcb`3WWlJfU2r?;Pd%dmR+q@mSri5q9_W- |
|
360 | 360 | zaR2~ECX?B2w+zELozC0s*6Z~|QG^f{3I#<`?)Q7U-JZ|q5W;9Q8i_=pBuSzunx=U; |
|
361 | 361 | z9C)5jBoYw9^?EHyQl(M}1OlQcCX>lXB*ODN003Z&P17_@)3Pi=i0wb04<W?v-u}7K |
|
362 | 362 | zXmmQA+wDgE!qR9o8jr`%=ab_&uh(l?R=r;Tjiqon91I2-hIu?57~@*4h7h9uORK#= |
|
363 | 363 | fQItJW-{SoTm)8|5##k|m00000NkvXXu0mjf{mKw4 |
|
364 | 364 | |
|
365 | 365 | |
|
366 | 366 | Import binary diff: |
|
367 | 367 | |
|
368 | 368 | $ hg revert binfile.bin |
|
369 | 369 | $ rm binfile.bin |
|
370 | 370 | $ hg import -mfoo b.diff |
|
371 | 371 | applying b.diff |
|
372 | 372 | $ cmp binfile.bin "$TESTDIR/binfile.bin" |
|
373 | 373 | |
|
374 | 374 | Rename binary file: |
|
375 | 375 | |
|
376 | 376 | $ hg mv binfile.bin renamed.bin |
|
377 | 377 | $ hg diff --git |
|
378 | 378 | diff --git a/binfile.bin b/renamed.bin |
|
379 | 379 | rename from binfile.bin |
|
380 | 380 | rename to renamed.bin |
|
381 | 381 | |
|
382 | 382 | Diff across many revisions: |
|
383 | 383 | |
|
384 | 384 | $ hg mv dst dst2 |
|
385 | 385 | $ hg ci -m 'mv dst dst2' |
|
386 | 386 | |
|
387 | 387 | $ echo >> start |
|
388 | 388 | $ hg ci -m 'change start' |
|
389 | 389 | |
|
390 | 390 | $ hg revert -r -2 start |
|
391 | 391 | $ hg mv dst2 dst3 |
|
392 | 392 | $ hg ci -m 'mv dst2 dst3; revert start' |
|
393 | 393 | |
|
394 | 394 | $ hg diff --git -r 9:11 |
|
395 | 395 | diff --git a/dst2 b/dst3 |
|
396 | 396 | rename from dst2 |
|
397 | 397 | rename to dst3 |
|
398 | 398 | |
|
399 | 399 | Reversed: |
|
400 | 400 | |
|
401 | 401 | $ hg diff --git -r 11:9 |
|
402 | 402 | diff --git a/dst3 b/dst2 |
|
403 | 403 | rename from dst3 |
|
404 | 404 | rename to dst2 |
|
405 | 405 | |
|
406 | 406 | |
|
407 | 407 | $ echo a >> foo |
|
408 | 408 | $ hg add foo |
|
409 | 409 | $ hg ci -m 'add foo' |
|
410 | 410 | $ echo b >> foo |
|
411 | 411 | $ hg ci -m 'change foo' |
|
412 | 412 | $ hg mv foo bar |
|
413 | 413 | $ hg ci -m 'mv foo bar' |
|
414 | 414 | $ echo c >> bar |
|
415 | 415 | $ hg ci -m 'change bar' |
|
416 | 416 | |
|
417 | 417 | File created before r1 and renamed before r2: |
|
418 | 418 | |
|
419 | 419 | $ hg diff --git -r -3:-1 |
|
420 | 420 | diff --git a/foo b/bar |
|
421 | 421 | rename from foo |
|
422 | 422 | rename to bar |
|
423 | 423 | --- a/foo |
|
424 | 424 | +++ b/bar |
|
425 | 425 | @@ -1,2 +1,3 @@ |
|
426 | 426 | a |
|
427 | 427 | b |
|
428 | 428 | +c |
|
429 | 429 | |
|
430 | 430 | Reversed: |
|
431 | 431 | |
|
432 | 432 | $ hg diff --git -r -1:-3 |
|
433 | 433 | diff --git a/bar b/foo |
|
434 | 434 | rename from bar |
|
435 | 435 | rename to foo |
|
436 | 436 | --- a/bar |
|
437 | 437 | +++ b/foo |
|
438 | 438 | @@ -1,3 +1,2 @@ |
|
439 | 439 | a |
|
440 | 440 | b |
|
441 | 441 | -c |
|
442 | 442 | |
|
443 | 443 | File created in r1 and renamed before r2: |
|
444 | 444 | |
|
445 | 445 | $ hg diff --git -r -4:-1 |
|
446 | 446 | diff --git a/foo b/bar |
|
447 | 447 | rename from foo |
|
448 | 448 | rename to bar |
|
449 | 449 | --- a/foo |
|
450 | 450 | +++ b/bar |
|
451 | 451 | @@ -1,1 +1,3 @@ |
|
452 | 452 | a |
|
453 | 453 | +b |
|
454 | 454 | +c |
|
455 | 455 | |
|
456 | 456 | Reversed: |
|
457 | 457 | |
|
458 | 458 | $ hg diff --git -r -1:-4 |
|
459 | 459 | diff --git a/bar b/foo |
|
460 | 460 | rename from bar |
|
461 | 461 | rename to foo |
|
462 | 462 | --- a/bar |
|
463 | 463 | +++ b/foo |
|
464 | 464 | @@ -1,3 +1,1 @@ |
|
465 | 465 | a |
|
466 | 466 | -b |
|
467 | 467 | -c |
|
468 | 468 | |
|
469 | 469 | File created after r1 and renamed before r2: |
|
470 | 470 | |
|
471 | 471 | $ hg diff --git -r -5:-1 |
|
472 | 472 | diff --git a/bar b/bar |
|
473 | 473 | new file mode 100644 |
|
474 | 474 | --- /dev/null |
|
475 | 475 | +++ b/bar |
|
476 | 476 | @@ -0,0 +1,3 @@ |
|
477 | 477 | +a |
|
478 | 478 | +b |
|
479 | 479 | +c |
|
480 | 480 | |
|
481 | 481 | Reversed: |
|
482 | 482 | |
|
483 | 483 | $ hg diff --git -r -1:-5 |
|
484 | 484 | diff --git a/bar b/bar |
|
485 | 485 | deleted file mode 100644 |
|
486 | 486 | --- a/bar |
|
487 | 487 | +++ /dev/null |
|
488 | 488 | @@ -1,3 +0,0 @@ |
|
489 | 489 | -a |
|
490 | 490 | -b |
|
491 | 491 | -c |
|
492 | 492 | |
|
493 | 493 | |
|
494 | 494 | Comparing with the working dir: |
|
495 | 495 | |
|
496 | 496 | $ echo >> start |
|
497 | 497 | $ hg ci -m 'change start again' |
|
498 | 498 | |
|
499 | 499 | $ echo > created |
|
500 | 500 | $ hg add created |
|
501 | 501 | $ hg ci -m 'add created' |
|
502 | 502 | |
|
503 | 503 | $ hg mv created created2 |
|
504 | 504 | $ hg ci -m 'mv created created2' |
|
505 | 505 | |
|
506 | 506 | $ hg mv created2 created3 |
|
507 | 507 | |
|
508 | 508 | There's a copy in the working dir: |
|
509 | 509 | |
|
510 | 510 | $ hg diff --git |
|
511 | 511 | diff --git a/created2 b/created3 |
|
512 | 512 | rename from created2 |
|
513 | 513 | rename to created3 |
|
514 | 514 | |
|
515 | 515 | There's another copy between the original rev and the wd: |
|
516 | 516 | |
|
517 | 517 | $ hg diff --git -r -2 |
|
518 | 518 | diff --git a/created b/created3 |
|
519 | 519 | rename from created |
|
520 | 520 | rename to created3 |
|
521 | 521 | |
|
522 | 522 | The source of the copy was created after the original rev: |
|
523 | 523 | |
|
524 | 524 | $ hg diff --git -r -3 |
|
525 | 525 | diff --git a/created3 b/created3 |
|
526 | 526 | new file mode 100644 |
|
527 | 527 | --- /dev/null |
|
528 | 528 | +++ b/created3 |
|
529 | 529 | @@ -0,0 +1,1 @@ |
|
530 | 530 | + |
|
531 | 531 | $ hg ci -m 'mv created2 created3' |
|
532 | 532 | |
|
533 | 533 | |
|
534 | 534 | $ echo > brand-new |
|
535 | 535 | $ hg add brand-new |
|
536 | 536 | $ hg ci -m 'add brand-new' |
|
537 | 537 | $ hg mv brand-new brand-new2 |
|
538 | 538 | |
|
539 | 539 | Created in parent of wd; renamed in the wd: |
|
540 | 540 | |
|
541 | 541 | $ hg diff --git |
|
542 | 542 | diff --git a/brand-new b/brand-new2 |
|
543 | 543 | rename from brand-new |
|
544 | 544 | rename to brand-new2 |
|
545 | 545 | |
|
546 | 546 | Created between r1 and parent of wd; renamed in the wd: |
|
547 | 547 | |
|
548 | 548 | $ hg diff --git -r -2 |
|
549 | 549 | diff --git a/brand-new2 b/brand-new2 |
|
550 | 550 | new file mode 100644 |
|
551 | 551 | --- /dev/null |
|
552 | 552 | +++ b/brand-new2 |
|
553 | 553 | @@ -0,0 +1,1 @@ |
|
554 | 554 | + |
|
555 | 555 | $ hg ci -m 'mv brand-new brand-new2' |
|
556 | 556 | |
|
557 | 557 | One file is copied to many destinations and removed: |
|
558 | 558 | |
|
559 | 559 | $ hg cp brand-new2 brand-new3 |
|
560 | 560 | $ hg mv brand-new2 brand-new3-2 |
|
561 | 561 | $ hg ci -m 'multiple renames/copies' |
|
562 | 562 | $ hg diff --git -r -2 -r -1 |
|
563 | 563 | diff --git a/brand-new2 b/brand-new3 |
|
564 | 564 | rename from brand-new2 |
|
565 | 565 | rename to brand-new3 |
|
566 | 566 | diff --git a/brand-new2 b/brand-new3-2 |
|
567 | 567 | copy from brand-new2 |
|
568 | 568 | copy to brand-new3-2 |
|
569 | 569 | |
|
570 | 570 | Reversed: |
|
571 | 571 | |
|
572 | 572 | $ hg diff --git -r -1 -r -2 |
|
573 | 573 | diff --git a/brand-new3-2 b/brand-new2 |
|
574 | 574 | rename from brand-new3-2 |
|
575 | 575 | rename to brand-new2 |
|
576 | 576 | diff --git a/brand-new3 b/brand-new3 |
|
577 | 577 | deleted file mode 100644 |
|
578 | 578 | --- a/brand-new3 |
|
579 | 579 | +++ /dev/null |
|
580 | 580 | @@ -1,1 +0,0 @@ |
|
581 | 581 | - |
|
582 | 582 | |
|
583 | 583 | There should be a trailing TAB if there are spaces in the file name: |
|
584 | 584 | |
|
585 | 585 | $ echo foo > 'with spaces' |
|
586 | 586 | $ hg add 'with spaces' |
|
587 | 587 | $ hg diff --git |
|
588 | 588 | diff --git a/with spaces b/with spaces |
|
589 | 589 | new file mode 100644 |
|
590 | 590 | --- /dev/null |
|
591 | 591 | +++ b/with spaces |
|
592 | 592 | @@ -0,0 +1,1 @@ |
|
593 | 593 | +foo |
|
594 | 594 | $ hg ci -m 'add filename with spaces' |
|
595 | 595 | |
|
596 | 596 | Additions should be properly marked even in the middle of a merge |
|
597 | 597 | |
|
598 | 598 | $ hg up -r -2 |
|
599 | 599 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
600 | 600 | $ echo "New File" >> inmerge |
|
601 | 601 | $ hg add inmerge |
|
602 | 602 | $ hg ci -m "file in merge" |
|
603 | 603 | created new head |
|
604 | 604 | $ hg up 23 |
|
605 | 605 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
606 | 606 | $ hg merge |
|
607 | 607 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
608 | 608 | (branch merge, don't forget to commit) |
|
609 | 609 | $ hg diff -g |
|
610 | 610 | diff --git a/inmerge b/inmerge |
|
611 | 611 | new file mode 100644 |
|
612 | 612 | --- /dev/null |
|
613 | 613 | +++ b/inmerge |
|
614 | 614 | @@ -0,0 +1,1 @@ |
|
615 | 615 | +New File |
@@ -1,1153 +1,1153 b'' | |||
|
1 | 1 | $ cat >> $HGRCPATH << EOF |
|
2 | 2 | > [diff] |
|
3 | 3 | > git = true |
|
4 | 4 | > EOF |
|
5 | 5 | |
|
6 | 6 | $ hg init |
|
7 | 7 | $ cat > foo << EOF |
|
8 | 8 | > 0 |
|
9 | 9 | > 1 |
|
10 | 10 | > 2 |
|
11 | 11 | > 3 |
|
12 | 12 | > 4 |
|
13 | 13 | > EOF |
|
14 | 14 | $ hg ci -Am init |
|
15 | 15 | adding foo |
|
16 | 16 | $ cat > foo << EOF |
|
17 | 17 | > 0 |
|
18 | 18 | > 0 |
|
19 | 19 | > 0 |
|
20 | 20 | > 0 |
|
21 | 21 | > 1 |
|
22 | 22 | > 2 |
|
23 | 23 | > 3 |
|
24 | 24 | > 4 |
|
25 | 25 | > EOF |
|
26 | 26 | $ hg ci -m 'more 0' |
|
27 | 27 | $ sed 's/2/2+/' foo > foo.new |
|
28 | 28 | $ mv foo.new foo |
|
29 | 29 | $ cat > bar << EOF |
|
30 | 30 | > a |
|
31 | 31 | > b |
|
32 | 32 | > c |
|
33 | 33 | > d |
|
34 | 34 | > e |
|
35 | 35 | > EOF |
|
36 | 36 | $ hg add bar |
|
37 | 37 | $ hg ci -Am "2 -> 2+; added bar" |
|
38 | 38 | $ cat >> foo << EOF |
|
39 | 39 | > 5 |
|
40 | 40 | > 6 |
|
41 | 41 | > 7 |
|
42 | 42 | > 8 |
|
43 | 43 | > 9 |
|
44 | 44 | > 10 |
|
45 | 45 | > 11 |
|
46 | 46 | > EOF |
|
47 | 47 | $ hg ci -m "to 11" |
|
48 | 48 | |
|
49 | 49 | Add some changes with two diff hunks |
|
50 | 50 | |
|
51 | 51 | $ sed 's/^1$/ 1/' foo > foo.new |
|
52 | 52 | $ mv foo.new foo |
|
53 | 53 | $ sed 's/^11$/11+/' foo > foo.new |
|
54 | 54 | $ mv foo.new foo |
|
55 | 55 | $ hg ci -m '11 -> 11+; leading space before "1"' |
|
56 | 56 | (make sure there are two hunks in "foo") |
|
57 | 57 | $ hg diff -c . |
|
58 | 58 | diff --git a/foo b/foo |
|
59 | 59 | --- a/foo |
|
60 | 60 | +++ b/foo |
|
61 | 61 | @@ -2,7 +2,7 @@ |
|
62 | 62 | 0 |
|
63 | 63 | 0 |
|
64 | 64 | 0 |
|
65 | 65 | -1 |
|
66 | 66 | + 1 |
|
67 | 67 | 2+ |
|
68 | 68 | 3 |
|
69 | 69 | 4 |
|
70 | 70 | @@ -12,4 +12,4 @@ |
|
71 | 71 | 8 |
|
72 | 72 | 9 |
|
73 | 73 | 10 |
|
74 | 74 | -11 |
|
75 | 75 | +11+ |
|
76 | 76 | $ sed 's/3/3+/' foo > foo.new |
|
77 | 77 | $ mv foo.new foo |
|
78 | 78 | $ sed 's/^11+$/11-/' foo > foo.new |
|
79 | 79 | $ mv foo.new foo |
|
80 | 80 | $ sed 's/a/a+/' bar > bar.new |
|
81 | 81 | $ mv bar.new bar |
|
82 | 82 | $ hg ci -m 'foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+' |
|
83 | 83 | (make sure there are two hunks in "foo") |
|
84 | 84 | $ hg diff -c . foo |
|
85 | 85 | diff --git a/foo b/foo |
|
86 | 86 | --- a/foo |
|
87 | 87 | +++ b/foo |
|
88 | 88 | @@ -4,7 +4,7 @@ |
|
89 | 89 | 0 |
|
90 | 90 | 1 |
|
91 | 91 | 2+ |
|
92 | 92 | -3 |
|
93 | 93 | +3+ |
|
94 | 94 | 4 |
|
95 | 95 | 5 |
|
96 | 96 | 6 |
|
97 | 97 | @@ -12,4 +12,4 @@ |
|
98 | 98 | 8 |
|
99 | 99 | 9 |
|
100 | 100 | 10 |
|
101 | 101 | -11+ |
|
102 | 102 | +11- |
|
103 | 103 | |
|
104 | 104 | $ hg log -f -L foo,5:7 -p |
|
105 | 105 | changeset: 5:cfdf972b3971 |
|
106 | 106 | tag: tip |
|
107 | 107 | user: test |
|
108 | 108 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
109 | 109 | summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+ |
|
110 | 110 | |
|
111 | 111 | diff --git a/foo b/foo |
|
112 | 112 | --- a/foo |
|
113 | 113 | +++ b/foo |
|
114 | 114 | @@ -4,7 +4,7 @@ |
|
115 | 115 | 0 |
|
116 | 116 | 1 |
|
117 | 117 | 2+ |
|
118 | 118 | -3 |
|
119 | 119 | +3+ |
|
120 | 120 | 4 |
|
121 | 121 | 5 |
|
122 | 122 | 6 |
|
123 | 123 | |
|
124 | 124 | changeset: 4:eaec41c1a0c9 |
|
125 | 125 | user: test |
|
126 | 126 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
127 | 127 | summary: 11 -> 11+; leading space before "1" |
|
128 | 128 | |
|
129 | 129 | diff --git a/foo b/foo |
|
130 | 130 | --- a/foo |
|
131 | 131 | +++ b/foo |
|
132 | 132 | @@ -2,7 +2,7 @@ |
|
133 | 133 | 0 |
|
134 | 134 | 0 |
|
135 | 135 | 0 |
|
136 | 136 | -1 |
|
137 | 137 | + 1 |
|
138 | 138 | 2+ |
|
139 | 139 | 3 |
|
140 | 140 | 4 |
|
141 | 141 | |
|
142 | 142 | changeset: 2:63a884426fd0 |
|
143 | 143 | user: test |
|
144 | 144 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
145 | 145 | summary: 2 -> 2+; added bar |
|
146 | 146 | |
|
147 | 147 | diff --git a/foo b/foo |
|
148 | 148 | --- a/foo |
|
149 | 149 | +++ b/foo |
|
150 | 150 | @@ -3,6 +3,6 @@ |
|
151 | 151 | 0 |
|
152 | 152 | 0 |
|
153 | 153 | 1 |
|
154 | 154 | -2 |
|
155 | 155 | +2+ |
|
156 | 156 | 3 |
|
157 | 157 | 4 |
|
158 | 158 | |
|
159 | 159 | changeset: 0:5ae1f82b9a00 |
|
160 | 160 | user: test |
|
161 | 161 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
162 | 162 | summary: init |
|
163 | 163 | |
|
164 | 164 | diff --git a/foo b/foo |
|
165 | 165 | new file mode 100644 |
|
166 | 166 | --- /dev/null |
|
167 | 167 | +++ b/foo |
|
168 | 168 | @@ -0,0 +1,5 @@ |
|
169 | 169 | +0 |
|
170 | 170 | +1 |
|
171 | 171 | +2 |
|
172 | 172 | +3 |
|
173 | 173 | +4 |
|
174 | 174 | |
|
175 | 175 | $ hg log -f --graph -L foo,5:7 -p |
|
176 | 176 | @ changeset: 5:cfdf972b3971 |
|
177 | 177 | | tag: tip |
|
178 | 178 | | user: test |
|
179 | 179 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
180 | 180 | | summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+ |
|
181 | 181 | | |
|
182 | 182 | | diff --git a/foo b/foo |
|
183 | 183 | | --- a/foo |
|
184 | 184 | | +++ b/foo |
|
185 | 185 | | @@ -4,7 +4,7 @@ |
|
186 | 186 | | 0 |
|
187 | 187 | | 1 |
|
188 | 188 | | 2+ |
|
189 | 189 | | -3 |
|
190 | 190 | | +3+ |
|
191 | 191 | | 4 |
|
192 | 192 | | 5 |
|
193 | 193 | | 6 |
|
194 | 194 | | |
|
195 | 195 | o changeset: 4:eaec41c1a0c9 |
|
196 | 196 | : user: test |
|
197 | 197 | : date: Thu Jan 01 00:00:00 1970 +0000 |
|
198 | 198 | : summary: 11 -> 11+; leading space before "1" |
|
199 | 199 | : |
|
200 | 200 | : diff --git a/foo b/foo |
|
201 | 201 | : --- a/foo |
|
202 | 202 | : +++ b/foo |
|
203 | 203 | : @@ -2,7 +2,7 @@ |
|
204 | 204 | : 0 |
|
205 | 205 | : 0 |
|
206 | 206 | : 0 |
|
207 | 207 | : -1 |
|
208 | 208 | : + 1 |
|
209 | 209 | : 2+ |
|
210 | 210 | : 3 |
|
211 | 211 | : 4 |
|
212 | 212 | : |
|
213 | 213 | o changeset: 2:63a884426fd0 |
|
214 | 214 | : user: test |
|
215 | 215 | : date: Thu Jan 01 00:00:00 1970 +0000 |
|
216 | 216 | : summary: 2 -> 2+; added bar |
|
217 | 217 | : |
|
218 | 218 | : diff --git a/foo b/foo |
|
219 | 219 | : --- a/foo |
|
220 | 220 | : +++ b/foo |
|
221 | 221 | : @@ -3,6 +3,6 @@ |
|
222 | 222 | : 0 |
|
223 | 223 | : 0 |
|
224 | 224 | : 1 |
|
225 | 225 | : -2 |
|
226 | 226 | : +2+ |
|
227 | 227 | : 3 |
|
228 | 228 | : 4 |
|
229 | 229 | : |
|
230 | 230 | o changeset: 0:5ae1f82b9a00 |
|
231 | 231 | user: test |
|
232 | 232 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
233 | 233 | summary: init |
|
234 | 234 | |
|
235 | 235 | diff --git a/foo b/foo |
|
236 | 236 | new file mode 100644 |
|
237 | 237 | --- /dev/null |
|
238 | 238 | +++ b/foo |
|
239 | 239 | @@ -0,0 +1,5 @@ |
|
240 | 240 | +0 |
|
241 | 241 | +1 |
|
242 | 242 | +2 |
|
243 | 243 | +3 |
|
244 | 244 | +4 |
|
245 | 245 | |
|
246 | 246 | |
|
247 | 247 | With --template. |
|
248 | 248 | |
|
249 | 249 | $ hg log -f -L foo,5:7 -T '{rev}:{node|short} {desc|firstline}\n' |
|
250 | 250 | 5:cfdf972b3971 foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+ |
|
251 | 251 | 4:eaec41c1a0c9 11 -> 11+; leading space before "1" |
|
252 | 252 | 2:63a884426fd0 2 -> 2+; added bar |
|
253 | 253 | 0:5ae1f82b9a00 init |
|
254 | 254 | $ hg log -f -L foo,5:7 -T json |
|
255 | 255 | [ |
|
256 | 256 | { |
|
257 | 257 | "bookmarks": [], |
|
258 | 258 | "branch": "default", |
|
259 | 259 | "date": [0, 0], |
|
260 | 260 | "desc": "foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+", |
|
261 | 261 | "node": "cfdf972b3971a2a59638bf9583c0debbffee5404", |
|
262 | 262 | "parents": ["eaec41c1a0c9ad0a5e999611d0149d171beffb8c"], |
|
263 | 263 | "phase": "draft", |
|
264 | 264 | "rev": 5, |
|
265 | 265 | "tags": ["tip"], |
|
266 | 266 | "user": "test" |
|
267 | 267 | }, |
|
268 | 268 | { |
|
269 | 269 | "bookmarks": [], |
|
270 | 270 | "branch": "default", |
|
271 | 271 | "date": [0, 0], |
|
272 | 272 | "desc": "11 -> 11+; leading space before \"1\"", |
|
273 | 273 | "node": "eaec41c1a0c9ad0a5e999611d0149d171beffb8c", |
|
274 | 274 | "parents": ["730a61fbaecf426c17c2c66bc42d195b5d5b0ba8"], |
|
275 | 275 | "phase": "draft", |
|
276 | 276 | "rev": 4, |
|
277 | 277 | "tags": [], |
|
278 | 278 | "user": "test" |
|
279 | 279 | }, |
|
280 | 280 | { |
|
281 | 281 | "bookmarks": [], |
|
282 | 282 | "branch": "default", |
|
283 | 283 | "date": [0, 0], |
|
284 | 284 | "desc": "2 -> 2+; added bar", |
|
285 | 285 | "node": "63a884426fd0b277fcd55895bbb2f230434576eb", |
|
286 | 286 | "parents": ["29a1e7c6b80024f63f310a2d71de979e9d2996d7"], |
|
287 | 287 | "phase": "draft", |
|
288 | 288 | "rev": 2, |
|
289 | 289 | "tags": [], |
|
290 | 290 | "user": "test" |
|
291 | 291 | }, |
|
292 | 292 | { |
|
293 | 293 | "bookmarks": [], |
|
294 | 294 | "branch": "default", |
|
295 | 295 | "date": [0, 0], |
|
296 | 296 | "desc": "init", |
|
297 | 297 | "node": "5ae1f82b9a000ff1e0967d0dac1c58b9d796e1b4", |
|
298 | 298 | "parents": ["0000000000000000000000000000000000000000"], |
|
299 | 299 | "phase": "draft", |
|
300 | 300 | "rev": 0, |
|
301 | 301 | "tags": [], |
|
302 | 302 | "user": "test" |
|
303 | 303 | } |
|
304 | 304 | ] |
|
305 | 305 | |
|
306 | 306 | With some white-space diff option, respective revisions are skipped. |
|
307 | 307 | |
|
308 | 308 | $ hg log -f -L foo,5:7 -p --config diff.ignorews=true |
|
309 | 309 | changeset: 5:cfdf972b3971 |
|
310 | 310 | tag: tip |
|
311 | 311 | user: test |
|
312 | 312 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
313 | 313 | summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+ |
|
314 | 314 | |
|
315 | 315 | diff --git a/foo b/foo |
|
316 | 316 | --- a/foo |
|
317 | 317 | +++ b/foo |
|
318 | 318 | @@ -4,7 +4,7 @@ |
|
319 | 319 | 0 |
|
320 | 320 | 1 |
|
321 | 321 | 2+ |
|
322 | 322 | -3 |
|
323 | 323 | +3+ |
|
324 | 324 | 4 |
|
325 | 325 | 5 |
|
326 | 326 | 6 |
|
327 | 327 | |
|
328 | 328 | changeset: 2:63a884426fd0 |
|
329 | 329 | user: test |
|
330 | 330 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
331 | 331 | summary: 2 -> 2+; added bar |
|
332 | 332 | |
|
333 | 333 | diff --git a/foo b/foo |
|
334 | 334 | --- a/foo |
|
335 | 335 | +++ b/foo |
|
336 | 336 | @@ -3,6 +3,6 @@ |
|
337 | 337 | 0 |
|
338 | 338 | 0 |
|
339 | 339 | 1 |
|
340 | 340 | -2 |
|
341 | 341 | +2+ |
|
342 | 342 | 3 |
|
343 | 343 | 4 |
|
344 | 344 | |
|
345 | 345 | changeset: 0:5ae1f82b9a00 |
|
346 | 346 | user: test |
|
347 | 347 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
348 | 348 | summary: init |
|
349 | 349 | |
|
350 | 350 | diff --git a/foo b/foo |
|
351 | 351 | new file mode 100644 |
|
352 | 352 | --- /dev/null |
|
353 | 353 | +++ b/foo |
|
354 | 354 | @@ -0,0 +1,5 @@ |
|
355 | 355 | +0 |
|
356 | 356 | +1 |
|
357 | 357 | +2 |
|
358 | 358 | +3 |
|
359 | 359 | +4 |
|
360 | 360 | |
|
361 | 361 | |
|
362 | 362 | Regular file patterns are not allowed. |
|
363 | 363 | |
|
364 | 364 | $ hg log -f -L foo,5:7 -p bar |
|
365 | 365 | abort: FILE arguments are not compatible with --line-range option |
|
366 | 366 | [10] |
|
367 | 367 | |
|
368 | 368 | Option --rev acts as a restriction. |
|
369 | 369 | |
|
370 | 370 | $ hg log -f -L foo,5:7 -p -r 'desc(2)' |
|
371 | 371 | changeset: 2:63a884426fd0 |
|
372 | 372 | user: test |
|
373 | 373 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
374 | 374 | summary: 2 -> 2+; added bar |
|
375 | 375 | |
|
376 | 376 | diff --git a/foo b/foo |
|
377 | 377 | --- a/foo |
|
378 | 378 | +++ b/foo |
|
379 | 379 | @@ -3,6 +3,6 @@ |
|
380 | 380 | 0 |
|
381 | 381 | 0 |
|
382 | 382 | 1 |
|
383 | 383 | -2 |
|
384 | 384 | +2+ |
|
385 | 385 | 3 |
|
386 | 386 | 4 |
|
387 | 387 | |
|
388 | 388 | changeset: 0:5ae1f82b9a00 |
|
389 | 389 | user: test |
|
390 | 390 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
391 | 391 | summary: init |
|
392 | 392 | |
|
393 | 393 | diff --git a/foo b/foo |
|
394 | 394 | new file mode 100644 |
|
395 | 395 | --- /dev/null |
|
396 | 396 | +++ b/foo |
|
397 | 397 | @@ -0,0 +1,5 @@ |
|
398 | 398 | +0 |
|
399 | 399 | +1 |
|
400 | 400 | +2 |
|
401 | 401 | +3 |
|
402 | 402 | +4 |
|
403 | 403 | |
|
404 | 404 | |
|
405 | 405 | With several -L patterns, changes touching any files in their respective line |
|
406 | 406 | range are show. |
|
407 | 407 | |
|
408 | 408 | $ hg log -f -L foo,5:7 -L bar,1:2 -p |
|
409 | 409 | changeset: 5:cfdf972b3971 |
|
410 | 410 | tag: tip |
|
411 | 411 | user: test |
|
412 | 412 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
413 | 413 | summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+ |
|
414 | 414 | |
|
415 | 415 | diff --git a/bar b/bar |
|
416 | 416 | --- a/bar |
|
417 | 417 | +++ b/bar |
|
418 | 418 | @@ -1,4 +1,4 @@ |
|
419 | 419 | -a |
|
420 | 420 | +a+ |
|
421 | 421 | b |
|
422 | 422 | c |
|
423 | 423 | d |
|
424 | 424 | diff --git a/foo b/foo |
|
425 | 425 | --- a/foo |
|
426 | 426 | +++ b/foo |
|
427 | 427 | @@ -4,7 +4,7 @@ |
|
428 | 428 | 0 |
|
429 | 429 | 1 |
|
430 | 430 | 2+ |
|
431 | 431 | -3 |
|
432 | 432 | +3+ |
|
433 | 433 | 4 |
|
434 | 434 | 5 |
|
435 | 435 | 6 |
|
436 | 436 | |
|
437 | 437 | changeset: 4:eaec41c1a0c9 |
|
438 | 438 | user: test |
|
439 | 439 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
440 | 440 | summary: 11 -> 11+; leading space before "1" |
|
441 | 441 | |
|
442 | 442 | diff --git a/foo b/foo |
|
443 | 443 | --- a/foo |
|
444 | 444 | +++ b/foo |
|
445 | 445 | @@ -2,7 +2,7 @@ |
|
446 | 446 | 0 |
|
447 | 447 | 0 |
|
448 | 448 | 0 |
|
449 | 449 | -1 |
|
450 | 450 | + 1 |
|
451 | 451 | 2+ |
|
452 | 452 | 3 |
|
453 | 453 | 4 |
|
454 | 454 | |
|
455 | 455 | changeset: 2:63a884426fd0 |
|
456 | 456 | user: test |
|
457 | 457 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
458 | 458 | summary: 2 -> 2+; added bar |
|
459 | 459 | |
|
460 | 460 | diff --git a/bar b/bar |
|
461 | 461 | new file mode 100644 |
|
462 | 462 | --- /dev/null |
|
463 | 463 | +++ b/bar |
|
464 | 464 | @@ -0,0 +1,5 @@ |
|
465 | 465 | +a |
|
466 | 466 | +b |
|
467 | 467 | +c |
|
468 | 468 | +d |
|
469 | 469 | +e |
|
470 | 470 | diff --git a/foo b/foo |
|
471 | 471 | --- a/foo |
|
472 | 472 | +++ b/foo |
|
473 | 473 | @@ -3,6 +3,6 @@ |
|
474 | 474 | 0 |
|
475 | 475 | 0 |
|
476 | 476 | 1 |
|
477 | 477 | -2 |
|
478 | 478 | +2+ |
|
479 | 479 | 3 |
|
480 | 480 | 4 |
|
481 | 481 | |
|
482 | 482 | changeset: 0:5ae1f82b9a00 |
|
483 | 483 | user: test |
|
484 | 484 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
485 | 485 | summary: init |
|
486 | 486 | |
|
487 | 487 | diff --git a/foo b/foo |
|
488 | 488 | new file mode 100644 |
|
489 | 489 | --- /dev/null |
|
490 | 490 | +++ b/foo |
|
491 | 491 | @@ -0,0 +1,5 @@ |
|
492 | 492 | +0 |
|
493 | 493 | +1 |
|
494 | 494 | +2 |
|
495 | 495 | +3 |
|
496 | 496 | +4 |
|
497 | 497 | |
|
498 | 498 | |
|
499 | 499 | Multiple -L options with the same file yields changes touching any of |
|
500 | 500 | specified line ranges. |
|
501 | 501 | |
|
502 | 502 | $ hg log -f -L foo,5:7 -L foo,14:15 -p |
|
503 | 503 | changeset: 5:cfdf972b3971 |
|
504 | 504 | tag: tip |
|
505 | 505 | user: test |
|
506 | 506 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
507 | 507 | summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+ |
|
508 | 508 | |
|
509 | 509 | diff --git a/foo b/foo |
|
510 | 510 | --- a/foo |
|
511 | 511 | +++ b/foo |
|
512 | 512 | @@ -4,7 +4,7 @@ |
|
513 | 513 | 0 |
|
514 | 514 | 1 |
|
515 | 515 | 2+ |
|
516 | 516 | -3 |
|
517 | 517 | +3+ |
|
518 | 518 | 4 |
|
519 | 519 | 5 |
|
520 | 520 | 6 |
|
521 | 521 | @@ -12,4 +12,4 @@ |
|
522 | 522 | 8 |
|
523 | 523 | 9 |
|
524 | 524 | 10 |
|
525 | 525 | -11+ |
|
526 | 526 | +11- |
|
527 | 527 | |
|
528 | 528 | changeset: 4:eaec41c1a0c9 |
|
529 | 529 | user: test |
|
530 | 530 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
531 | 531 | summary: 11 -> 11+; leading space before "1" |
|
532 | 532 | |
|
533 | 533 | diff --git a/foo b/foo |
|
534 | 534 | --- a/foo |
|
535 | 535 | +++ b/foo |
|
536 | 536 | @@ -2,7 +2,7 @@ |
|
537 | 537 | 0 |
|
538 | 538 | 0 |
|
539 | 539 | 0 |
|
540 | 540 | -1 |
|
541 | 541 | + 1 |
|
542 | 542 | 2+ |
|
543 | 543 | 3 |
|
544 | 544 | 4 |
|
545 | 545 | @@ -12,4 +12,4 @@ |
|
546 | 546 | 8 |
|
547 | 547 | 9 |
|
548 | 548 | 10 |
|
549 | 549 | -11 |
|
550 | 550 | +11+ |
|
551 | 551 | |
|
552 | 552 | changeset: 3:730a61fbaecf |
|
553 | 553 | user: test |
|
554 | 554 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
555 | 555 | summary: to 11 |
|
556 | 556 | |
|
557 | 557 | diff --git a/foo b/foo |
|
558 | 558 | --- a/foo |
|
559 | 559 | +++ b/foo |
|
560 | 560 | @@ -6,3 +6,10 @@ |
|
561 | 561 | 2+ |
|
562 | 562 | 3 |
|
563 | 563 | 4 |
|
564 | 564 | +5 |
|
565 | 565 | +6 |
|
566 | 566 | +7 |
|
567 | 567 | +8 |
|
568 | 568 | +9 |
|
569 | 569 | +10 |
|
570 | 570 | +11 |
|
571 | 571 | |
|
572 | 572 | changeset: 2:63a884426fd0 |
|
573 | 573 | user: test |
|
574 | 574 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
575 | 575 | summary: 2 -> 2+; added bar |
|
576 | 576 | |
|
577 | 577 | diff --git a/foo b/foo |
|
578 | 578 | --- a/foo |
|
579 | 579 | +++ b/foo |
|
580 | 580 | @@ -3,6 +3,6 @@ |
|
581 | 581 | 0 |
|
582 | 582 | 0 |
|
583 | 583 | 1 |
|
584 | 584 | -2 |
|
585 | 585 | +2+ |
|
586 | 586 | 3 |
|
587 | 587 | 4 |
|
588 | 588 | |
|
589 | 589 | changeset: 0:5ae1f82b9a00 |
|
590 | 590 | user: test |
|
591 | 591 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
592 | 592 | summary: init |
|
593 | 593 | |
|
594 | 594 | diff --git a/foo b/foo |
|
595 | 595 | new file mode 100644 |
|
596 | 596 | --- /dev/null |
|
597 | 597 | +++ b/foo |
|
598 | 598 | @@ -0,0 +1,5 @@ |
|
599 | 599 | +0 |
|
600 | 600 | +1 |
|
601 | 601 | +2 |
|
602 | 602 | +3 |
|
603 | 603 | +4 |
|
604 | 604 | |
|
605 | 605 | |
|
606 | 606 | A file with a comma in its name. |
|
607 | 607 | |
|
608 | 608 | $ cat > ba,z << EOF |
|
609 | 609 | > q |
|
610 | 610 | > w |
|
611 | 611 | > e |
|
612 | 612 | > r |
|
613 | 613 | > t |
|
614 | 614 | > y |
|
615 | 615 | > EOF |
|
616 | 616 | $ hg ci -Am 'querty' |
|
617 | 617 | adding ba,z |
|
618 | 618 | $ cat >> ba,z << EOF |
|
619 | 619 | > u |
|
620 | 620 | > i |
|
621 | 621 | > o |
|
622 | 622 | > p |
|
623 | 623 | > EOF |
|
624 | 624 | $ hg ci -m 'more keys' |
|
625 | 625 | $ cat > ba,z << EOF |
|
626 | 626 | > a |
|
627 | 627 | > z |
|
628 | 628 | > e |
|
629 | 629 | > r |
|
630 | 630 | > t |
|
631 | 631 | > y |
|
632 | 632 | > u |
|
633 | 633 | > i |
|
634 | 634 | > o |
|
635 | 635 | > p |
|
636 | 636 | > EOF |
|
637 | 637 | $ hg ci -m 'azerty' |
|
638 | 638 | $ hg log -f -L ba,z,1:2 -p |
|
639 | 639 | changeset: 8:52373265138b |
|
640 | 640 | tag: tip |
|
641 | 641 | user: test |
|
642 | 642 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
643 | 643 | summary: azerty |
|
644 | 644 | |
|
645 | 645 | diff --git a/ba,z b/ba,z |
|
646 | 646 | --- a/ba,z |
|
647 | 647 | +++ b/ba,z |
|
648 | 648 | @@ -1,5 +1,5 @@ |
|
649 | 649 | -q |
|
650 | 650 | -w |
|
651 | 651 | +a |
|
652 | 652 | +z |
|
653 | 653 | e |
|
654 | 654 | r |
|
655 | 655 | t |
|
656 | 656 | |
|
657 | 657 | changeset: 6:96ba8850f316 |
|
658 | 658 | user: test |
|
659 | 659 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
660 | 660 | summary: querty |
|
661 | 661 | |
|
662 | 662 | diff --git a/ba,z b/ba,z |
|
663 | 663 | new file mode 100644 |
|
664 | 664 | --- /dev/null |
|
665 | 665 | +++ b/ba,z |
|
666 | 666 | @@ -0,0 +1,6 @@ |
|
667 | 667 | +q |
|
668 | 668 | +w |
|
669 | 669 | +e |
|
670 | 670 | +r |
|
671 | 671 | +t |
|
672 | 672 | +y |
|
673 | 673 | |
|
674 | 674 | |
|
675 | 675 | Exact prefix kinds work in -L options. |
|
676 | 676 | |
|
677 | 677 | $ mkdir dir |
|
678 | 678 | $ cd dir |
|
679 | 679 | $ hg log -f -L path:foo,5:7 -p |
|
680 | 680 | changeset: 5:cfdf972b3971 |
|
681 | 681 | user: test |
|
682 | 682 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
683 | 683 | summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+ |
|
684 | 684 | |
|
685 | 685 | diff --git a/foo b/foo |
|
686 | 686 | --- a/foo |
|
687 | 687 | +++ b/foo |
|
688 | 688 | @@ -4,7 +4,7 @@ |
|
689 | 689 | 0 |
|
690 | 690 | 1 |
|
691 | 691 | 2+ |
|
692 | 692 | -3 |
|
693 | 693 | +3+ |
|
694 | 694 | 4 |
|
695 | 695 | 5 |
|
696 | 696 | 6 |
|
697 | 697 | |
|
698 | 698 | changeset: 4:eaec41c1a0c9 |
|
699 | 699 | user: test |
|
700 | 700 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
701 | 701 | summary: 11 -> 11+; leading space before "1" |
|
702 | 702 | |
|
703 | 703 | diff --git a/foo b/foo |
|
704 | 704 | --- a/foo |
|
705 | 705 | +++ b/foo |
|
706 | 706 | @@ -2,7 +2,7 @@ |
|
707 | 707 | 0 |
|
708 | 708 | 0 |
|
709 | 709 | 0 |
|
710 | 710 | -1 |
|
711 | 711 | + 1 |
|
712 | 712 | 2+ |
|
713 | 713 | 3 |
|
714 | 714 | 4 |
|
715 | 715 | |
|
716 | 716 | changeset: 2:63a884426fd0 |
|
717 | 717 | user: test |
|
718 | 718 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
719 | 719 | summary: 2 -> 2+; added bar |
|
720 | 720 | |
|
721 | 721 | diff --git a/foo b/foo |
|
722 | 722 | --- a/foo |
|
723 | 723 | +++ b/foo |
|
724 | 724 | @@ -3,6 +3,6 @@ |
|
725 | 725 | 0 |
|
726 | 726 | 0 |
|
727 | 727 | 1 |
|
728 | 728 | -2 |
|
729 | 729 | +2+ |
|
730 | 730 | 3 |
|
731 | 731 | 4 |
|
732 | 732 | |
|
733 | 733 | changeset: 0:5ae1f82b9a00 |
|
734 | 734 | user: test |
|
735 | 735 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
736 | 736 | summary: init |
|
737 | 737 | |
|
738 | 738 | diff --git a/foo b/foo |
|
739 | 739 | new file mode 100644 |
|
740 | 740 | --- /dev/null |
|
741 | 741 | +++ b/foo |
|
742 | 742 | @@ -0,0 +1,5 @@ |
|
743 | 743 | +0 |
|
744 | 744 | +1 |
|
745 | 745 | +2 |
|
746 | 746 | +3 |
|
747 | 747 | +4 |
|
748 | 748 | |
|
749 | 749 | |
|
750 | 750 | Renames are followed. |
|
751 | 751 | |
|
752 | 752 | $ hg mv ../foo baz |
|
753 | 753 | $ sed 's/1/1+/' baz > baz.new |
|
754 | 754 | $ mv baz.new baz |
|
755 | 755 | $ hg ci -m 'foo -> dir/baz; 1-1+' |
|
756 | 756 | $ hg diff -c . |
|
757 | 757 | diff --git a/foo b/dir/baz |
|
758 | 758 | rename from foo |
|
759 | 759 | rename to dir/baz |
|
760 | 760 | --- a/foo |
|
761 | 761 | +++ b/dir/baz |
|
762 | 762 | @@ -2,7 +2,7 @@ |
|
763 | 763 | 0 |
|
764 | 764 | 0 |
|
765 | 765 | 0 |
|
766 | 766 | - 1 |
|
767 | 767 | + 1+ |
|
768 | 768 | 2+ |
|
769 | 769 | 3+ |
|
770 | 770 | 4 |
|
771 | 771 | @@ -11,5 +11,5 @@ |
|
772 | 772 | 7 |
|
773 | 773 | 8 |
|
774 | 774 | 9 |
|
775 | 775 | -10 |
|
776 | 776 | -11- |
|
777 | 777 | +1+0 |
|
778 | 778 | +1+1- |
|
779 | 779 | $ hg log -f -L relpath:baz,5:7 -p |
|
780 | 780 | changeset: 9:6af29c3a778f |
|
781 | 781 | tag: tip |
|
782 | 782 | user: test |
|
783 | 783 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
784 | 784 | summary: foo -> dir/baz; 1-1+ |
|
785 | 785 | |
|
786 | 786 | diff --git a/foo b/dir/baz |
|
787 | 787 | copy from foo |
|
788 | 788 | copy to dir/baz |
|
789 | 789 | --- a/foo |
|
790 | 790 | +++ b/dir/baz |
|
791 | 791 | @@ -2,7 +2,7 @@ |
|
792 | 792 | 0 |
|
793 | 793 | 0 |
|
794 | 794 | 0 |
|
795 | 795 | - 1 |
|
796 | 796 | + 1+ |
|
797 | 797 | 2+ |
|
798 | 798 | 3+ |
|
799 | 799 | 4 |
|
800 | 800 | |
|
801 | 801 | changeset: 5:cfdf972b3971 |
|
802 | 802 | user: test |
|
803 | 803 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
804 | 804 | summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+ |
|
805 | 805 | |
|
806 | 806 | diff --git a/foo b/foo |
|
807 | 807 | --- a/foo |
|
808 | 808 | +++ b/foo |
|
809 | 809 | @@ -4,7 +4,7 @@ |
|
810 | 810 | 0 |
|
811 | 811 | 1 |
|
812 | 812 | 2+ |
|
813 | 813 | -3 |
|
814 | 814 | +3+ |
|
815 | 815 | 4 |
|
816 | 816 | 5 |
|
817 | 817 | 6 |
|
818 | 818 | |
|
819 | 819 | changeset: 4:eaec41c1a0c9 |
|
820 | 820 | user: test |
|
821 | 821 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
822 | 822 | summary: 11 -> 11+; leading space before "1" |
|
823 | 823 | |
|
824 | 824 | diff --git a/foo b/foo |
|
825 | 825 | --- a/foo |
|
826 | 826 | +++ b/foo |
|
827 | 827 | @@ -2,7 +2,7 @@ |
|
828 | 828 | 0 |
|
829 | 829 | 0 |
|
830 | 830 | 0 |
|
831 | 831 | -1 |
|
832 | 832 | + 1 |
|
833 | 833 | 2+ |
|
834 | 834 | 3 |
|
835 | 835 | 4 |
|
836 | 836 | |
|
837 | 837 | changeset: 2:63a884426fd0 |
|
838 | 838 | user: test |
|
839 | 839 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
840 | 840 | summary: 2 -> 2+; added bar |
|
841 | 841 | |
|
842 | 842 | diff --git a/foo b/foo |
|
843 | 843 | --- a/foo |
|
844 | 844 | +++ b/foo |
|
845 | 845 | @@ -3,6 +3,6 @@ |
|
846 | 846 | 0 |
|
847 | 847 | 0 |
|
848 | 848 | 1 |
|
849 | 849 | -2 |
|
850 | 850 | +2+ |
|
851 | 851 | 3 |
|
852 | 852 | 4 |
|
853 | 853 | |
|
854 | 854 | changeset: 0:5ae1f82b9a00 |
|
855 | 855 | user: test |
|
856 | 856 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
857 | 857 | summary: init |
|
858 | 858 | |
|
859 | 859 | diff --git a/foo b/foo |
|
860 | 860 | new file mode 100644 |
|
861 | 861 | --- /dev/null |
|
862 | 862 | +++ b/foo |
|
863 | 863 | @@ -0,0 +1,5 @@ |
|
864 | 864 | +0 |
|
865 | 865 | +1 |
|
866 | 866 | +2 |
|
867 | 867 | +3 |
|
868 | 868 | +4 |
|
869 | 869 | |
|
870 | 870 | |
|
871 | 871 | Uncommitted changes with a rename |
|
872 | 872 | |
|
873 | 873 | $ hg mv baz bazn |
|
874 | 874 | $ hg log -f -L bazn,5:7 |
|
875 | 875 | changeset: 9:6af29c3a778f |
|
876 | 876 | tag: tip |
|
877 | 877 | user: test |
|
878 | 878 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
879 | 879 | summary: foo -> dir/baz; 1-1+ |
|
880 | 880 | |
|
881 | 881 | changeset: 5:cfdf972b3971 |
|
882 | 882 | user: test |
|
883 | 883 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
884 | 884 | summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+ |
|
885 | 885 | |
|
886 | 886 | changeset: 4:eaec41c1a0c9 |
|
887 | 887 | user: test |
|
888 | 888 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
889 | 889 | summary: 11 -> 11+; leading space before "1" |
|
890 | 890 | |
|
891 | 891 | changeset: 2:63a884426fd0 |
|
892 | 892 | user: test |
|
893 | 893 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
894 | 894 | summary: 2 -> 2+; added bar |
|
895 | 895 | |
|
896 | 896 | changeset: 0:5ae1f82b9a00 |
|
897 | 897 | user: test |
|
898 | 898 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
899 | 899 | summary: init |
|
900 | 900 | |
|
901 | 901 | |
|
902 | 902 | Uncommitted changes in requested line range |
|
903 | 903 | |
|
904 | 904 | $ sed 's/2/ /' bazn > bazn.new |
|
905 | 905 | $ mv bazn.new bazn |
|
906 | 906 | $ hg diff |
|
907 | 907 | diff --git a/dir/baz b/dir/bazn |
|
908 | 908 | rename from dir/baz |
|
909 | 909 | rename to dir/bazn |
|
910 | 910 | --- a/dir/baz |
|
911 | 911 | +++ b/dir/bazn |
|
912 | 912 | @@ -3,7 +3,7 @@ |
|
913 | 913 | 0 |
|
914 | 914 | 0 |
|
915 | 915 | 1+ |
|
916 | 916 | -2+ |
|
917 | 917 | + + |
|
918 | 918 | 3+ |
|
919 | 919 | 4 |
|
920 | 920 | 5 |
|
921 | 921 | $ hg log -f -L bazn,5:7 |
|
922 | 922 | changeset: 9:6af29c3a778f |
|
923 | 923 | tag: tip |
|
924 | 924 | user: test |
|
925 | 925 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
926 | 926 | summary: foo -> dir/baz; 1-1+ |
|
927 | 927 | |
|
928 | 928 | changeset: 5:cfdf972b3971 |
|
929 | 929 | user: test |
|
930 | 930 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
931 | 931 | summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+ |
|
932 | 932 | |
|
933 | 933 | changeset: 4:eaec41c1a0c9 |
|
934 | 934 | user: test |
|
935 | 935 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
936 | 936 | summary: 11 -> 11+; leading space before "1" |
|
937 | 937 | |
|
938 | 938 | changeset: 2:63a884426fd0 |
|
939 | 939 | user: test |
|
940 | 940 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
941 | 941 | summary: 2 -> 2+; added bar |
|
942 | 942 | |
|
943 | 943 | changeset: 0:5ae1f82b9a00 |
|
944 | 944 | user: test |
|
945 | 945 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
946 | 946 | summary: init |
|
947 | 947 | |
|
948 | 948 | |
|
949 | 949 | Uncommitted changes in line-range + wdir() |
|
950 | 950 | |
|
951 | 951 | $ hg log -r 'wdir()' -f -L bazn,5:7 --limit 2 -p |
|
952 | 952 | changeset: 2147483647:ffffffffffff |
|
953 | 953 | parent: 9:6af29c3a778f |
|
954 | 954 | user: test |
|
955 | 955 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
956 | 956 | |
|
957 | 957 | diff --git a/dir/baz b/dir/bazn |
|
958 | 958 | copy from dir/baz |
|
959 | 959 | copy to dir/bazn |
|
960 | 960 | --- a/dir/baz |
|
961 | 961 | +++ b/dir/bazn |
|
962 | 962 | @@ -3,7 +3,7 @@ |
|
963 | 963 | 0 |
|
964 | 964 | 0 |
|
965 | 965 | 1+ |
|
966 | 966 | -2+ |
|
967 | 967 | + + |
|
968 | 968 | 3+ |
|
969 | 969 | 4 |
|
970 | 970 | 5 |
|
971 | 971 | |
|
972 | 972 | changeset: 9:6af29c3a778f |
|
973 | 973 | tag: tip |
|
974 | 974 | user: test |
|
975 | 975 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
976 | 976 | summary: foo -> dir/baz; 1-1+ |
|
977 | 977 | |
|
978 | 978 | diff --git a/foo b/dir/baz |
|
979 | 979 | copy from foo |
|
980 | 980 | copy to dir/baz |
|
981 | 981 | --- a/foo |
|
982 | 982 | +++ b/dir/baz |
|
983 | 983 | @@ -2,7 +2,7 @@ |
|
984 | 984 | 0 |
|
985 | 985 | 0 |
|
986 | 986 | 0 |
|
987 | 987 | - 1 |
|
988 | 988 | + 1+ |
|
989 | 989 | 2+ |
|
990 | 990 | 3+ |
|
991 | 991 | 4 |
|
992 | 992 | |
|
993 | 993 | |
|
994 | 994 | $ hg revert -a -C -q |
|
995 | 995 | |
|
996 | 996 | Copies. |
|
997 | 997 | |
|
998 | 998 | $ hg copy baz bbaz |
|
999 | 999 | $ sed 's/6/6+/' bbaz > bbaz.new |
|
1000 | 1000 | $ mv bbaz.new bbaz |
|
1001 | 1001 | $ hg commit -m 'cp baz bbaz; 6-6+' |
|
1002 | 1002 | $ hg diff -c . |
|
1003 | 1003 | diff --git a/dir/baz b/dir/bbaz |
|
1004 | 1004 | copy from dir/baz |
|
1005 | 1005 | copy to dir/bbaz |
|
1006 | 1006 | --- a/dir/baz |
|
1007 | 1007 | +++ b/dir/bbaz |
|
1008 | 1008 | @@ -7,7 +7,7 @@ |
|
1009 | 1009 | 3+ |
|
1010 | 1010 | 4 |
|
1011 | 1011 | 5 |
|
1012 | 1012 | -6 |
|
1013 | 1013 | +6+ |
|
1014 | 1014 | 7 |
|
1015 | 1015 | 8 |
|
1016 | 1016 | 9 |
|
1017 | 1017 | $ hg log --copies -f -L bbaz,10:11 -p |
|
1018 | 1018 | changeset: 10:91a3d3b6c546 |
|
1019 | 1019 | tag: tip |
|
1020 | 1020 | user: test |
|
1021 | 1021 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1022 | 1022 | summary: cp baz bbaz; 6-6+ |
|
1023 | 1023 | |
|
1024 | 1024 | diff --git a/dir/baz b/dir/bbaz |
|
1025 | 1025 | copy from dir/baz |
|
1026 | 1026 | copy to dir/bbaz |
|
1027 | 1027 | --- a/dir/baz |
|
1028 | 1028 | +++ b/dir/bbaz |
|
1029 | 1029 | @@ -7,7 +7,7 @@ |
|
1030 | 1030 | 3+ |
|
1031 | 1031 | 4 |
|
1032 | 1032 | 5 |
|
1033 | 1033 | -6 |
|
1034 | 1034 | +6+ |
|
1035 | 1035 | 7 |
|
1036 | 1036 | 8 |
|
1037 | 1037 | 9 |
|
1038 | 1038 | |
|
1039 | 1039 | changeset: 3:730a61fbaecf |
|
1040 | 1040 | user: test |
|
1041 | 1041 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1042 | 1042 | summary: to 11 |
|
1043 | 1043 | |
|
1044 | 1044 | diff --git a/foo b/foo |
|
1045 | 1045 | --- a/foo |
|
1046 | 1046 | +++ b/foo |
|
1047 | 1047 | @@ -6,3 +6,10 @@ |
|
1048 | 1048 | 2+ |
|
1049 | 1049 | 3 |
|
1050 | 1050 | 4 |
|
1051 | 1051 | +5 |
|
1052 | 1052 | +6 |
|
1053 | 1053 | +7 |
|
1054 | 1054 | +8 |
|
1055 | 1055 | +9 |
|
1056 | 1056 | +10 |
|
1057 | 1057 | +11 |
|
1058 | 1058 | |
|
1059 | 1059 | $ hg log -f -L bbaz,10:11 -p |
|
1060 | 1060 | changeset: 10:91a3d3b6c546 |
|
1061 | 1061 | tag: tip |
|
1062 | 1062 | user: test |
|
1063 | 1063 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1064 | 1064 | summary: cp baz bbaz; 6-6+ |
|
1065 | 1065 | |
|
1066 | 1066 | diff --git a/dir/baz b/dir/bbaz |
|
1067 | 1067 | copy from dir/baz |
|
1068 | 1068 | copy to dir/bbaz |
|
1069 | 1069 | --- a/dir/baz |
|
1070 | 1070 | +++ b/dir/bbaz |
|
1071 | 1071 | @@ -7,7 +7,7 @@ |
|
1072 | 1072 | 3+ |
|
1073 | 1073 | 4 |
|
1074 | 1074 | 5 |
|
1075 | 1075 | -6 |
|
1076 | 1076 | +6+ |
|
1077 | 1077 | 7 |
|
1078 | 1078 | 8 |
|
1079 | 1079 | 9 |
|
1080 | 1080 | |
|
1081 | 1081 | changeset: 3:730a61fbaecf |
|
1082 | 1082 | user: test |
|
1083 | 1083 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1084 | 1084 | summary: to 11 |
|
1085 | 1085 | |
|
1086 | 1086 | diff --git a/foo b/foo |
|
1087 | 1087 | --- a/foo |
|
1088 | 1088 | +++ b/foo |
|
1089 | 1089 | @@ -6,3 +6,10 @@ |
|
1090 | 1090 | 2+ |
|
1091 | 1091 | 3 |
|
1092 | 1092 | 4 |
|
1093 | 1093 | +5 |
|
1094 | 1094 | +6 |
|
1095 | 1095 | +7 |
|
1096 | 1096 | +8 |
|
1097 | 1097 | +9 |
|
1098 | 1098 | +10 |
|
1099 | 1099 | +11 |
|
1100 | 1100 | |
|
1101 | 1101 | |
|
1102 | 1102 | Binary files work but without diff hunks filtering. |
|
1103 | 1103 | (Checking w/ and w/o diff.git option.) |
|
1104 | 1104 | |
|
1105 | 1105 | >>> open('binary', 'wb').write(b'this\nis\na\nbinary\0') and None |
|
1106 | 1106 | $ hg add binary |
|
1107 | 1107 | $ hg ci -m 'add a binary file' --quiet |
|
1108 | 1108 | $ hg log -f -L binary,1:2 -p |
|
1109 | 1109 | changeset: 11:dc865b608edf |
|
1110 | 1110 | tag: tip |
|
1111 | 1111 | user: test |
|
1112 | 1112 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1113 | 1113 | summary: add a binary file |
|
1114 | 1114 | |
|
1115 | 1115 | diff --git a/dir/binary b/dir/binary |
|
1116 | 1116 | new file mode 100644 |
|
1117 | index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..c2e1fbed209fe919b3f189a6a31950e9adf61e45 | |
|
1117 | index 0000000000000000000000000000000000000000..c2e1fbed209fe919b3f189a6a31950e9adf61e45 | |
|
1118 | 1118 | GIT binary patch |
|
1119 | 1119 | literal 17 |
|
1120 | 1120 | Wc$_QA$SmdpqC~Ew%)G>+N(KNlNClYy |
|
1121 | 1121 | |
|
1122 | 1122 | |
|
1123 | 1123 | $ hg log -f -L binary,1:2 -p --config diff.git=false |
|
1124 | 1124 | changeset: 11:dc865b608edf |
|
1125 | 1125 | tag: tip |
|
1126 | 1126 | user: test |
|
1127 | 1127 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1128 | 1128 | summary: add a binary file |
|
1129 | 1129 | |
|
1130 | 1130 | diff -r 91a3d3b6c546 -r dc865b608edf dir/binary |
|
1131 | 1131 | Binary file dir/binary has changed |
|
1132 | 1132 | |
|
1133 | 1133 | |
|
1134 | 1134 | Option --follow is required. |
|
1135 | 1135 | |
|
1136 | 1136 | $ hg log -L foo,5:7 |
|
1137 | 1137 | abort: --line-range requires --follow |
|
1138 | 1138 | [10] |
|
1139 | 1139 | |
|
1140 | 1140 | Non-exact pattern kinds are not allowed. |
|
1141 | 1141 | |
|
1142 | 1142 | $ cd .. |
|
1143 | 1143 | $ hg log -f -L glob:*a*,1:2 |
|
1144 | 1144 | hg: parse error: line range pattern 'glob:*a*' must match exactly one file |
|
1145 | 1145 | [10] |
|
1146 | 1146 | |
|
1147 | 1147 | We get an error for removed files. |
|
1148 | 1148 | |
|
1149 | 1149 | $ hg rm dir/baz |
|
1150 | 1150 | $ hg ci -m 'remove baz' --quiet |
|
1151 | 1151 | $ hg log -f -L dir/baz,5:7 -p |
|
1152 | 1152 | abort: cannot follow file not in parent revision: "dir/baz" |
|
1153 | 1153 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now