allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [03/50] git commit: [#6301] ticket:536 track changes to merge requests
Date Tue, 25 Mar 2014 14:27:01 GMT
[#6301] ticket:536 track changes to merge requests


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

Branch: refs/heads/db/5995
Commit: 01cb3c6b2553cb90cbb5eaf257974b1c793ca745
Parents: 12dfe34
Author: Yuriy Arhipov <yuriyarhipovua@yandex.ru>
Authored: Mon Mar 3 13:19:11 2014 +0400
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Wed Mar 5 15:51:20 2014 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/repository.py         | 22 ++++++++++++++++----
 .../tests/functional/test_controllers.py        |  5 +++++
 2 files changed, 23 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/01cb3c6b/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index eecd563..7b0afb4 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -404,12 +404,26 @@ class MergeRequestController(object):
     def do_request_merge_edit(self, **kw):
         require_access(self.req, 'write')
         kw = self.mr_widget_edit.to_python(kw)
-        self.req.summary = kw['summary']
-        self.req.target_branch = kw['target_branch']
-        self.req.source_branch = kw['source_branch']
-        self.req.description = kw['description']
+        changes = ['Merge request %s has been modified:' % self.req.request_number,
+                'Edited By: %s (%s)' % (c.user.get_pref('display_name'), c.user.username)]
+        if self.req.summary != kw['summary']:
+            changes.append('Summary updated: %r => %r' % (self.req.summary, kw['summary']))
+            self.req.summary = kw['summary']
+
+        if self.req.target_branch != kw['target_branch']:
+            changes.append('Target branch updated: %r => %r' % (self.req.target_branch,
kw['target_branch']))
+            self.req.target_branch = kw['target_branch']
+
+        if self.req.source_branch != kw['source_branch']:
+            changes.append('Source branch updated: %r => %r' % (self.req.source_branch,
kw['source_branch']))
+            self.req.source_branch = kw['source_branch']
+
+        if self.req.description != kw['description']:
+            changes.append('Description updated: %r => %r' % (self.req.description, kw['description']))
+            self.req.description = kw['description']
         with self.req.push_downstream_context():
             self.req.downstream['commit_id'] = c.app.repo.commit(kw['source_branch'])._id
+        self.req.discussion_thread.add_post(text='\n'.join(changes))
         M.Notification.post(
             self.req, 'merge_request',
             subject='Merge request: ' + self.req.summary)

http://git-wip-us.apache.org/repos/asf/allura/blob/01cb3c6b/ForgeGit/forgegit/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index 999af5b..ae7c31e 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -631,6 +631,11 @@ class TestFork(_TestCase):
         assert '[5c4724]' not in r
         assert '<p>changed description</p' in r
         assert 'Merge Request #1: changed summary (open)' in r
+        assert '''<p>Merge request 1 has been modified:<br />
+Edited By: Test Admin (test-admin)<br />
+Summary updated: u'summary' =&gt; u'changed summary'<br />
+Source branch updated: u'zz' =&gt; u'master'<br />
+Description updated: u'description' =&gt; u'changed description'</p>''' in r
 
         r = self.app.get('/p/test/src-git/merge-requests')
         assert '<a href="1/">changed summary</a>' in r


Mime
View raw message