Changeset - 7ec4463b6e53
[Not reviewed]
default
0 7 0
Marcin Kuzminski - 15 years ago 2010-06-13 15:56:47
marcin@python-works.com
fixed branches and tags, fetching for new vcs implementation
7 files changed with 41 insertions and 28 deletions:
0 comments (0 inline, 0 general)
pylons_app/controllers/branches.py
Show inline comments
 
@@ -13,32 +13,34 @@
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
# MA  02110-1301, USA.
 
"""
 
Created on April 21, 2010
 
branches controller for pylons
 
@author: marcink
 
"""
 
from pylons import tmpl_context as c, app_globals as g
 
from pylons import tmpl_context as c
 
from pylons_app.lib.auth import LoginRequired
 
from pylons_app.lib.base import BaseController, render
 
from pylons_app.model.hg_model import HgModel
 
import logging
 

	
 
log = logging.getLogger(__name__)
 

	
 
class BranchesController(BaseController):
 
    
 
    @LoginRequired()
 
    def __before__(self):
 
        super(BranchesController, self).__before__()
 
    
 
    def index(self):
 
        hg_model = HgModel()
 
        c.repo_info = hg_model.get_repo(c.repo_name)
 
        c.repo_branches = c.repo_info.branches
 
        c.repo_branches = {}
 
        for name, hash in c.repo_info.branches.items():
 
            c.repo_branches[name] = c.repo_info.get_changeset(hash)
 
                
 
        return render('branches/branches.html')
pylons_app/controllers/summary.py
Show inline comments
 
@@ -38,15 +38,21 @@ class SummaryController(BaseController):
 
        
 
    def index(self):
 
        hg_model = HgModel()
 
        c.repo_info = hg_model.get_repo(c.repo_name)
 
        c.repo_changesets = _full_changelog_cached(c.repo_name)[:10]
 
        e = request.environ
 
        uri = u'%(protocol)s://%(user)s@%(host)s/%(repo_name)s' % {
 
                                        'protocol': e.get('wsgi.url_scheme'),
 
                                        'user':str(c.hg_app_user.username),
 
                                        'host':e.get('HTTP_HOST'),
 
                                        'repo_name':c.repo_name, }
 
        c.clone_repo_url = uri
 
        c.repo_tags = c.repo_info.tags[:10]
 
        c.repo_branches = c.repo_info.branches[:10]
 
        c.repo_tags = {}
 
        for name, hash in c.repo_info.tags.items()[:10]:
 
            c.repo_tags[name] = c.repo_info.get_changeset(hash)
 
        
 
        c.repo_branches = {}
 
        for name, hash in c.repo_info.branches.items()[:10]:
 
            c.repo_branches[name] = c.repo_info.get_changeset(hash)
 
                    
 
        return render('summary/summary.html')
pylons_app/controllers/tags.py
Show inline comments
 
@@ -30,15 +30,17 @@ import logging
 

	
 
log = logging.getLogger(__name__)
 

	
 
class TagsController(BaseController):
 
    
 
    @LoginRequired()
 
    def __before__(self):
 
        super(TagsController, self).__before__()
 
        
 
    def index(self):
 
        hg_model = HgModel()
 
        c.repo_info = hg_model.get_repo(c.repo_name)
 
        c.repo_tags = c.repo_info.tags
 
        c.repo_tags = {}
 
        for name, hash in c.repo_info.tags.items():
 
            c.repo_tags[name] = c.repo_info.get_changeset(hash)
 
        
 
        return render('tags/tags.html')
pylons_app/templates/branches/branches.html
Show inline comments
 
@@ -9,30 +9,31 @@
 
    ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
 
    /
 
    ${_('branches')}
 
</%def>
 
<%def name="page_nav()">
 
	${self.menu('branches')}    
 
</%def>
 
<%def name="main()">
 

	
 
    <h2 class="no-link no-border">${_('Branches')}</h2>
 

	
 
    <table>
 
		%for cnt,branch in enumerate(c.repo_branches):
 
		%for cnt,branch in enumerate(c.repo_branches.items()):
 
		<tr class="parity${cnt%2}">
 
			<td>${branch._ctx.date()|n,filters.age}</td>
 
			<td>${branch[1]._ctx.date()|n,filters.age}</td>
 
			<td>
 
				<span class="logtags">
 
					<span class="branchtag">${h.link_to(branch.branch,h.url('changeset_home',repo_name=c.repo_name,revision=branch._short))}</span>
 
					<span class="branchtag">${h.link_to(branch[0],
 
					h.url('changeset_home',repo_name=c.repo_name,revision=branch[1].raw_id))}</span>
 
				</span>			
 
			</td>
 
			<td class="nowrap">
 
			${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=branch._short))}
 
			${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=branch[1].raw_id))}
 
			|
 
			${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=branch._short))}
 
			${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=branch[1].raw_id))}
 
			</td>
 
		</tr>	
 
		%endfor
 
    </table>
 

	
 
</%def>    
 
\ No newline at end of file
pylons_app/templates/shortlog/shortlog_data.html
Show inline comments
 
