You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/08/14 20:56:39 UTC
[09/25] git commit: [#5177] Fixed default values for source and
target_branch when creating a merge request
[#5177] Fixed default values for source and target_branch when creating a merge request
Signed-off-by: Cory Johns <cj...@slashdotmedia.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/45732c0c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/45732c0c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/45732c0c
Branch: refs/heads/cj/6464
Commit: 45732c0cd2952b6e2d156f4f2ec1a21f20f9b317
Parents: 9a13632
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Thu Aug 8 14:03:29 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue Aug 13 21:28:33 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/repository.py | 14 +++++++++++---
Allura/allura/lib/repository.py | 5 ++++-
Allura/allura/templates/repo/request_merge.html | 2 +-
3 files changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/45732c0c/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index aaf9f6a..36b4bdc 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -162,9 +162,16 @@ class RepoRootController(BaseController, FeedController):
def request_merge(self, branch=None, **kw):
security.require(security.has_access(c.app.repo, 'admin'))
c.form = self.mr_widget
- if branch is None:
- source_branch=c.app.default_branch_name
- return dict(source_branch=source_branch)
+ if branch in c.form.source_branches:
+ source_branch = branch
+ else:
+ source_branch = c.app.default_branch_name
+ with c.app.repo.push_upstream_context():
+ target_branch = c.app.default_branch_name
+ return {
+ 'source_branch': source_branch,
+ 'target_branch': target_branch,
+ }
@expose()
@require_post()
@@ -417,6 +424,7 @@ class CommitBrowser(BaseController):
def __init__(self, revision):
self._revision = revision
self._commit = c.app.repo.commit(revision)
+ c.revision = revision
if self._commit is None:
raise exc.HTTPNotFound
self.tree = self.TreeBrowserClass(self._commit, tree=self._commit.tree)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/45732c0c/Allura/allura/lib/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/repository.py b/Allura/allura/lib/repository.py
index 83df6b2..65b68c8 100644
--- a/Allura/allura/lib/repository.py
+++ b/Allura/allura/lib/repository.py
@@ -127,7 +127,10 @@ class RepositoryApp(Application):
self.repo.upstream_repo.name)
]
if not c.app.repo.is_empty() and has_access(c.app.repo, 'admin'):
- links.append(SitemapEntry('Request Merge', c.app.url + 'request_merge',
+ merge_url = c.app.url + 'request_merge'
+ if getattr(c, 'revision', None):
+ merge_url = merge_url + '?branch=' + h.urlquote(c.revision)
+ links.append(SitemapEntry('Request Merge', merge_url,
ui_icon=g.icons['merge'],
))
pending_upstream_merges = self.repo.pending_upstream_merges()
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/45732c0c/Allura/allura/templates/repo/request_merge.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/request_merge.html b/Allura/allura/templates/repo/request_merge.html
index 02b9061..a55a67c 100644
--- a/Allura/allura/templates/repo/request_merge.html
+++ b/Allura/allura/templates/repo/request_merge.html
@@ -29,5 +29,5 @@
{% block header %}Request merge of {{c.app.config.options.mount_label}} {% endblock %}
{% block content %}
- {{ c.form.display(action='do_request_merge', value=dict(source_branch=source_branch))}}
+ {{ c.form.display(action='do_request_merge', value=dict(source_branch=source_branch, target_branch=target_branch))}}
{% endblock %}