Kiln » Unity3D Unity 3D's proposed fixes and extensions to Kiln BFiles
Clone URL:  
design.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
= bfiles - manage large binary files = This extension is based off of Greg Ward's bfiles extension which can be found at http://mercurial.selenic.com/wiki/BfilesExtension. == The Bfile Store == Bfile stores are simply directories where each file is a bfile. The filename is the sha1 hash of the bfile. The path is not necessary because all interactions with the store have one of these forms: -Download a bfile with this hash -Upload a bfile with this hash -Check if the store has a bfile with this hash == The Local Repository == The local repository has a bfile store in .hg/bfiles which holds a subset of the bfiles needed. On a clone only the bfiles at tip are downloaded. When bfiles are downloaded from the central store a copy is saved in this store. == The Global Cache == Bfiles in a local repository store are hard linked to files in the global cache. Before a file is downloaded we check if it is in the global cache. == Implementation Details == Each bfile has a standin which is in .hgbfiles. The standin is tracked by Mercurial. The contents of the standin is the SHA1 hash of the bfile. When a bfile is added/removed/ copied/renamed/etc the same operation is applied to the standin. Thus the history of the standin is the history of the bfile. For performance reasons the contents of a standin is only updated before a commit. Standins are added/removed/copied/renamed from add/remove/copy/rename Mercurial commands but their contents will not be updated. The contents of a standin will always be the hash of the bfile as of the last commit. To support some commands (revert) some standins are temporarily updated but will be changed back after the command is finished. A Mercurial dirstate object tracks the state of the bfiles. The dirstate uses the last modified time and current size to detect if a file has changed (without reading the entire contents of the file).