##// END OF EJS Templates
tests: use Python to write binary data in lfs test instead of shell...
Augie Fackler -
r35377:c7d49b87 default
parent child Browse files
Show More
@@ -1,682 +1,683
1 # Initial setup
1 # Initial setup
2
2
3 $ cat >> $HGRCPATH << EOF
3 $ cat >> $HGRCPATH << EOF
4 > [extensions]
4 > [extensions]
5 > lfs=
5 > lfs=
6 > [lfs]
6 > [lfs]
7 > threshold=1000B
7 > threshold=1000B
8 > EOF
8 > EOF
9
9
10 $ LONG=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB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CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
11
11
12 # Prepare server and enable extension
12 # Prepare server and enable extension
13 $ hg init server
13 $ hg init server
14 $ hg clone -q server client
14 $ hg clone -q server client
15 $ cd client
15 $ cd client
16
16
17 # Commit small file
17 # Commit small file
18 $ echo s > smallfile
18 $ echo s > smallfile
19 $ hg commit -Aqm "add small file"
19 $ hg commit -Aqm "add small file"
20
20
21 # Commit large file
21 # Commit large file
22 $ echo $LONG > largefile
22 $ echo $LONG > largefile
23 $ grep lfs .hg/requires
23 $ grep lfs .hg/requires
24 [1]
24 [1]
25 $ hg commit --traceback -Aqm "add large file"
25 $ hg commit --traceback -Aqm "add large file"
26 $ grep lfs .hg/requires
26 $ grep lfs .hg/requires
27 lfs
27 lfs
28
28
29 # Ensure metadata is stored
29 # Ensure metadata is stored
30 $ hg debugdata largefile 0
30 $ hg debugdata largefile 0
31 version https://git-lfs.github.com/spec/v1
31 version https://git-lfs.github.com/spec/v1
32 oid sha256:f11e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b
32 oid sha256:f11e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b
33 size 1501
33 size 1501
34 x-is-binary 0
34 x-is-binary 0
35
35
36 # Check the blobstore is populated
36 # Check the blobstore is populated
37 $ find .hg/store/lfs/objects | sort
37 $ find .hg/store/lfs/objects | sort
38 .hg/store/lfs/objects
38 .hg/store/lfs/objects
39 .hg/store/lfs/objects/f1
39 .hg/store/lfs/objects/f1
40 .hg/store/lfs/objects/f1/1e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b
40 .hg/store/lfs/objects/f1/1e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b
41
41
42 # Check the blob stored contains the actual contents of the file
42 # Check the blob stored contains the actual contents of the file
43 $ cat .hg/store/lfs/objects/f1/1e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b
43 $ cat .hg/store/lfs/objects/f1/1e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b
44 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB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CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
45
45
46 # Push changes to the server
46 # Push changes to the server
47
47
48 $ hg push
48 $ hg push
49 pushing to $TESTTMP/server (glob)
49 pushing to $TESTTMP/server (glob)
50 searching for changes
50 searching for changes
51 abort: lfs.url needs to be configured
51 abort: lfs.url needs to be configured
52 [255]
52 [255]
53
53
54 $ cat >> $HGRCPATH << EOF
54 $ cat >> $HGRCPATH << EOF
55 > [lfs]
55 > [lfs]
56 > url=file:$TESTTMP/dummy-remote/
56 > url=file:$TESTTMP/dummy-remote/
57 > EOF
57 > EOF
58
58
59 $ hg push -v | egrep -v '^(uncompressed| )'
59 $ hg push -v | egrep -v '^(uncompressed| )'
60 pushing to $TESTTMP/server (glob)
60 pushing to $TESTTMP/server (glob)
61 searching for changes
61 searching for changes
62 2 changesets found
62 2 changesets found
63 adding changesets
63 adding changesets
64 adding manifests
64 adding manifests
65 adding file changes
65 adding file changes
66 added 2 changesets with 2 changes to 2 files
66 added 2 changesets with 2 changes to 2 files
67
67
68 # Unknown URL scheme
68 # Unknown URL scheme
69
69
70 $ hg push --config lfs.url=ftp://foobar
70 $ hg push --config lfs.url=ftp://foobar
71 abort: lfs: unknown url scheme: ftp
71 abort: lfs: unknown url scheme: ftp
72 [255]
72 [255]
73
73
74 $ cd ../
74 $ cd ../
75
75
76 # Initialize new client (not cloning) and setup extension
76 # Initialize new client (not cloning) and setup extension
77 $ hg init client2
77 $ hg init client2
78 $ cd client2
78 $ cd client2
79 $ cat >> .hg/hgrc <<EOF
79 $ cat >> .hg/hgrc <<EOF
80 > [paths]
80 > [paths]
81 > default = $TESTTMP/server
81 > default = $TESTTMP/server
82 > EOF
82 > EOF
83
83
84 # Pull from server
84 # Pull from server
85 $ hg pull default
85 $ hg pull default
86 pulling from $TESTTMP/server (glob)
86 pulling from $TESTTMP/server (glob)
87 requesting all changes
87 requesting all changes
88 adding changesets
88 adding changesets
89 adding manifests
89 adding manifests
90 adding file changes
90 adding file changes
91 added 2 changesets with 2 changes to 2 files
91 added 2 changesets with 2 changes to 2 files
92 new changesets b29ba743f89d:00c137947d30
92 new changesets b29ba743f89d:00c137947d30
93 (run 'hg update' to get a working copy)
93 (run 'hg update' to get a working copy)
94
94
95 # Check the blobstore is not yet populated
95 # Check the blobstore is not yet populated
96 $ [ -d .hg/store/lfs/objects ]
96 $ [ -d .hg/store/lfs/objects ]
97 [1]
97 [1]
98
98
99 # Update to the last revision containing the large file
99 # Update to the last revision containing the large file
100 $ hg update
100 $ hg update
101 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
101 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
102
102
103 # Check the blobstore has been populated on update
103 # Check the blobstore has been populated on update
104 $ find .hg/store/lfs/objects | sort
104 $ find .hg/store/lfs/objects | sort
105 .hg/store/lfs/objects
105 .hg/store/lfs/objects
106 .hg/store/lfs/objects/f1
106 .hg/store/lfs/objects/f1
107 .hg/store/lfs/objects/f1/1e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b
107 .hg/store/lfs/objects/f1/1e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b
108
108
109 # Check the contents of the file are fetched from blobstore when requested
109 # Check the contents of the file are fetched from blobstore when requested
110 $ hg cat -r . largefile
110 $ hg cat -r . largefile
111 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
112
112
113 # Check the file has been copied in the working copy
113 # Check the file has been copied in the working copy
114 $ cat largefile
114 $ cat largefile
115 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
116
116
117 $ cd ..
117 $ cd ..
118
118
119 # Check rename, and switch between large and small files
119 # Check rename, and switch between large and small files
120
120
121 $ hg init repo3
121 $ hg init repo3
122 $ cd repo3
122 $ cd repo3
123 $ cat >> .hg/hgrc << EOF
123 $ cat >> .hg/hgrc << EOF
124 > [lfs]
124 > [lfs]
125 > threshold=10B
125 > threshold=10B
126 > EOF
126 > EOF
127
127
128 $ echo LONGER-THAN-TEN-BYTES-WILL-TRIGGER-LFS > large
128 $ echo LONGER-THAN-TEN-BYTES-WILL-TRIGGER-LFS > large
129 $ echo SHORTER > small
129 $ echo SHORTER > small
130 $ hg add . -q
130 $ hg add . -q
131 $ hg commit -m 'commit with lfs content'
131 $ hg commit -m 'commit with lfs content'
132
132
133 $ hg mv large l
133 $ hg mv large l
134 $ hg mv small s
134 $ hg mv small s
135 $ hg commit -m 'renames'
135 $ hg commit -m 'renames'
136
136
137 $ echo SHORT > l
137 $ echo SHORT > l
138 $ echo BECOME-LARGER-FROM-SHORTER > s
138 $ echo BECOME-LARGER-FROM-SHORTER > s
139 $ hg commit -m 'large to small, small to large'
139 $ hg commit -m 'large to small, small to large'
140
140
141 $ echo 1 >> l
141 $ echo 1 >> l
142 $ echo 2 >> s
142 $ echo 2 >> s
143 $ hg commit -m 'random modifications'
143 $ hg commit -m 'random modifications'
144
144
145 $ echo RESTORE-TO-BE-LARGE > l
145 $ echo RESTORE-TO-BE-LARGE > l
146 $ echo SHORTER > s
146 $ echo SHORTER > s
147 $ hg commit -m 'switch large and small again'
147 $ hg commit -m 'switch large and small again'
148
148
149 # Test lfs_files template
149 # Test lfs_files template
150
150
151 $ hg log -r 'all()' -T '{rev} {join(lfs_files, ", ")}\n'
151 $ hg log -r 'all()' -T '{rev} {join(lfs_files, ", ")}\n'
152 0 large
152 0 large
153 1 l
153 1 l
154 2 s
154 2 s
155 3 s
155 3 s
156 4 l
156 4 l
157
157
158 # Push and pull the above repo
158 # Push and pull the above repo
159
159
160 $ hg --cwd .. init repo4
160 $ hg --cwd .. init repo4
161 $ hg push ../repo4
161 $ hg push ../repo4
162 pushing to ../repo4
162 pushing to ../repo4
163 searching for changes
163 searching for changes
164 adding changesets
164 adding changesets
165 adding manifests
165 adding manifests
166 adding file changes
166 adding file changes
167 added 5 changesets with 10 changes to 4 files
167 added 5 changesets with 10 changes to 4 files
168
168
169 $ hg --cwd .. init repo5
169 $ hg --cwd .. init repo5
170 $ hg --cwd ../repo5 pull ../repo3
170 $ hg --cwd ../repo5 pull ../repo3
171 pulling from ../repo3
171 pulling from ../repo3
172 requesting all changes
172 requesting all changes
173 adding changesets
173 adding changesets
174 adding manifests
174 adding manifests
175 adding file changes
175 adding file changes
176 added 5 changesets with 10 changes to 4 files
176 added 5 changesets with 10 changes to 4 files
177 new changesets fd47a419c4f7:5adf850972b9
177 new changesets fd47a419c4f7:5adf850972b9
178 (run 'hg update' to get a working copy)
178 (run 'hg update' to get a working copy)
179
179
180 $ cd ..
180 $ cd ..
181
181
182 # Test clone
182 # Test clone
183
183
184 $ hg init repo6
184 $ hg init repo6
185 $ cd repo6
185 $ cd repo6
186 $ cat >> .hg/hgrc << EOF
186 $ cat >> .hg/hgrc << EOF
187 > [lfs]
187 > [lfs]
188 > threshold=30B
188 > threshold=30B
189 > EOF
189 > EOF
190
190
191 $ echo LARGE-BECAUSE-IT-IS-MORE-THAN-30-BYTES > large
191 $ echo LARGE-BECAUSE-IT-IS-MORE-THAN-30-BYTES > large
192 $ echo SMALL > small
192 $ echo SMALL > small
193 $ hg commit -Aqm 'create a lfs file' large small
193 $ hg commit -Aqm 'create a lfs file' large small
194 $ hg debuglfsupload -r 'all()' -v
194 $ hg debuglfsupload -r 'all()' -v
195
195
196 $ cd ..
196 $ cd ..
197
197
198 $ hg clone repo6 repo7
198 $ hg clone repo6 repo7
199 updating to branch default
199 updating to branch default
200 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
200 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
201 $ cd repo7
201 $ cd repo7
202 $ hg config extensions --debug | grep lfs
202 $ hg config extensions --debug | grep lfs
203 $TESTTMP/repo7/.hg/hgrc:*: extensions.lfs= (glob)
203 $TESTTMP/repo7/.hg/hgrc:*: extensions.lfs= (glob)
204 $ cat large
204 $ cat large
205 LARGE-BECAUSE-IT-IS-MORE-THAN-30-BYTES
205 LARGE-BECAUSE-IT-IS-MORE-THAN-30-BYTES
206 $ cat small
206 $ cat small
207 SMALL
207 SMALL
208
208
209 $ cd ..
209 $ cd ..
210
210
211 $ hg --config extensions.share= share repo7 sharedrepo
211 $ hg --config extensions.share= share repo7 sharedrepo
212 updating working directory
212 updating working directory
213 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
213 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
214 $ hg -R sharedrepo config extensions --debug | grep lfs
214 $ hg -R sharedrepo config extensions --debug | grep lfs
215 $TESTTMP/sharedrepo/.hg/hgrc:*: extensions.lfs= (glob)
215 $TESTTMP/sharedrepo/.hg/hgrc:*: extensions.lfs= (glob)
216
216
217 # Test rename and status
217 # Test rename and status
218
218
219 $ hg init repo8
219 $ hg init repo8
220 $ cd repo8
220 $ cd repo8
221 $ cat >> .hg/hgrc << EOF
221 $ cat >> .hg/hgrc << EOF
222 > [lfs]
222 > [lfs]
223 > threshold=10B
223 > threshold=10B
224 > EOF
224 > EOF
225
225
226 $ echo THIS-IS-LFS-BECAUSE-10-BYTES > a1
226 $ echo THIS-IS-LFS-BECAUSE-10-BYTES > a1
227 $ echo SMALL > a2
227 $ echo SMALL > a2
228 $ hg commit -m a -A a1 a2
228 $ hg commit -m a -A a1 a2
229 $ hg status
229 $ hg status
230 $ hg mv a1 b1
230 $ hg mv a1 b1
231 $ hg mv a2 a1
231 $ hg mv a2 a1
232 $ hg mv b1 a2
232 $ hg mv b1 a2
233 $ hg commit -m b
233 $ hg commit -m b
234 $ hg status
234 $ hg status
235 $ HEADER=$'\1\n'
235 >>> with open('a2', 'wb') as f:
236 $ printf '%sSTART-WITH-HG-FILELOG-METADATA' "$HEADER" > a2
236 ... f.write(b'\1\nSTART-WITH-HG-FILELOG-METADATA')
237 $ printf '%sMETA\n' "$HEADER" > a1
237 >>> with open('a1', 'wb') as f:
238 ... f.write(b'\1\nMETA\n')
238 $ hg commit -m meta
239 $ hg commit -m meta
239 $ hg status
240 $ hg status
240 $ hg log -T '{rev}: {file_copies} | {file_dels} | {file_adds}\n'
241 $ hg log -T '{rev}: {file_copies} | {file_dels} | {file_adds}\n'
241 2: | |
242 2: | |
242 1: a1 (a2)a2 (a1) | |
243 1: a1 (a2)a2 (a1) | |
243 0: | | a1 a2
244 0: | | a1 a2
244
245
245 $ for n in a1 a2; do
246 $ for n in a1 a2; do
246 > for r in 0 1 2; do
247 > for r in 0 1 2; do
247 > printf '\n%s @ %s\n' $n $r
248 > printf '\n%s @ %s\n' $n $r
248 > hg debugdata $n $r
249 > hg debugdata $n $r
249 > done
250 > done
250 > done
251 > done
251
252
252 a1 @ 0
253 a1 @ 0
253 version https://git-lfs.github.com/spec/v1
254 version https://git-lfs.github.com/spec/v1
254 oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
255 oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
255 size 29
256 size 29
256 x-is-binary 0
257 x-is-binary 0
257
258
258 a1 @ 1
259 a1 @ 1
259 \x01 (esc)
260 \x01 (esc)
260 copy: a2
261 copy: a2
261 copyrev: 50470ad23cf937b1f4b9f80bfe54df38e65b50d9
262 copyrev: 50470ad23cf937b1f4b9f80bfe54df38e65b50d9
262 \x01 (esc)
263 \x01 (esc)
263 SMALL
264 SMALL
264
265
265 a1 @ 2
266 a1 @ 2
266 \x01 (esc)
267 \x01 (esc)
267 \x01 (esc)
268 \x01 (esc)
268 \x01 (esc)
269 \x01 (esc)
269 META
270 META
270
271
271 a2 @ 0
272 a2 @ 0
272 SMALL
273 SMALL
273
274
274 a2 @ 1
275 a2 @ 1
275 version https://git-lfs.github.com/spec/v1
276 version https://git-lfs.github.com/spec/v1
276 oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
277 oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
277 size 29
278 size 29
278 x-hg-copy a1
279 x-hg-copy a1
279 x-hg-copyrev be23af27908a582af43e5cda209a5a9b319de8d4
280 x-hg-copyrev be23af27908a582af43e5cda209a5a9b319de8d4
280 x-is-binary 0
281 x-is-binary 0
281
282
282 a2 @ 2
283 a2 @ 2
283 version https://git-lfs.github.com/spec/v1
284 version https://git-lfs.github.com/spec/v1
284 oid sha256:876dadc86a8542f9798048f2c47f51dbf8e4359aed883e8ec80c5db825f0d943
285 oid sha256:876dadc86a8542f9798048f2c47f51dbf8e4359aed883e8ec80c5db825f0d943
285 size 32
286 size 32
286 x-is-binary 0
287 x-is-binary 0
287
288
288 # Verify commit hashes include rename metadata
289 # Verify commit hashes include rename metadata
289
290
290 $ hg log -T '{rev}:{node|short} {desc}\n'
291 $ hg log -T '{rev}:{node|short} {desc}\n'
291 2:0fae949de7fa meta
292 2:0fae949de7fa meta
292 1:9cd6bdffdac0 b
293 1:9cd6bdffdac0 b
293 0:7f96794915f7 a
294 0:7f96794915f7 a
294
295
295 $ cd ..
296 $ cd ..
296
297
297 # Test bundle
298 # Test bundle
298
299
299 $ hg init repo9
300 $ hg init repo9
300 $ cd repo9
301 $ cd repo9
301 $ cat >> .hg/hgrc << EOF
302 $ cat >> .hg/hgrc << EOF
302 > [lfs]
303 > [lfs]
303 > threshold=10B
304 > threshold=10B
304 > [diff]
305 > [diff]
305 > git=1
306 > git=1
306 > EOF
307 > EOF
307
308
308 $ for i in 0 single two three 4; do
309 $ for i in 0 single two three 4; do
309 > echo 'THIS-IS-LFS-'$i > a
310 > echo 'THIS-IS-LFS-'$i > a
310 > hg commit -m a-$i -A a
311 > hg commit -m a-$i -A a
311 > done
312 > done
312
313
313 $ hg update 2 -q
314 $ hg update 2 -q
314 $ echo 'THIS-IS-LFS-2-CHILD' > a
315 $ echo 'THIS-IS-LFS-2-CHILD' > a
315 $ hg commit -m branching -q
316 $ hg commit -m branching -q
316
317
317 $ hg bundle --base 1 bundle.hg -v
318 $ hg bundle --base 1 bundle.hg -v
318 4 changesets found
319 4 changesets found
319 uncompressed size of bundle content:
320 uncompressed size of bundle content:
320 * (changelog) (glob)
321 * (changelog) (glob)
321 * (manifests) (glob)
322 * (manifests) (glob)
322 * a (glob)
323 * a (glob)
323 $ hg --config extensions.strip= strip -r 2 --no-backup --force -q
324 $ hg --config extensions.strip= strip -r 2 --no-backup --force -q
324 $ hg -R bundle.hg log -p -T '{rev} {desc}\n' a
325 $ hg -R bundle.hg log -p -T '{rev} {desc}\n' a
325 5 branching
326 5 branching
326 diff --git a/a b/a
327 diff --git a/a b/a
327 --- a/a
328 --- a/a
328 +++ b/a
329 +++ b/a
329 @@ -1,1 +1,1 @@
330 @@ -1,1 +1,1 @@
330 -THIS-IS-LFS-two
331 -THIS-IS-LFS-two
331 +THIS-IS-LFS-2-CHILD
332 +THIS-IS-LFS-2-CHILD
332
333
333 4 a-4
334 4 a-4
334 diff --git a/a b/a
335 diff --git a/a b/a
335 --- a/a
336 --- a/a
336 +++ b/a
337 +++ b/a
337 @@ -1,1 +1,1 @@
338 @@ -1,1 +1,1 @@
338 -THIS-IS-LFS-three
339 -THIS-IS-LFS-three
339 +THIS-IS-LFS-4
340 +THIS-IS-LFS-4
340
341
341 3 a-three
342 3 a-three
342 diff --git a/a b/a
343 diff --git a/a b/a
343 --- a/a
344 --- a/a
344 +++ b/a
345 +++ b/a
345 @@ -1,1 +1,1 @@
346 @@ -1,1 +1,1 @@
346 -THIS-IS-LFS-two
347 -THIS-IS-LFS-two
347 +THIS-IS-LFS-three
348 +THIS-IS-LFS-three
348
349
349 2 a-two
350 2 a-two
350 diff --git a/a b/a
351 diff --git a/a b/a
351 --- a/a
352 --- a/a
352 +++ b/a
353 +++ b/a
353 @@ -1,1 +1,1 @@
354 @@ -1,1 +1,1 @@
354 -THIS-IS-LFS-single
355 -THIS-IS-LFS-single
355 +THIS-IS-LFS-two
356 +THIS-IS-LFS-two
356
357
357 1 a-single
358 1 a-single
358 diff --git a/a b/a
359 diff --git a/a b/a
359 --- a/a
360 --- a/a
360 +++ b/a
361 +++ b/a
361 @@ -1,1 +1,1 @@
362 @@ -1,1 +1,1 @@
362 -THIS-IS-LFS-0
363 -THIS-IS-LFS-0
363 +THIS-IS-LFS-single
364 +THIS-IS-LFS-single
364
365
365 0 a-0
366 0 a-0
366 diff --git a/a b/a
367 diff --git a/a b/a
367 new file mode 100644
368 new file mode 100644
368 --- /dev/null
369 --- /dev/null
369 +++ b/a
370 +++ b/a
370 @@ -0,0 +1,1 @@
371 @@ -0,0 +1,1 @@
371 +THIS-IS-LFS-0
372 +THIS-IS-LFS-0
372
373
373 $ hg bundle -R bundle.hg --base 1 bundle-again.hg -q
374 $ hg bundle -R bundle.hg --base 1 bundle-again.hg -q
374 $ hg -R bundle-again.hg log -p -T '{rev} {desc}\n' a
375 $ hg -R bundle-again.hg log -p -T '{rev} {desc}\n' a
375 5 branching
376 5 branching
376 diff --git a/a b/a
377 diff --git a/a b/a
377 --- a/a
378 --- a/a
378 +++ b/a
379 +++ b/a
379 @@ -1,1 +1,1 @@
380 @@ -1,1 +1,1 @@
380 -THIS-IS-LFS-two
381 -THIS-IS-LFS-two
381 +THIS-IS-LFS-2-CHILD
382 +THIS-IS-LFS-2-CHILD
382
383
383 4 a-4
384 4 a-4
384 diff --git a/a b/a
385 diff --git a/a b/a
385 --- a/a
386 --- a/a
386 +++ b/a
387 +++ b/a
387 @@ -1,1 +1,1 @@
388 @@ -1,1 +1,1 @@
388 -THIS-IS-LFS-three
389 -THIS-IS-LFS-three
389 +THIS-IS-LFS-4
390 +THIS-IS-LFS-4
390
391
391 3 a-three
392 3 a-three
392 diff --git a/a b/a
393 diff --git a/a b/a
393 --- a/a
394 --- a/a
394 +++ b/a
395 +++ b/a
395 @@ -1,1 +1,1 @@
396 @@ -1,1 +1,1 @@
396 -THIS-IS-LFS-two
397 -THIS-IS-LFS-two
397 +THIS-IS-LFS-three
398 +THIS-IS-LFS-three
398
399
399 2 a-two
400 2 a-two
400 diff --git a/a b/a
401 diff --git a/a b/a
401 --- a/a
402 --- a/a
402 +++ b/a
403 +++ b/a
403 @@ -1,1 +1,1 @@
404 @@ -1,1 +1,1 @@
404 -THIS-IS-LFS-single
405 -THIS-IS-LFS-single
405 +THIS-IS-LFS-two
406 +THIS-IS-LFS-two
406
407
407 1 a-single
408 1 a-single
408 diff --git a/a b/a
409 diff --git a/a b/a
409 --- a/a
410 --- a/a
410 +++ b/a
411 +++ b/a
411 @@ -1,1 +1,1 @@
412 @@ -1,1 +1,1 @@
412 -THIS-IS-LFS-0
413 -THIS-IS-LFS-0
413 +THIS-IS-LFS-single
414 +THIS-IS-LFS-single
414
415
415 0 a-0
416 0 a-0
416 diff --git a/a b/a
417 diff --git a/a b/a
417 new file mode 100644
418 new file mode 100644
418 --- /dev/null
419 --- /dev/null
419 +++ b/a
420 +++ b/a
420 @@ -0,0 +1,1 @@
421 @@ -0,0 +1,1 @@
421 +THIS-IS-LFS-0
422 +THIS-IS-LFS-0
422
423
423 $ cd ..
424 $ cd ..
424
425
425 # Test isbinary
426 # Test isbinary
426
427
427 $ hg init repo10
428 $ hg init repo10
428 $ cd repo10
429 $ cd repo10
429 $ cat >> .hg/hgrc << EOF
430 $ cat >> .hg/hgrc << EOF
430 > [extensions]
431 > [extensions]
431 > lfs=
432 > lfs=
432 > [lfs]
433 > [lfs]
433 > threshold=1
434 > threshold=1
434 > EOF
435 > EOF
435 $ $PYTHON <<'EOF'
436 $ $PYTHON <<'EOF'
436 > def write(path, content):
437 > def write(path, content):
437 > with open(path, 'wb') as f:
438 > with open(path, 'wb') as f:
438 > f.write(content)
439 > f.write(content)
439 > write('a', b'\0\0')
440 > write('a', b'\0\0')
440 > write('b', b'\1\n')
441 > write('b', b'\1\n')
441 > write('c', b'\1\n\0')
442 > write('c', b'\1\n\0')
442 > write('d', b'xx')
443 > write('d', b'xx')
443 > EOF
444 > EOF
444 $ hg add a b c d
445 $ hg add a b c d
445 $ hg diff --stat
446 $ hg diff --stat
446 a | Bin
447 a | Bin
447 b | 1 +
448 b | 1 +
448 c | Bin
449 c | Bin
449 d | 1 +
450 d | 1 +
450 4 files changed, 2 insertions(+), 0 deletions(-)
451 4 files changed, 2 insertions(+), 0 deletions(-)
451 $ hg commit -m binarytest
452 $ hg commit -m binarytest
452 $ cat > $TESTTMP/dumpbinary.py << EOF
453 $ cat > $TESTTMP/dumpbinary.py << EOF
453 > def reposetup(ui, repo):
454 > def reposetup(ui, repo):
454 > for n in 'abcd':
455 > for n in 'abcd':
455 > ui.write(('%s: binary=%s\n') % (n, repo['.'][n].isbinary()))
456 > ui.write(('%s: binary=%s\n') % (n, repo['.'][n].isbinary()))
456 > EOF
457 > EOF
457 $ hg --config extensions.dumpbinary=$TESTTMP/dumpbinary.py id --trace
458 $ hg --config extensions.dumpbinary=$TESTTMP/dumpbinary.py id --trace
458 a: binary=True
459 a: binary=True
459 b: binary=False
460 b: binary=False
460 c: binary=True
461 c: binary=True
461 d: binary=False
462 d: binary=False
462 b55353847f02 tip
463 b55353847f02 tip
463
464
464 $ cd ..
465 $ cd ..
465
466
466 # Test fctx.cmp fastpath - diff without LFS blobs
467 # Test fctx.cmp fastpath - diff without LFS blobs
467
468
468 $ hg init repo11
469 $ hg init repo11
469 $ cd repo11
470 $ cd repo11
470 $ cat >> .hg/hgrc <<EOF
471 $ cat >> .hg/hgrc <<EOF
471 > [lfs]
472 > [lfs]
472 > threshold=1
473 > threshold=1
473 > EOF
474 > EOF
474 $ cat > ../patch.diff <<EOF
475 $ cat > ../patch.diff <<EOF
475 > # HG changeset patch
476 > # HG changeset patch
476 > 2
477 > 2
477 >
478 >
478 > diff --git a/a b/a
479 > diff --git a/a b/a
479 > old mode 100644
480 > old mode 100644
480 > new mode 100755
481 > new mode 100755
481 > EOF
482 > EOF
482
483
483 $ for i in 1 2 3; do
484 $ for i in 1 2 3; do
484 > cp ../repo10/a a
485 > cp ../repo10/a a
485 > if [ $i = 3 ]; then
486 > if [ $i = 3 ]; then
486 > # make a content-only change
487 > # make a content-only change
487 > hg import -q --bypass ../patch.diff
488 > hg import -q --bypass ../patch.diff
488 > hg update -q
489 > hg update -q
489 > rm ../patch.diff
490 > rm ../patch.diff
490 > else
491 > else
491 > echo $i >> a
492 > echo $i >> a
492 > hg commit -m $i -A a
493 > hg commit -m $i -A a
493 > fi
494 > fi
494 > done
495 > done
495 $ [ -d .hg/store/lfs/objects ]
496 $ [ -d .hg/store/lfs/objects ]
496
497
497 $ cd ..
498 $ cd ..
498
499
499 $ hg clone repo11 repo12 --noupdate
500 $ hg clone repo11 repo12 --noupdate
500 $ cd repo12
501 $ cd repo12
501 $ hg log --removed -p a -T '{desc}\n' --config diff.nobinary=1 --git
502 $ hg log --removed -p a -T '{desc}\n' --config diff.nobinary=1 --git
502 2
503 2
503 diff --git a/a b/a
504 diff --git a/a b/a
504 old mode 100644
505 old mode 100644
505 new mode 100755
506 new mode 100755
506
507
507 2
508 2
508 diff --git a/a b/a
509 diff --git a/a b/a
509 Binary file a has changed
510 Binary file a has changed
510
511
511 1
512 1
512 diff --git a/a b/a
513 diff --git a/a b/a
513 new file mode 100644
514 new file mode 100644
514 Binary file a has changed
515 Binary file a has changed
515
516
516 $ [ -d .hg/store/lfs/objects ]
517 $ [ -d .hg/store/lfs/objects ]
517 [1]
518 [1]
518
519
519 $ cd ..
520 $ cd ..
520
521
521 # Verify the repos
522 # Verify the repos
522
523
523 $ cat > $TESTTMP/dumpflog.py << EOF
524 $ cat > $TESTTMP/dumpflog.py << EOF
524 > # print raw revision sizes, flags, and hashes for certain files
525 > # print raw revision sizes, flags, and hashes for certain files
525 > import hashlib
526 > import hashlib
526 > from mercurial import revlog
527 > from mercurial import revlog
527 > from mercurial.node import short
528 > from mercurial.node import short
528 > def hash(rawtext):
529 > def hash(rawtext):
529 > h = hashlib.sha512()
530 > h = hashlib.sha512()
530 > h.update(rawtext)
531 > h.update(rawtext)
531 > return h.hexdigest()[:4]
532 > return h.hexdigest()[:4]
532 > def reposetup(ui, repo):
533 > def reposetup(ui, repo):
533 > # these 2 files are interesting
534 > # these 2 files are interesting
534 > for name in ['l', 's']:
535 > for name in ['l', 's']:
535 > fl = repo.file(name)
536 > fl = repo.file(name)
536 > if len(fl) == 0:
537 > if len(fl) == 0:
537 > continue
538 > continue
538 > sizes = [revlog.revlog.rawsize(fl, i) for i in fl]
539 > sizes = [revlog.revlog.rawsize(fl, i) for i in fl]
539 > texts = [fl.revision(i, raw=True) for i in fl]
540 > texts = [fl.revision(i, raw=True) for i in fl]
540 > flags = [int(fl.flags(i)) for i in fl]
541 > flags = [int(fl.flags(i)) for i in fl]
541 > hashes = [hash(t) for t in texts]
542 > hashes = [hash(t) for t in texts]
542 > print(' %s: rawsizes=%r flags=%r hashes=%r'
543 > print(' %s: rawsizes=%r flags=%r hashes=%r'
543 > % (name, sizes, flags, hashes))
544 > % (name, sizes, flags, hashes))
544 > EOF
545 > EOF
545
546
546 $ for i in client client2 server repo3 repo4 repo5 repo6 repo7 repo8 repo9 \
547 $ for i in client client2 server repo3 repo4 repo5 repo6 repo7 repo8 repo9 \
547 > repo10; do
548 > repo10; do
548 > echo 'repo:' $i
549 > echo 'repo:' $i
549 > hg --cwd $i verify --config extensions.dumpflog=$TESTTMP/dumpflog.py -q
550 > hg --cwd $i verify --config extensions.dumpflog=$TESTTMP/dumpflog.py -q
550 > done
551 > done
551 repo: client
552 repo: client
552 repo: client2
553 repo: client2
553 repo: server
554 repo: server
554 repo: repo3
555 repo: repo3
555 l: rawsizes=[211, 6, 8, 141] flags=[8192, 0, 0, 8192] hashes=['d2b8', '948c', 'cc88', '724d']
556 l: rawsizes=[211, 6, 8, 141] flags=[8192, 0, 0, 8192] hashes=['d2b8', '948c', 'cc88', '724d']
556 s: rawsizes=[74, 141, 141, 8] flags=[0, 8192, 8192, 0] hashes=['3c80', 'fce0', '874a', '826b']
557 s: rawsizes=[74, 141, 141, 8] flags=[0, 8192, 8192, 0] hashes=['3c80', 'fce0', '874a', '826b']
557 repo: repo4
558 repo: repo4
558 l: rawsizes=[211, 6, 8, 141] flags=[8192, 0, 0, 8192] hashes=['d2b8', '948c', 'cc88', '724d']
559 l: rawsizes=[211, 6, 8, 141] flags=[8192, 0, 0, 8192] hashes=['d2b8', '948c', 'cc88', '724d']
559 s: rawsizes=[74, 141, 141, 8] flags=[0, 8192, 8192, 0] hashes=['3c80', 'fce0', '874a', '826b']
560 s: rawsizes=[74, 141, 141, 8] flags=[0, 8192, 8192, 0] hashes=['3c80', 'fce0', '874a', '826b']
560 repo: repo5
561 repo: repo5
561 l: rawsizes=[211, 6, 8, 141] flags=[8192, 0, 0, 8192] hashes=['d2b8', '948c', 'cc88', '724d']
562 l: rawsizes=[211, 6, 8, 141] flags=[8192, 0, 0, 8192] hashes=['d2b8', '948c', 'cc88', '724d']
562 s: rawsizes=[74, 141, 141, 8] flags=[0, 8192, 8192, 0] hashes=['3c80', 'fce0', '874a', '826b']
563 s: rawsizes=[74, 141, 141, 8] flags=[0, 8192, 8192, 0] hashes=['3c80', 'fce0', '874a', '826b']
563 repo: repo6
564 repo: repo6
564 repo: repo7
565 repo: repo7
565 repo: repo8
566 repo: repo8
566 repo: repo9
567 repo: repo9
567 repo: repo10
568 repo: repo10
568
569
569 repo12 doesn't have any cached lfs files and its source never pushed its
570 repo12 doesn't have any cached lfs files and its source never pushed its
570 files. Therefore, the files don't exist in the remote store. Use the files in
571 files. Therefore, the files don't exist in the remote store. Use the files in
571 the user cache.
572 the user cache.
572
573
573 $ find $TESTTMP/repo12/.hg/store/lfs/objects -type f
574 $ find $TESTTMP/repo12/.hg/store/lfs/objects -type f
574 find: */repo12/.hg/store/lfs/objects*: $ENOENT$ (glob)
575 find: */repo12/.hg/store/lfs/objects*: $ENOENT$ (glob)
575 [1]
576 [1]
576
577
577 $ hg --config extensions.share= share repo12 repo13
578 $ hg --config extensions.share= share repo12 repo13
578 updating working directory
579 updating working directory
579 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
580 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
580 $ hg -R repo13 -q verify
581 $ hg -R repo13 -q verify
581
582
582 $ hg clone repo12 repo14
583 $ hg clone repo12 repo14
583 updating to branch default
584 updating to branch default
584 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
585 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
585 $ hg -R repo14 -q verify
586 $ hg -R repo14 -q verify
586
587
587 If the source repo doesn't have the blob (maybe it was pulled or cloned with
588 If the source repo doesn't have the blob (maybe it was pulled or cloned with
588 --noupdate), the blob is still accessible via the global cache to send to the
589 --noupdate), the blob is still accessible via the global cache to send to the
589 remote store.
590 remote store.
590
591
591 $ rm -rf $TESTTMP/repo14/.hg/store/lfs
592 $ rm -rf $TESTTMP/repo14/.hg/store/lfs
592 $ hg init repo15
593 $ hg init repo15
593 $ hg -R repo14 push repo15
594 $ hg -R repo14 push repo15
594 pushing to repo15
595 pushing to repo15
595 searching for changes
596 searching for changes
596 adding changesets
597 adding changesets
597 adding manifests
598 adding manifests
598 adding file changes
599 adding file changes
599 added 3 changesets with 2 changes to 1 files
600 added 3 changesets with 2 changes to 1 files
600 $ hg -R repo14 -q verify
601 $ hg -R repo14 -q verify
601
602
602 lfs -> normal -> lfs round trip conversions are possible. The threshold for the
603 lfs -> normal -> lfs round trip conversions are possible. The threshold for the
603 lfs destination is specified here because it was originally listed in the local
604 lfs destination is specified here because it was originally listed in the local
604 .hgrc, and the global one is too high to trigger lfs usage. For lfs -> normal,
605 .hgrc, and the global one is too high to trigger lfs usage. For lfs -> normal,
605 there's no 'lfs' destination repo requirement. For normal -> lfs, there is.
606 there's no 'lfs' destination repo requirement. For normal -> lfs, there is.
606
607
607 XXX: There's not a great way to ensure that the conversion to normal files
608 XXX: There's not a great way to ensure that the conversion to normal files
608 actually converts _everything_ to normal. The extension needs to be loaded for
609 actually converts _everything_ to normal. The extension needs to be loaded for
609 the source, but there's no way to disable it for the destination. The best that
610 the source, but there's no way to disable it for the destination. The best that
610 can be done is to raise the threshold so that lfs isn't used on the destination.
611 can be done is to raise the threshold so that lfs isn't used on the destination.
611 It doesn't like using '!' to unset the value on the command line.
612 It doesn't like using '!' to unset the value on the command line.
612
613
613 $ hg --config extensions.convert= --config lfs.threshold=1000M \
614 $ hg --config extensions.convert= --config lfs.threshold=1000M \
614 > convert repo8 convert_normal
615 > convert repo8 convert_normal
615 initializing destination convert_normal repository
616 initializing destination convert_normal repository
616 scanning source...
617 scanning source...
617 sorting...
618 sorting...
618 converting...
619 converting...
619 2 a
620 2 a
620 1 b
621 1 b
621 0 meta
622 0 meta
622 $ grep 'lfs' convert_normal/.hg/requires
623 $ grep 'lfs' convert_normal/.hg/requires
623 [1]
624 [1]
624 $ hg --cwd convert_normal debugdata a1 0
625 $ hg --cwd convert_normal debugdata a1 0
625 THIS-IS-LFS-BECAUSE-10-BYTES
626 THIS-IS-LFS-BECAUSE-10-BYTES
626
627
627 $ hg --config extensions.convert= --config lfs.threshold=10B \
628 $ hg --config extensions.convert= --config lfs.threshold=10B \
628 > convert convert_normal convert_lfs
629 > convert convert_normal convert_lfs
629 initializing destination convert_lfs repository
630 initializing destination convert_lfs repository
630 scanning source...
631 scanning source...
631 sorting...
632 sorting...
632 converting...
633 converting...
633 2 a
634 2 a
634 1 b
635 1 b
635 0 meta
636 0 meta
636 $ hg --cwd convert_lfs debugdata a1 0
637 $ hg --cwd convert_lfs debugdata a1 0
637 version https://git-lfs.github.com/spec/v1
638 version https://git-lfs.github.com/spec/v1
638 oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
639 oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
639 size 29
640 size 29
640 x-is-binary 0
641 x-is-binary 0
641 $ grep 'lfs' convert_lfs/.hg/requires
642 $ grep 'lfs' convert_lfs/.hg/requires
642 lfs
643 lfs
643
644
644 This convert is trickier, because it contains deleted files (via `hg mv`)
645 This convert is trickier, because it contains deleted files (via `hg mv`)
645
646
646 $ hg --config extensions.convert= --config lfs.threshold=1000M \
647 $ hg --config extensions.convert= --config lfs.threshold=1000M \
647 > convert repo3 convert_normal2
648 > convert repo3 convert_normal2
648 initializing destination convert_normal2 repository
649 initializing destination convert_normal2 repository
649 scanning source...
650 scanning source...
650 sorting...
651 sorting...
651 converting...
652 converting...
652 4 commit with lfs content
653 4 commit with lfs content
653 3 renames
654 3 renames
654 2 large to small, small to large
655 2 large to small, small to large
655 1 random modifications
656 1 random modifications
656 0 switch large and small again
657 0 switch large and small again
657 $ grep 'lfs' convert_normal2/.hg/requires
658 $ grep 'lfs' convert_normal2/.hg/requires
658 [1]
659 [1]
659 $ hg --cwd convert_normal2 debugdata large 0
660 $ hg --cwd convert_normal2 debugdata large 0
660 LONGER-THAN-TEN-BYTES-WILL-TRIGGER-LFS
661 LONGER-THAN-TEN-BYTES-WILL-TRIGGER-LFS
661
662
662 $ hg --config extensions.convert= --config lfs.threshold=10B \
663 $ hg --config extensions.convert= --config lfs.threshold=10B \
663 > convert convert_normal2 convert_lfs2
664 > convert convert_normal2 convert_lfs2
664 initializing destination convert_lfs2 repository
665 initializing destination convert_lfs2 repository
665 scanning source...
666 scanning source...
666 sorting...
667 sorting...
667 converting...
668 converting...
668 4 commit with lfs content
669 4 commit with lfs content
669 3 renames
670 3 renames
670 2 large to small, small to large
671 2 large to small, small to large
671 1 random modifications
672 1 random modifications
672 0 switch large and small again
673 0 switch large and small again
673 $ grep 'lfs' convert_lfs2/.hg/requires
674 $ grep 'lfs' convert_lfs2/.hg/requires
674 lfs
675 lfs
675 $ hg --cwd convert_lfs2 debugdata large 0
676 $ hg --cwd convert_lfs2 debugdata large 0
676 version https://git-lfs.github.com/spec/v1
677 version https://git-lfs.github.com/spec/v1
677 oid sha256:66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e
678 oid sha256:66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e
678 size 39
679 size 39
679 x-is-binary 0
680 x-is-binary 0
680
681
681 $ hg -R convert_lfs2 config --debug extensions | grep lfs
682 $ hg -R convert_lfs2 config --debug extensions | grep lfs
682 $TESTTMP/convert_lfs2/.hg/hgrc:*: extensions.lfs= (glob)
683 $TESTTMP/convert_lfs2/.hg/hgrc:*: extensions.lfs= (glob)
General Comments 0
You need to be logged in to leave comments. Login now