##// END OF EJS Templates
sparse: clean up config signature code...
Gregory Szorc -
r33318:526255fe default
parent child Browse files
Show More
@@ -132,10 +132,6 b' def activeprofiles(repo):'
132 def invalidatesignaturecache(repo):
132 def invalidatesignaturecache(repo):
133 repo._sparsesignaturecache.clear()
133 repo._sparsesignaturecache.clear()
134
134
135 def _checksum(repo, path):
136 data = repo.vfs.read(path)
137 return hashlib.sha1(data).hexdigest()
138
139 def configsignature(repo, includetemp=True):
135 def configsignature(repo, includetemp=True):
140 """Obtain the signature string for the current sparse configuration.
136 """Obtain the signature string for the current sparse configuration.
141
137
@@ -148,25 +144,18 b' def configsignature(repo, includetemp=Tr'
148 if includetemp:
144 if includetemp:
149 tempsignature = cache.get('tempsignature')
145 tempsignature = cache.get('tempsignature')
150 else:
146 else:
151 tempsignature = 0
147 tempsignature = '0'
152
148
153 if signature is None or (includetemp and tempsignature is None):
149 if signature is None or (includetemp and tempsignature is None):
154 signature = 0
150 signature = hashlib.sha1(repo.vfs.tryread('sparse')).hexdigest()
155 try:
156 signature = _checksum(repo, 'sparse')
157 except (OSError, IOError):
158 pass
159 cache['signature'] = signature
151 cache['signature'] = signature
160
152
161 tempsignature = 0
162 if includetemp:
153 if includetemp:
163 try:
154 raw = repo.vfs.tryread('tempsparse')
164 tempsignature = _checksum(repo, 'tempsparse')
155 tempsignature = hashlib.sha1(raw).hexdigest()
165 except (OSError, IOError):
166 pass
167 cache['tempsignature'] = tempsignature
156 cache['tempsignature'] = tempsignature
168
157
169 return '%s %s' % (str(signature), str(tempsignature))
158 return '%s %s' % (signature, tempsignature)
170
159
171 def writeconfig(repo, includes, excludes, profiles):
160 def writeconfig(repo, includes, excludes, profiles):
172 """Write the sparse config file given a sparse configuration."""
161 """Write the sparse config file given a sparse configuration."""
General Comments 0
You need to be logged in to leave comments. Login now