--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -12,11 +12,10 @@
import tg
from paste.deploy.converters import asbool
-from pylons import c,g, request
+from pylons import c
import pymongo.errors
from ming import schema as S
-from ming.base import Object
from ming.utils import LazyProperty
from ming.orm import FieldProperty, session, Mapper
from ming.orm.declarative import MappedClass
@@ -26,9 +25,10 @@
from .artifact import Artifact, VersionedArtifact, Feed
from .auth import User
-from .session import repository_orm_session, project_orm_session, main_doc_session
+from .session import repository_orm_session, project_orm_session
from .notification import Notification
from .repo_refresh import refresh_repo
+from .timeline import ActivityObject
log = logging.getLogger(__name__)
config = utils.ConfigProxy(
@@ -140,7 +140,7 @@
os.chmod(magic_file, stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH)
self._setup_hooks()
-class Repository(Artifact):
+class Repository(Artifact, ActivityObject):
BATCH_SIZE=100
class __mongometa__:
name='generic-repository'
@@ -168,6 +168,10 @@
if 'url_path' not in kw:
kw['url_path'] = self.default_url_path(c.project, kw['tool'])
super(Repository, self).__init__(**kw)
+
+ @property
+ def activity_name(self):
+ return 'repo %s' % self.name
@classmethod
def default_fs_path(cls, project, tool):
@@ -352,7 +356,7 @@
def forks(self):
return self.query.find({'upstream_repo.name': self.url()}).all()
-class MergeRequest(VersionedArtifact):
+class MergeRequest(VersionedArtifact, ActivityObject):
statuses=['open', 'merged', 'rejected']
class __mongometa__:
name='merge-request'
@@ -371,6 +375,10 @@
created=FieldProperty(datetime, if_missing=datetime.utcnow)
summary=FieldProperty(str)
description=FieldProperty(str)
+
+ @property
+ def activity_name(self):
+ return 'merge request #%s' % self.request_number
@LazyProperty
def creator(self):