@@ -13,27 +13,27 @@ from pylons_app.lib import filters
 
			h.url('changeset_home',repo_name=c.repo_name,revision=cs._short),
 
			title=cs.message)}
 
		</td>
 
		<td>
 
				<span class="logtags">
 
					<span class="branchtag">${cs.branch}</span>
 
					%for tag in cs.tags:
 
						<span class="tagtag">${tag}</span>
 
					%endfor
 
				</span>
 
		</td>
 
		<td class="nowrap">
 
		${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=cs._short))}
 
		${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}
 
		|
 
		${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=cs._short))}
 
		${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}
 
		</td>
 
	</tr>	
 
%endfor
 

	
 
</table>
 
	<div>
 
		<script type="text/javascript">
 
		var data_div = 'shortlog_data';
 
		YAHOO.util.Event.onDOMReady(function(){
 
			YAHOO.util.Event.addListener(YAHOO.util.Dom.getElementsByClassName('pager_link'),"click",function(){
 
					YAHOO.util.Dom.setStyle('shortlog_data','opacity','0.3');});});
 
		</script>	
pylons_app/templates/summary/summary.html
Show inline comments
 
@@ -84,49 +84,51 @@ E.onDOMReady(function(e){
 
			</td>
 
			<td class="nowrap">
 
			${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=cs._short))}
 
			|
 
			${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=cs._short))}
 
			</td>
 
		</tr>
 
	%endfor
 
    </table>
 

	
 
    <h2>${h.link_to(_('Tags'),h.url('tags_home',repo_name=c.repo_name))}</h2>
 
    <table>
 
		%for cnt,tag in enumerate(c.repo_tags):
 
		%for cnt,tag in enumerate(c.repo_tags.items()):
 
		<tr class="parity${cnt%2}">
 
			<td>${tag._ctx.date()|n,filters.age}</td>
 
			<td>${tag[1]._ctx.date()|n,filters.age}</td>
 
			<td>
 
				<span class="logtags">
 
					<span class="tagtag">${h.link_to(tag.tags[-1],h.url('changeset_home',repo_name=c.repo_name,revision=tag._short))}</span>
 
					<span class="tagtag">${h.link_to(tag[0],
 
					h.url('changeset_home',repo_name=c.repo_name,revision=tag[1].raw_id))}</span>
 
				</span>
 
			</td>
 
			<td class="nowrap">
 
			${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=tag._short))}
 
			${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=tag[1].raw_id))}
 
			|
 
			${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=tag._short))}
 
			${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=tag[1].raw_id))}
 
			</td>
 
		</tr>	
 
		%endfor
 
    </table>
 

	
 
    <h2>${h.link_to(_('Branches'),h.url('branches_home',repo_name=c.repo_name))}</h2>
 
    <table>
 
		%for cnt,branch in enumerate(c.repo_branches):
 
		%for cnt,branch in enumerate(c.repo_branches.items()):
 
		<tr class="parity${cnt%2}">
 
			<td>${branch._ctx.date()|n,filters.age}</td>
 
			<td>${branch[1]._ctx.date()|n,filters.age}</td>
 
			<td>
 
				<span class="logtags">
 
					<span class="branchtag">${h.link_to(branch.branch,h.url('changeset_home',repo_name=c.repo_name,revision=branch._short))}</span>
 
					<span class="branchtag">${h.link_to(branch[0],
 
					h.url('changeset_home',repo_name=c.repo_name,revision=branch[1].raw_id))}</span>
 
				</span>			
 
			</td>
 
			<td class="nowrap">
 
			${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=branch._short))}
 
			${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=branch[1].raw_id))}
 
			|
 
			${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=branch._short))}
 
			${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=branch[1].raw_id))}
 
			</td>
 
		</tr>	
 
		%endfor
 
    </table>
 

	
 
</%def>    
 
\ No newline at end of file
pylons_app/templates/tags/tags.html
Show inline comments
 
@@ -9,32 +9,32 @@ from pylons_app.lib import filters
 
    ${h.link_to(u'Home',h.url('/'))}
 
    / 
 
    ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
 
    /
 
    ${_('tags')}
 
</%def>
 
<%def name="page_nav()">
 
	${self.menu('tags')}    
 
</%def>
 
<%def name="main()">
 

	
 
    <h2 class="no-link no-border">${_('Tags')}</h2>
 

	
 
    <table>
 
		%for cnt,tag in enumerate(c.repo_tags):
 
		%for cnt,tag in enumerate(c.repo_tags.items()):
 
		<tr class="parity${cnt%2}">
 
			<td>${tag._ctx.date()|n,filters.age}</td>
 
			<td>${tag[1]._ctx.date()|n,filters.age}</td>
 
			<td>
 
				<span class="logtags">
 
					<span class="tagtag">${h.link_to(tag.tags[-1],h.url('changeset_home',repo_name=c.repo_name,revision=tag._short))}</span>
 
					<span class="tagtag">${h.link_to(tag[0],
 
					h.url('changeset_home',repo_name=c.repo_name,revision=tag[1].raw_id))}</span>
 
				</span>
 
			</td>
 
			<td class="nowrap">
 
			${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=tag._short))}
 
			${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=tag[1].raw_id))}
 
			|
 
			${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=tag._short))}
 
			${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=tag[1].raw_id))}
 
			</td>
 
		</tr>	
 
		%endfor
 
    </table>
 

	
 
</%def>    
 
\ No newline at end of file
0 comments (0 inline, 0 general)