aboutsummaryrefslogtreecommitdiff
path: root/rhodecode/model/db.py
diff options
context:
space:
mode:
authorMarcin Kuzminski <marcin@python-works.com>2012-10-18 20:54:25 +0200
committerMarcin Kuzminski <marcin@python-works.com>2012-10-18 20:54:25 +0200
commit11eedc2265fc0696235f4d078e22ab2934923e3c (patch)
tree0c5e92a6e2b22d919dd4a6bef0602e0d16a27571 /rhodecode/model/db.py
parent5b964ffc7fb338544acf0053d90d91836e50e26d (diff)
Update last_change from VCS data on request.
- lightweight dashboard shows now last_date also taken from db and it is fast ! --HG-- branch : beta
Diffstat (limited to 'rhodecode/model/db.py')
-rwxr-xr-xrhodecode/model/db.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/rhodecode/model/db.py b/rhodecode/model/db.py
index 458e24d7..0ba19444 100755
--- a/rhodecode/model/db.py
+++ b/rhodecode/model/db.py
@@ -874,6 +874,15 @@ class Repository(Base, BaseModel):
cs = self.get_changeset(self.landing_rev) or self.get_changeset()
return cs
+ def update_last_change(self, last_change=None):
+ if last_change is None:
+ last_change = datetime.datetime.now()
+ if self.updated_on is None or self.updated_on != last_change:
+ log.debug('updated repo %s with new date %s' % (self, last_change))
+ self.updated_on = last_change
+ Session().add(self)
+ Session().commit()
+
@property
def tip(self):
return self.get_changeset('tip')