comparison dulwich/repo.py @ 127:695a90e72e4f

merge from ian dees
author Scott Chacon <schacon@gmail.com>
date Tue, 19 May 2009 09:33:46 -0700
parents 0c94e860a0ed b51381c6fab8
children 33da6875a534
comparison
equal deleted inserted replaced
122:76a0e1ee7cf7 127:695a90e72e4f
171 return os.path.join(self.object_dir(), PACKDIR) 171 return os.path.join(self.object_dir(), PACKDIR)
172 172
173 def _get_ref(self, file): 173 def _get_ref(self, file):
174 f = open(file, 'rb') 174 f = open(file, 'rb')
175 try: 175 try:
176 contents = f.read() 176 contents = f.read().strip()
177 if contents.startswith(SYMREF): 177 if contents.startswith(SYMREF):
178 ref = contents[len(SYMREF):] 178 ref = contents[len(SYMREF):]
179 if ref[-1] == '\n':
180 ref = ref[:-1]
181 return self.ref(ref) 179 return self.ref(ref)
182 assert len(contents) == 41, 'Invalid ref in %s' % file 180 assert len(contents) == 40, 'Invalid ref in %s' % file
183 return contents[:-1] 181 return contents
184 finally: 182 finally:
185 f.close() 183 f.close()
186 184
187 def ref(self, name): 185 def ref(self, name):
188 """Return the SHA1 a ref is pointing to.""" 186 """Return the SHA1 a ref is pointing to."""