Kiln » largefiles » Unity
Clone URL:  

largefiles: copyright headers and CONTRIBUTORS file

Changeset c1c3ea8211ef

Parent 7a6d938fba2d

by Profile picture of User 521Andrew Pritchard <andrewp@fogcreek.com>

Changes to 13 files · Browse files at c1c3ea8211ef Showing diff from parent 7a6d938fba2d Diff from another changeset...

Change 1 of 1 Show Entire File CONTRIBUTORS Stacked
 
 
 
 
1
2
@@ -0,0 +1,2 @@
+Greg Ward, author of the original bigfiles extension +Na'Tosha Bard of Unity 3D
Change 1 of 1 Show Entire File __init__.py Stacked
 
 
 
 
 
 
1
2
3
 
1
2
3
4
5
6
7
8
@@ -1,3 +1,8 @@
+# Copyright 2010-2011 Fog Creek Software +# +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2 or any later version. +  '''track large binary files    Large binary files tend to be not very compressible, not very "diffable",
Change 1 of 1 Show Changes Only basestore.py Stacked
 
 
 
 
 
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
+# Copyright 2010-2011 Fog Creek Software +# +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2 or any later version. +  '''Base class for store implementations and store-related utility code.'''    import os  import tempfile  import binascii  import re    from mercurial import util, node, error, url as url_, hg  from mercurial.i18n import _    import lfutil  import remotestore    class StoreError(Exception):   '''Raised when there is a problem getting files from or putting   files to a central store.'''   def __init__(self, filename, hash, url, detail):   self.filename = filename   self.hash = hash   self.url = url   self.detail = detail     def longmessage(self):   if self.url:   return ('%s: %s\n'   '(failed URL: %s)\n'   % (self.filename, self.detail, self.url))   else:   return ('%s: %s\n'   '(no default or default-push path set in hgrc)\n'   % (self.filename, self.detail))     def __str__(self):   return "%s: %s" % (self.url, self.detail)    class basestore(object):   def __init__(self, ui, repo, url):   self.ui = ui   self.repo = repo   self.url = url     def put(self, source, hash):   '''Put source file into the store under <filename>/<hash>.'''   raise NotImplementedError('abstract method')     def exists(self, hash):   '''Check to see if the store contains the given hash.'''   raise NotImplementedError('abstract method')     def get(self, files):   '''Get the specified big files from the store and write to local   files under repo.root. files is a list of (filename, hash)   tuples. Return (success, missing), lists of files successfuly   downloaded and those not found in the store. success is a list   of (filename, hash) tuples; missing is a list of filenames that   we could not get. (The detailed error message will already have   been presented to the user, so missing is just supplied as a   summary.)'''   success = []   missing = []   ui = self.ui     at = 0   for filename, hash in files:   ui.progress(_('getting largefiles'), at, unit='lfile',   total=len(files))   at += 1   ui.note(_('getting %s\n') % filename)   outfilename = self.repo.wjoin(filename)   destdir = os.path.dirname(outfilename)   util.makedirs(destdir)   if not os.path.isdir(destdir):   self.abort(error.RepoError(_('cannot create dest directory %s')   % destdir))     # No need to pass mode='wb' to fdopen(), since mkstemp() already   # opened the file in binary mode.   (tmpfd, tmpfilename) = tempfile.mkstemp(   dir=destdir, prefix=os.path.basename(filename))   tmpfile = os.fdopen(tmpfd, 'w')     try:   bhash = self._getfile(tmpfile, filename, hash)   except StoreError, err:   tmpfile.close()   ui.warn(err.longmessage())   os.remove(tmpfilename)   missing.append(filename)   continue     hhash = binascii.hexlify(bhash)   if hhash != hash:   ui.warn(_('%s: data corruption (expected %s, got %s)\n')   % (filename, hash, hhash))   os.remove(tmpfilename)   missing.append(filename)   else:   if os.path.exists(outfilename): # for windows   os.remove(outfilename)   os.rename(tmpfilename, outfilename)   lfutil.copytocache(self.repo, self.repo['.'].node(), filename,   True)   success.append((filename, hhash))     ui.progress(_('getting largefiles'), None)   return (success, missing)     def verify(self, revs, contents=False):   '''Verify the existence (and, optionally, contents) of every big   file revision referenced by every changeset in revs.   Return 0 if all is well, non-zero on any errors.'''   write = self.ui.write   failed = False     write(_('searching %d changesets for big files\n') % len(revs))   verified = set() # set of (filename, filenode) tuples     for rev in revs:   cctx = self.repo[rev]   cset = "%d:%s" % (cctx.rev(), node.short(cctx.node()))     for standin in cctx:   failed = (self._verifyfile(cctx,   cset,   contents,   standin,   verified)   or failed)     num_revs = len(verified)   num_lfiles = len(set([fname for (fname, fnode) in verified]))   if contents:   write(_('verified contents of %d revisions of %d big files\n')   % (num_revs, num_lfiles))   else:   write(_('verified existence of %d revisions of %d big files\n')   % (num_revs, num_lfiles))     return int(failed)     def _getfile(self, tmpfile, filename, hash):   '''Fetch one revision of one file from the store and write it   to tmpfile. Compute the hash of the file on-the-fly as it   downloads and return the binary hash. Close tmpfile. Raise   StoreError if unable to download the file (e.g. it does not   exist in the store).'''   raise NotImplementedError('abstract method')     def _verifyfile(self, cctx, cset, contents, standin, verified):   '''Perform the actual verification of a file in the store.   '''   raise NotImplementedError('abstract method')    import localstore, wirestore    _storeprovider = {   'file': [localstore.localstore],   'http': [wirestore.wirestore],   'https': [wirestore.wirestore],   'ssh': [wirestore.wirestore],   }    _scheme_re = re.compile(r'^([a-zA-Z0-9+-.]+)://')    # During clone this function is passed the src's ui object  # but it needs the dest's ui object so it can read out of  # the config file. Use repo.ui instead.  def _openstore(repo, remote=None, put=False):   ui = repo.ui     if not remote:   path = getattr(repo, 'lfpullsource', None) or \   ui.expandpath('default-push', 'default')   # If 'default-push' and 'default' can't be expanded   # they are just returned. In that case use the empty string which   # use the filescheme.   if path == 'default-push' or path == 'default':   path = ''   remote = repo   else:   remote = hg.peer(repo, {}, path)     # The path could be a scheme so use Mercurial's normal functionality   # to resolve the scheme to a repository and use its path   path = hasattr(remote, 'url') and remote.url() or remote.path     match = _scheme_re.match(path)   if not match: # regular filesystem path   scheme = 'file'   else:   scheme = match.group(1)     try:   storeproviders = _storeprovider[scheme]   except KeyError:   raise util.Abort(_('unsupported URL scheme %r') % scheme)     for class_obj in storeproviders:   try:   return class_obj(ui, repo, remote)   except remotestore.storeprotonotcapable:   pass     raise util.Abort(_('%s does not appear to be a lfile store'), path)
Show Entire File extsetup.py Stacked
(No changes)
Change 1 of 1 Show Entire File lfcommands.py Stacked
 
 
 
 
 
 
1
2
3
 
