You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2014/02/21 18:37:11 UTC

[4/4] git commit: [#6164] ticket:537 fixed a branch error in merge request

[#6164] ticket:537 fixed a branch error in  merge request


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

Branch: refs/heads/master
Commit: 4601179b57daaee70728e94dcc5f0a88cba0712d
Parents: ee36ba2
Author: Yuriy Arhipov <yu...@yandex.ru>
Authored: Thu Feb 20 15:51:31 2014 +0400
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Feb 21 17:35:57 2014 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/repository.py                | 11 +++++++----
 Allura/allura/nf/allura/css/site_style.css             |  5 -----
 Allura/allura/templates/repo/merge_request.html        |  3 +++
 Allura/allura/templates/repo/merge_request_edit.html   |  2 +-
 ForgeGit/forgegit/tests/functional/test_controllers.py |  9 ++++++---
 5 files changed, 17 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4601179b/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index 547af55..7fb1a7e 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -369,12 +369,13 @@ class MergeRequestController(object):
 
     @property
     def mr_widget_edit(self):
-        source_branches = [
-            b.name
-            for b in c.app.repo.get_branches() + c.app.repo.get_tags()]
         target_branches = [
             b.name
             for b in c.app.repo.get_branches() + c.app.repo.get_tags()]
+        with self.req.push_downstream_context():
+            source_branches = [
+                b.name
+                for b in c.app.repo.get_branches() + c.app.repo.get_tags()]
         return SCMMergeRequestWidget(
             source_branches=source_branches,
             target_branches=target_branches)
@@ -389,7 +390,7 @@ class MergeRequestController(object):
         else:
             source_branch = c.app.default_branch_name
         if self.req['target_branch'] in c.form.target_branches:
-            target_branch = self.req['source_branch']
+            target_branch = self.req['target_branch']
         else:
             target_branch = c.app.default_branch_name
         return {
@@ -410,6 +411,8 @@ class MergeRequestController(object):
         mr.target_branch = kw['target_branch']
         mr.source_branch = kw['source_branch']
         mr.description = kw['description']
+        with self.req.push_downstream_context():
+            mr.downstream['commit_id'] = c.app.repo.commit(kw['source_branch'])._id
         M.Notification.post(
             mr, 'merge_request',
             subject='Merge request: ' + mr.summary)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4601179b/Allura/allura/nf/allura/css/site_style.css
----------------------------------------------------------------------
diff --git a/Allura/allura/nf/allura/css/site_style.css b/Allura/allura/nf/allura/css/site_style.css
index 77009c4..94f5d09 100644
--- a/Allura/allura/nf/allura/css/site_style.css
+++ b/Allura/allura/nf/allura/css/site_style.css
@@ -3294,8 +3294,3 @@ ul.dropdown ul li a:hover {
     text-align: right;
     padding: 5px 10px 5px 0;
 }
-.markdown_preview.btn.edit {
-    margin-left: 240px;
-    margin-top: -35px;
-    padding: 4px 13px 3px;
-}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4601179b/Allura/allura/templates/repo/merge_request.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/merge_request.html b/Allura/allura/templates/repo/merge_request.html
index 7eabc41..00aa0b0 100644
--- a/Allura/allura/templates/repo/merge_request.html
+++ b/Allura/allura/templates/repo/merge_request.html
@@ -29,6 +29,9 @@
 {% block header %}{{c.app.config.options.mount_label}}
 Merge Request #{{req.request_number}}: {{req.summary}} ({{req.status}})
 {% endblock %}
+{% block actions %}
+      <a href="edit" title="Edit"><b data-icon="{{g.icons['pencil'].char}}" class="ico {{g.icons['pencil'].css}}" title="Edit"></b></a>
+{% endblock %}
 
 {% block content %}
   {% if req.downstream_repo %}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4601179b/Allura/allura/templates/repo/merge_request_edit.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/merge_request_edit.html b/Allura/allura/templates/repo/merge_request_edit.html
index 88bdfc0..86d0420 100644
--- a/Allura/allura/templates/repo/merge_request_edit.html
+++ b/Allura/allura/templates/repo/merge_request_edit.html
@@ -26,7 +26,7 @@
   {% endif %}
 {% endblock %}
 
-{% block header %}Request merge of {{c.app.config.options.mount_label}} {% endblock %}
+{% block header %}Update merge request{% endblock %}
 
 {% block content %}
   {{ c.form.display(action='do_request_merge_edit', value=dict(source_branch=source_branch, target_branch=target_branch, description=description, summary=summary))}}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4601179b/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 798c77a..999af5b 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -606,7 +606,7 @@ class TestFork(_TestCase):
                 'target_branch': 'master',
                 'summary': 'summary',
                 'description': 'description'}).follow()
-        assert 'href="edit">Edit</a>' in r
+        assert '<a href="edit" title="Edit"><b data-icon="p" class="ico ico-pencil" title="Edit"></b></a>' in r
         r = self.app.get('/p/test/src-git/merge-requests/1/edit')
         assert 'value="summary"' in r
         assert 'name="description">description</textarea>' in r
@@ -623,13 +623,16 @@ class TestFork(_TestCase):
 
         r = self.app.post('/p/test/src-git/merge-requests/1/do_request_merge_edit',
             params={
-                'source_branch': 'zz',
+                'source_branch': 'master',
                 'target_branch': 'master',
                 'summary': 'changed summary',
                 'description': 'changed description'}).follow()
+
+        assert '[5c4724]' not in r
         assert '<p>changed description</p' in r
+        assert 'Merge Request #1: changed summary (open)' in r
 
-        r = self.app.post('/p/test/src-git/merge-requests')
+        r = self.app.get('/p/test/src-git/merge-requests')
         assert '<a href="1/">changed summary</a>' in r