incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [03/17] git commit: [#7069] ticket:525 Properly handle deleted repository on merge request page
Date Thu, 13 Feb 2014 15:05:37 GMT
[#7069] ticket:525 Properly handle deleted repository on merge request page


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

Branch: refs/heads/cj/7097
Commit: 4e2ec15648333d2aa73b5ea7b93a399edc74a83a
Parents: 6e0435c
Author: Aleksey 'LXj' Alekseyev <gotletter@gmail.com>
Authored: Thu Jan 30 23:40:55 2014 +0200
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Tue Feb 11 05:13:08 2014 +0000

----------------------------------------------------------------------
 Allura/allura/model/repository.py               |  5 ++
 Allura/allura/templates/repo/merge_request.html | 51 +++++++++++++-------
 2 files changed, 38 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4e2ec156/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index 03803cb..4a00f52 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -707,6 +707,11 @@ class MergeRequest(VersionedArtifact, ActivityObject):
             return c.app.url
 
     @LazyProperty
+    def downstream_repo(self):
+        with self.push_downstream_context():
+            return c.app.repo
+
+    @LazyProperty
     def downstream_repo_url(self):
         with self.push_downstream_context():
             return c.app.repo.clone_url(

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4e2ec156/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 820c4e9..9c1da9f 100644
--- a/Allura/allura/templates/repo/merge_request.html
+++ b/Allura/allura/templates/repo/merge_request.html
@@ -31,27 +31,42 @@ Merge Request #{{req.request_number}}: {{req.summary}} ({{req.status}})
 {% endblock %}
 
 {% block content %}
-  <p>
-    <a href="{{req.creator_url}}">{{req.creator_name}}</a>
-    would like you to merge {{ req.commits | count }} commits
-    from <a href="{{req.downstream_url}}">{{req.downstream_url}}</a>
-    to {{ req.target_branch }}
-  </p>
+  {% if req.downstream_repo %}
+    <p>
+      <a href="{{req.creator_url}}">{{req.creator_name}}</a>
+      would like you to merge {{ req.commits | count }} commits
+      from <a href="{{req.downstream_url}}">{{req.downstream_url}}</a>
+      to {{ req.target_branch }}
+    </p>
 
-  <div>{{g.markdown.convert(req.description)}}</div>
+    <div>{{g.markdown.convert(req.description)}}</div>
 
-  {{ c.log_widget.display(value=req.commits, app=downstream_app) }}
-  <div class="grid-19"><a href="#discussion_holder">Discuss</a></div>
+    {{ c.log_widget.display(value=req.commits, app=downstream_app) }}
+    <div class="grid-19"><a href="#discussion_holder">Discuss</a></div>
 
-  {% if h.has_access(c.app, 'write')() %}
-     <div class="grid-19">To merge the commits, please execute the following commands
in your working
-       copy: </div>
-     <div class="grid-19"><textarea
-        style="width:80%; height:60px;"
-        readonly
-        >{{ c.app.repo.merge_command(req) | safe }}</textarea></div>
-    {{ c.mr_dispose_form.display(action="save", value=dict(status=req.status)) }}
-     <br style="clear:both">
+    {% if h.has_access(c.app, 'write')() %}
+       <div class="grid-19">To merge the commits, please execute the following commands
in your working
+         copy: </div>
+       <div class="grid-19"><textarea
+          style="width:80%; height:60px;"
+          readonly
+          >{{ c.app.repo.merge_command(req) | safe }}</textarea></div>
+      {{ c.mr_dispose_form.display(action="save", value=dict(status=req.status)) }}
+       <br style="clear:both">
+    {% endif %}
+  {% else %}
+    <p>
+      Original repository by
+      <a href="{{req.creator_url}}">{{req.creator_name}}</a>
+      is deleted
+    </p>
+
+    <div>{{g.markdown.convert(req.description)}}</div>
+
+    {% if h.has_access(c.app, 'write')() %}
+      {{ c.mr_dispose_form.display(action="save", value=dict(status=req.status)) }}
+       <br style="clear:both">
+    {% endif %}
   {% endif %}
 
 {% endblock %}


Mime
View raw message