|
a/Allura/allura/model/repo.py |
|
b/Allura/allura/model/repo.py |
|
... |
|
... |
7 |
|
7 |
|
8 |
class Commit(Document):
|
8 |
class Commit(Document):
|
9 |
class __mongometa__:
|
9 |
class __mongometa__:
|
10 |
name = 'repo_ci'
|
10 |
name = 'repo_ci'
|
11 |
session = main_doc_session
|
11 |
session = main_doc_session
|
|
|
12 |
indexes = [
|
12 |
indexes = ('parent_ids')
|
13 |
('parent_ids',),
|
|
|
14 |
('child_ids',) ]
|
13 |
User = dict(name=str, email=str, date=datetime)
|
15 |
User = dict(name=str, email=str, date=datetime)
|
14 |
|
16 |
|
15 |
_id = Field(str)
|
17 |
_id = Field(str)
|
16 |
tree_id = Field(str)
|
18 |
tree_id = Field(str)
|
17 |
committed = Field(User)
|
19 |
committed = Field(User)
|
18 |
authored = Field(User)
|
20 |
authored = Field(User)
|
19 |
message = Field(str)
|
21 |
message = Field(str)
|
20 |
parent_ids = Field([str])
|
22 |
parent_ids = Field([str])
|
21 |
child_ids = Field([str])
|
23 |
child_ids = Field([str])
|
|
|
24 |
|
|
|
25 |
def __repr__(self):
|
|
|
26 |
return '%s %s' % (
|
|
|
27 |
self._id[:7], self.summary)
|
|
|
28 |
|
|
|
29 |
@property
|
|
|
30 |
def summary(self):
|
|
|
31 |
if self.message:
|
|
|
32 |
summary = []
|
|
|
33 |
for line in self.message.splitlines():
|
|
|
34 |
line = line.rstrip()
|
|
|
35 |
if line: summary.append(line)
|
|
|
36 |
else: return ' '.join(summary)
|
|
|
37 |
return ' '.join(summary)
|
|
|
38 |
return ''
|
22 |
|
39 |
|
23 |
class Tree(Document):
|
40 |
class Tree(Document):
|
24 |
class __mongometa__:
|
41 |
class __mongometa__:
|
25 |
name = 'repo_tree'
|
42 |
name = 'repo_tree'
|
26 |
session = main_doc_session
|
43 |
session = main_doc_session
|
|
... |
|
... |
44 |
name = 'repo_diffinfo'
|
61 |
name = 'repo_diffinfo'
|
45 |
session = main_doc_session
|
62 |
session = main_doc_session
|
46 |
|
63 |
|
47 |
_id = Field(str)
|
64 |
_id = Field(str)
|
48 |
differences = Field([dict(name=str, lhs_id=str, rhs_id=str)])
|
65 |
differences = Field([dict(name=str, lhs_id=str, rhs_id=str)])
|
|
|
66 |
|
|
|
67 |
class BasicBlock(Document):
|
|
|
68 |
class __mongometa__:
|
|
|
69 |
name = 'repo_basic_block'
|
|
|
70 |
session = main_doc_session
|
|
|
71 |
indexes = [
|
|
|
72 |
('commit_ids',),
|
|
|
73 |
('score') ]
|
|
|
74 |
|
|
|
75 |
_id = Field(str)
|
|
|
76 |
parent_commit_ids = Field([str])
|
|
|
77 |
commit_ids = Field([str])
|
|
|
78 |
commit_times = Field([datetime])
|
|
|
79 |
score = Field(int)
|
|
|
80 |
|
|
|
81 |
def __repr__(self):
|
|
|
82 |
return '%s: (P %s, T %s..%s (%d commits))' % (
|
|
|
83 |
self._id[:6],
|
|
|
84 |
[ oid[:6] for oid in self.parent_commit_ids ],
|
|
|
85 |
self.commit_ids[0][:6],
|
|
|
86 |
self.commit_ids[-1][:6],
|
|
|
87 |
len(self.commit_ids))
|