|
a/Allura/allura/model/repository.py |
|
b/Allura/allura/model/repository.py |
|
... |
|
... |
109 |
raise NotImplementedError, 'commits'
|
109 |
raise NotImplementedError, 'commits'
|
110 |
|
110 |
|
111 |
def commits_count(self, path=None, rev=None):
|
111 |
def commits_count(self, path=None, rev=None):
|
112 |
'''Return count of the commits related to path'''
|
112 |
'''Return count of the commits related to path'''
|
113 |
raise NotImplementedError, 'commits_count'
|
113 |
raise NotImplementedError, 'commits_count'
|
|
|
114 |
|
|
|
115 |
def last_commit_ids(self, commit, paths):
|
|
|
116 |
'''
|
|
|
117 |
Return a mapping {path: commit_id} of the _id of the last
|
|
|
118 |
commit to touch each path, starting from the given commit.
|
|
|
119 |
'''
|
|
|
120 |
paths = set(paths)
|
|
|
121 |
result = {}
|
|
|
122 |
while commit:
|
|
|
123 |
changed = paths & set(commit.changed_paths)
|
|
|
124 |
result.update({path: commit._id for path in changed})
|
|
|
125 |
paths = paths - changed
|
|
|
126 |
commit = commit.get_parent()
|
|
|
127 |
return result
|
114 |
|
128 |
|
115 |
@classmethod
|
129 |
@classmethod
|
116 |
def shorthand_for_commit(cls, oid):
|
130 |
def shorthand_for_commit(cls, oid):
|
117 |
return '[%s]' % oid[:6]
|
131 |
return '[%s]' % oid[:6]
|
118 |
|
132 |
|
|
... |
|
... |
225 |
return self._impl.compute_tree_new(commit, path)
|
239 |
return self._impl.compute_tree_new(commit, path)
|
226 |
def commits(self, path=None, rev=None, skip=None, limit=None):
|
240 |
def commits(self, path=None, rev=None, skip=None, limit=None):
|
227 |
return self._impl.commits(path, rev, skip, limit)
|
241 |
return self._impl.commits(path, rev, skip, limit)
|
228 |
def commits_count(self, path=None, rev=None):
|
242 |
def commits_count(self, path=None, rev=None):
|
229 |
return self._impl.commits_count(path, rev)
|
243 |
return self._impl.commits_count(path, rev)
|
|
|
244 |
def last_commit_ids(self, commit, paths):
|
|
|
245 |
return self._impl.last_commit_ids(commit, paths)
|
230 |
|
246 |
|
231 |
def _log(self, rev, skip, limit):
|
247 |
def _log(self, rev, skip, limit):
|
232 |
head = self.commit(rev)
|
248 |
head = self.commit(rev)
|
233 |
if head is None: return
|
249 |
if head is None: return
|
234 |
for _id in self.commitlog([head._id], skip, limit):
|
250 |
for _id in self.commitlog([head._id], skip, limit):
|
|
... |
|
... |
443 |
'downstream.mount_point':self.app.config.options.mount_point,
|
459 |
'downstream.mount_point':self.app.config.options.mount_point,
|
444 |
'status':'open'}
|
460 |
'status':'open'}
|
445 |
with self.push_upstream_context():
|
461 |
with self.push_upstream_context():
|
446 |
return MergeRequest.query.find(q).count()
|
462 |
return MergeRequest.query.find(q).count()
|
447 |
|
463 |
|
448 |
def get_last_commit(self, obj):
|
|
|
449 |
from .repo import LastCommitDoc
|
|
|
450 |
lc = LastCommitDoc.m.get(
|
|
|
451 |
repo_id=self._id, object_id=obj._id)
|
|
|
452 |
if lc is None:
|
|
|
453 |
return dict(
|
|
|
454 |
author=None,
|
|
|
455 |
author_email=None,
|
|
|
456 |
author_url=None,
|
|
|
457 |
date=None,
|
|
|
458 |
id=None,
|
|
|
459 |
shortlink=None,
|
|
|
460 |
summary=None)
|
|
|
461 |
return lc.commit_info
|
|
|
462 |
|
|
|
463 |
@property
|
464 |
@property
|
464 |
def forks(self):
|
465 |
def forks(self):
|
465 |
return self.query.find({'upstream_repo.name': self.url()}).all()
|
466 |
return self.query.find({'upstream_repo.name': self.url()}).all()
|
466 |
|
467 |
|
467 |
class MergeRequest(VersionedArtifact, ActivityObject):
|
468 |
class MergeRequest(VersionedArtifact, ActivityObject):
|