|
a/Allura/allura/model/repo.py |
|
b/Allura/allura/model/repo.py |
|
... |
|
... |
276 |
self.name = name
|
276 |
self.name = name
|
277 |
else:
|
277 |
else:
|
278 |
self.commit = commit_or_tree
|
278 |
self.commit = commit_or_tree
|
279 |
|
279 |
|
280 |
def readme(self):
|
280 |
def readme(self):
|
281 |
name = None
|
281 |
'returns (filename, unicode text) if a readme file is found'
|
282 |
text = ''
|
|
|
283 |
for x in self.blob_ids:
|
282 |
for x in self.blob_ids:
|
284 |
if README_RE.match(x.name):
|
283 |
if README_RE.match(x.name):
|
285 |
name = x.name
|
284 |
name = x.name
|
286 |
obj = Object(
|
285 |
obj = Object(
|
287 |
object_id=x.id,
|
286 |
object_id=x.id,
|
288 |
path=lambda:self.path() + x['name'],
|
287 |
path=lambda:self.path() + x['name'],
|
289 |
commit=Object(
|
288 |
commit=Object(
|
290 |
object_id=self.commit._id))
|
289 |
object_id=self.commit._id))
|
291 |
text = self.repo.open_blob(obj).read()
|
290 |
text = self.repo.open_blob(obj).read()
|
292 |
text = h.really_unicode(text)
|
291 |
return (x.name, h.really_unicode(text))
|
293 |
break
|
|
|
294 |
if text == '':
|
|
|
295 |
text = '<p><em>Empty File</em></p>'
|
|
|
296 |
else:
|
|
|
297 |
renderer = g.pypeline_markup.renderer(name)
|
|
|
298 |
if renderer[1]:
|
|
|
299 |
text = g.pypeline_markup.render(name,text)
|
|
|
300 |
else:
|
|
|
301 |
text = '<pre>%s</pre>' % text
|
|
|
302 |
return (name, text)
|
|
|
303 |
|
292 |
|
304 |
def ls(self):
|
293 |
def ls(self):
|
305 |
# Load last commit info
|
294 |
# Load last commit info
|
306 |
oids = [ x.id for x in chain(self.tree_ids, self.blob_ids, self.other_ids) ]
|
295 |
oids = [ x.id for x in chain(self.tree_ids, self.blob_ids, self.other_ids) ]
|
307 |
lc_index = dict(
|
296 |
lc_index = dict(
|