1
2
3
4
5
6
7
8
@@ -1,3 +1,8 @@
+# Copyright 2010-2011 Fog Creek Software +# +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2 or any later version. +  '''High-level command functions: lfadd() et. al, plus the cmdtable.'''    import os
Change 1 of 1 Show Entire File lfutil.py Stacked
 
 
 
 
 
 
1
2
3
 
1
2
3
4
5
6
7
8
@@ -1,3 +1,8 @@
+# Copyright 2010-2011 Fog Creek Software +# +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2 or any later version. +  '''largefiles utility code: must not import other modules in this package.'''    import os
Change 1 of 1 Show Entire File localstore.py Stacked
 
 
 
 
 
 
1
2
3
 
1
2
3
4
5
6
7
8
@@ -1,3 +1,8 @@
+# Copyright 2010-2011 Fog Creek Software +# +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2 or any later version. +  '''Store class for local filesystem.'''    import os
Change 1 of 1 Show Entire File overrides.py Stacked
 
 
 
 
 
 
1
2
3
 
1
2
3
4
5
6
7
8
@@ -1,3 +1,8 @@
+# Copyright 2010-2011 Fog Creek Software +# +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2 or any later version. +  '''Overridden Mercurial commands and functions for the largefiles extension'''    import os
Change 1 of 1 Show Entire File proto.py Stacked
 
 
 
 
 
 
1
2
3
 
1
2
3
4
5
6
7
8
@@ -1,3 +1,8 @@
+# Copyright 2010-2011 Fog Creek Software +# +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2 or any later version. +  import os  import shutil  import tempfile
Change 1 of 1 Show Entire File remotestore.py Stacked
 
 
 
 
 
 
1
2
3
 
1
2
3
4
5
6
7
8
@@ -1,3 +1,8 @@
+# Copyright 2010-2011 Fog Creek Software +# +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2 or any later version. +  '''Remote lfile store; the base class for servestore'''    from mercurial import util
Change 1 of 1 Show Entire File reposetup.py Stacked
 
 
 
 
 
 
1
2
3
 
1
2
3
4
5
6
7
8
@@ -1,3 +1,8 @@
+# Copyright 2010-2011 Fog Creek Software +# +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2 or any later version. +  '''setup for largefiles repositories: reposetup'''  import copy  import types
Change 1 of 1 Show Entire File uisetup.py Stacked
 
 
 
 
 
 
1
2
3
 
1
2
3
4
5
6
7
8
@@ -1,3 +1,8 @@
+# Copyright 2010-2011 Fog Creek Software +# +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2 or any later version. +  '''setup for largefiles extension: uisetup'''    from mercurial import archival, cmdutil, commands, extensions, filemerge, hg, \
Change 1 of 1 Show Entire File wirestore.py Stacked
 
 
 
 
 
 
1
2
3
 
1
2
3
4
5
6
7
8
@@ -1,3 +1,8 @@
+# Copyright 2010-2011 Fog Creek Software +# +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2 or any later version. +  '''largefile store working over mercurial's wire protocol'''    import remotestore