allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hei...@apache.org
Subject [2/2] allura git commit: [#7894] Fix issue where can_merge updated mod_date
Date Mon, 29 Jun 2015 20:08:41 GMT
[#7894] Fix issue where can_merge updated mod_date


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/0dcbe450
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/0dcbe450
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/0dcbe450

Branch: refs/heads/hs/7894
Commit: 0dcbe45061ea83f125802c826cd6f61a77c1852e
Parents: fd3fbf9
Author: Heith Seewald <hseewald@slashdotmedia.com>
Authored: Mon Jun 29 16:07:56 2015 -0400
Committer: Heith Seewald <hseewald@slashdotmedia.com>
Committed: Mon Jun 29 16:07:56 2015 -0400

----------------------------------------------------------------------
 Allura/allura/model/repository.py | 6 ++----
 Allura/allura/tasks/repo_tasks.py | 8 +++++---
 2 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/0dcbe450/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index bdd2399..63916d7 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -830,9 +830,6 @@ class MergeRequest(VersionedArtifact, ActivityObject):
             return False
         if self.app.config.options.get('merge_disabled'):
             return False
-
-        _session = artifact_orm_session._get()
-        _session.skip_mod_date = True
         return True
 
     def can_merge_cache_key(self):
@@ -852,7 +849,8 @@ class MergeRequest(VersionedArtifact, ActivityObject):
 
     def set_can_merge_cache(self, val):
         key = self.can_merge_cache_key()
-        self.can_merge_cache[key] = val
+        with utils.skip_mod_date(self):
+            self.can_merge_cache[key] = val
 
     def can_merge(self):
         """

http://git-wip-us.apache.org/repos/asf/allura/blob/0dcbe450/Allura/allura/tasks/repo_tasks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tasks/repo_tasks.py b/Allura/allura/tasks/repo_tasks.py
index e44ea94..099f812 100644
--- a/Allura/allura/tasks/repo_tasks.py
+++ b/Allura/allura/tasks/repo_tasks.py
@@ -24,6 +24,7 @@ from ming.odm import session
 
 from allura.lib.decorators import task
 from allura.lib.repository import RepositoryApp
+from allura.lib.utils import skip_mod_date
 
 
 @task
@@ -167,6 +168,7 @@ def merge(merge_request_id):
 @task
 def can_merge(merge_request_id):
     from allura import model as M
-    mr = M.MergeRequest.query.get(_id=merge_request_id)
-    result = mr.app.repo.can_merge(mr)
-    mr.set_can_merge_cache(result)
+    with skip_mod_date(M.MergeRequest):
+        mr = M.MergeRequest.query.get(_id=merge_request_id)
+        result = mr.app.repo.can_merge(mr)
+        mr.set_can_merge_cache(result)


Mime
View raw message