diff --git a/rhodecode/controllers/compare.py b/rhodecode/controllers/compare.py --- a/rhodecode/controllers/compare.py +++ b/rhodecode/controllers/compare.py @@ -120,7 +120,8 @@ class CompareController(BaseRepoControll c.statuses = c.rhodecode_db_repo.statuses([x.raw_id for x in c.cs_ranges]) - + if request.environ.get('HTTP_X_PARTIAL_XHR'): + return render('compare/compare_cs.html') c.org_ref = org_ref[1] c.other_ref = other_ref[1] diff --git a/rhodecode/controllers/pullrequests.py b/rhodecode/controllers/pullrequests.py --- a/rhodecode/controllers/pullrequests.py +++ b/rhodecode/controllers/pullrequests.py @@ -31,7 +31,7 @@ from pylons.i18n.translation import _ from rhodecode.lib.base import BaseRepoController, render from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator -from webob.exc import HTTPNotFound +from rhodecode.model.db import User log = logging.getLogger(__name__) @@ -44,12 +44,15 @@ class PullrequestsController(BaseRepoCon def __before__(self): super(PullrequestsController, self).__before__() - def _get_repo_refs(self,repo): + def _get_repo_refs(self, repo): hist_l = [] - branches_group = ([(k, k) for k in repo.branches.keys()], _("Branches")) - bookmarks_group = ([(k, k) for k in repo.bookmarks.keys()], _("Bookmarks")) - tags_group = ([(k, k) for k in repo.tags.keys()], _("Tags")) + branches_group = ([('branch:' + k, k) for k in repo.branches.keys()], + _("Branches")) + bookmarks_group = ([('book:' + k, k) for k in repo.bookmarks.keys()], + _("Bookmarks")) + tags_group = ([('tag:' + k, k) for k in repo.tags.keys()], + _("Tags")) hist_l.append(bookmarks_group) hist_l.append(branches_group) @@ -58,8 +61,30 @@ class PullrequestsController(BaseRepoCon return hist_l def index(self): + org_repo = c.rhodecode_db_repo c.org_refs = self._get_repo_refs(c.rhodecode_repo) - c.sources = [] - c.sources.append('%s/%s' % (c.rhodecode_db_repo.user.username, - c.repo_name)) + c.org_repos = [] + c.other_repos = [] + c.org_repos.append((org_repo.repo_name, '%s/%s' % ( + org_repo.user.username, c.repo_name)) + ) + + c.other_refs = c.org_refs + c.other_repos.extend(c.org_repos) + + #gather forks and add to this list + for fork in org_repo.forks: + c.other_repos.append((fork.repo_name, '%s/%s' % ( + fork.user.username, fork.repo_name)) + ) + #add parents of this fork also + c.other_repos.append((org_repo.parent.repo_name, '%s/%s' % ( + org_repo.parent.user.username, + org_repo.parent.repo_name)) + ) + + #TODO: maybe the owner should be default ? + c.review_members = [] + c.available_members = [(x.user_id, x.username) for x in + User.query().filter(User.username != 'default').all()] return render('/pullrequests/pullrequest.html') diff --git a/rhodecode/model/db.py b/rhodecode/model/db.py --- a/rhodecode/model/db.py +++ b/rhodecode/model/db.py @@ -603,6 +603,20 @@ class Repository(Base, BaseModel): return q.one().ui_value @property + def forks(self): + """ + Return forks of this repo + """ + return Repository.get_repo_forks(self.repo_id) + + @property + def parent(self): + """ + Returns fork parent + """ + return self.fork + + @property def just_name(self): return self.repo_name.split(Repository.url_sep())[-1] diff --git a/rhodecode/templates/compare/compare_cs.html b/rhodecode/templates/compare/compare_cs.html new file mode 100644 --- /dev/null +++ b/rhodecode/templates/compare/compare_cs.html @@ -0,0 +1,23 @@ +## Changesets table ! +
+ + %if not c.cs_ranges: + + %else: + %for cnt, cs in enumerate(c.cs_ranges): + + + + + + + + + %endfor + %endif +
${_('No changesets')}
gravatar
+ %if cs.raw_id in c.statuses: +
+ %endif +
${h.link_to('r%s:%s' % (cs.revision,h.short_id(cs.raw_id)),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}
${h.person(cs.author)}
${cs.date}
${h.urlify_commit(h.wrap_paragraphs(cs.message),c.repo_name)}
+
\ No newline at end of file diff --git a/rhodecode/templates/compare/compare_diff.html b/rhodecode/templates/compare/compare_diff.html --- a/rhodecode/templates/compare/compare_diff.html +++ b/rhodecode/templates/compare/compare_diff.html @@ -33,24 +33,11 @@
-
- - %for cnt, cs in enumerate(c.cs_ranges): - - - - - - - - - %endfor -
gravatar
- %if cs.raw_id in c.statuses: -
- %endif -
${h.link_to('r%s:%s' % (cs.revision,h.short_id(cs.raw_id)),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}
${h.person(cs.author)}
${cs.date}
${h.urlify_commit(h.wrap_paragraphs(cs.message),c.repo_name)}
-
+ ##CS +
${_('Changesets')}
+ <%include file="compare_cs.html" /> + + ## FILES
${_('Files affected')}
%for fid, change, f, stat in c.files: diff --git a/rhodecode/templates/pullrequests/pullrequest.html b/rhodecode/templates/pullrequests/pullrequest.html --- a/rhodecode/templates/pullrequests/pullrequest.html +++ b/rhodecode/templates/pullrequests/pullrequest.html @@ -19,7 +19,8 @@
${self.breadcrumbs()}
-
+ ${h.form(url('#'),method='put', id='pull_request_form')} +
##ORG
@@ -27,14 +28,14 @@ gravatar
- ${h.select('other','',['%s/%s' % (c.rhodecode_db_repo.user.username,c.repo_name)])}:${h.select('other_ref','',c.org_refs)} + ${h.select('org_repo','',c.org_repos,class_='refs')}:${h.select('org_ref','',c.org_refs,class_='refs')}
${c.rhodecode_db_repo.description}
- +
##OTHER, most Probably the PARENT OF THIS FORK @@ -44,16 +45,65 @@ gravatar
- ${h.select('orther','',c.sources)}:${h.select('other_ref','',c.org_refs)} + ${h.select('other_repo','',c.other_repos,class_='refs')}:${h.select('other_ref','',c.other_refs,class_='refs')}
${c.rhodecode_db_repo.description}
+
+ + + ${_('Refresh')} + ${_('refresh overview')} + + +
+
+
+
- -

${_('New pull request')} from USER:REF into PARENT:REF

- ${h.form(url('#'),method='put')} +
+

${_('Pull request reviewers')}

+
+ ##TODO: make this nicer :) + + + + +
+
+
+
${_('Choosen reviewers')}
+ ${h.select('review_members',[x[0] for x in c.review_members],c.review_members,multiple=True,size=8,style="min-width:210px")} +
+ ${_('Remove all elements')} + remove +
+
+
+ add +
+ remove +
+
+
${_('Available reviewers')}
+ ${h.select('available_members',[],c.available_members,multiple=True,size=8,style="min-width:210px")} +
+ add + ${_('Add all elements')} +
+
+
+
+
+
+

${_('Create new pull request')}

+
@@ -85,7 +135,51 @@
${h.end_form()} - + +