##// END OF EJS Templates
Update last_change from VCS data on request....
marcink -
r2937:d439d408 beta
parent child Browse files
Show More
@@ -70,6 +70,8 b' class HomeController(BaseController):'
70 template.get_def("repo_name")
70 template.get_def("repo_name")
71 .render(name, rtype, private, fork_of, short_name=False,
71 .render(name, rtype, private, fork_of, short_name=False,
72 admin=False, _=_, h=h, c=c))
72 admin=False, _=_, h=h, c=c))
73 last_change = lambda last_change: (template.get_def("last_change")
74 .render(last_change, _=_, h=h, c=c))
73 rss_lnk = lambda repo_name: (template.get_def("rss")
75 rss_lnk = lambda repo_name: (template.get_def("rss")
74 .render(repo_name, _=_, h=h, c=c))
76 .render(repo_name, _=_, h=h, c=c))
75 atom_lnk = lambda repo_name: (template.get_def("atom")
77 atom_lnk = lambda repo_name: (template.get_def("atom")
@@ -81,7 +83,7 b' class HomeController(BaseController):'
81 "raw_name": repo.repo_name.lower(),
83 "raw_name": repo.repo_name.lower(),
82 "name": repo_lnk(repo.repo_name, repo.repo_type,
84 "name": repo_lnk(repo.repo_name, repo.repo_type,
83 repo.private, repo.fork),
85 repo.private, repo.fork),
84 "last_change": h.age(repo.last_db_change),
86 "last_change": last_change(repo.last_db_change),
85 "desc": repo.description,
87 "desc": repo.description,
86 "owner": h.person(repo.user.username),
88 "owner": h.person(repo.user.username),
87 "rss": rss_lnk(repo.repo_name),
89 "rss": rss_lnk(repo.repo_name),
@@ -307,7 +307,8 b' class BaseRepoController(BaseController)'
307
307
308 dbr = c.rhodecode_db_repo = Repository.get_by_repo_name(c.repo_name)
308 dbr = c.rhodecode_db_repo = Repository.get_by_repo_name(c.repo_name)
309 c.rhodecode_repo = c.rhodecode_db_repo.scm_instance
309 c.rhodecode_repo = c.rhodecode_db_repo.scm_instance
310
310 # update last change according to VCS data
311 dbr.update_last_change(c.rhodecode_repo.last_change)
311 if c.rhodecode_repo is None:
312 if c.rhodecode_repo is None:
312 log.error('%s this repository is present in database but it '
313 log.error('%s this repository is present in database but it '
313 'cannot be created as an scm instance', c.repo_name)
314 'cannot be created as an scm instance', c.repo_name)
@@ -874,6 +874,15 b' class Repository(Base, BaseModel):'
874 cs = self.get_changeset(self.landing_rev) or self.get_changeset()
874 cs = self.get_changeset(self.landing_rev) or self.get_changeset()
875 return cs
875 return cs
876
876
877 def update_last_change(self, last_change=None):
878 if last_change is None:
879 last_change = datetime.datetime.now()
880 if self.updated_on is None or self.updated_on != last_change:
881 log.debug('updated repo %s with new date %s' % (self, last_change))
882 self.updated_on = last_change
883 Session().add(self)
884 Session().commit()
885
877 @property
886 @property
878 def tip(self):
887 def tip(self):
879 return self.get_changeset('tip')
888 return self.get_changeset('tip')
@@ -82,7 +82,9 b''
82 </div>
82 </div>
83 </%def>
83 </%def>
84
84
85
85 <%def name="last_change(last_change)">
86 <span class="tooltip" date="${last_change}" title="${h.tooltip(h.fmt_date(last_change))}">${h.age(last_change)}</span>
87 </%def>
86
88
87 <%def name="revision(name,rev,tip,author,last_msg)">
89 <%def name="revision(name,rev,tip,author,last_msg)">
88 <div>
90 <div>
@@ -98,7 +98,7 b''
98 </td>
98 </td>
99 ##LAST CHANGE DATE
99 ##LAST CHANGE DATE
100 <td>
100 <td>
101 <span class="tooltip" date="${repo['last_change']}" title="${h.tooltip(h.fmt_date(repo['last_change']))}">${h.age(repo['last_change'])}</span>
101 ${dt.last_change(repo['last_change'])}
102 </td>
102 </td>
103 ##LAST REVISION
103 ##LAST REVISION
104 <td>
104 <td>
@@ -232,7 +232,7 b''
232 {key:"raw_name"},
232 {key:"raw_name"},
233 {key:"name"},
233 {key:"name"},
234 {key:"desc"},
234 {key:"desc"},
235 //{key:"last_change"},
235 {key:"last_change"},
236 {key:"owner"},
236 {key:"owner"},
237 {key:"rss"},
237 {key:"rss"},
238 {key:"atom"},
238 {key:"atom"},
@@ -264,8 +264,8 b''
264 {key:"name",label:"${_('Name')}",sortable:true,
264 {key:"name",label:"${_('Name')}",sortable:true,
265 sortOptions: { sortFunction: nameSort }},
265 sortOptions: { sortFunction: nameSort }},
266 {key:"desc",label:"${_('Description')}",sortable:true},
266 {key:"desc",label:"${_('Description')}",sortable:true},
267 //{key:"last_change",label:"${_('Last Change')}",sortable:true,
267 {key:"last_change",label:"${_('Last Change')}",sortable:true,
268 // sortOptions: { sortFunction: ageSort }},
268 sortOptions: { sortFunction: ageSort }},
269 {key:"owner",label:"${_('Owner')}",sortable:true},
269 {key:"owner",label:"${_('Owner')}",sortable:true},
270 {key:"rss",label:"",sortable:false},
270 {key:"rss",label:"",sortable:false},
271 {key:"atom",label:"",sortable:false},
271 {key:"atom",label:"",sortable:false},
General Comments 0
You need to be logged in to leave comments. Login now