Marcin Kuzminski avatar Marcin Kuzminski committed 58b46f9

version bump. Made changesets work as should, but vcs had to be fixed for that.

Comments (0)

Files changed (4)

pylons_app/__init__.py

 Hg app, a web based mercurial repository managment based on pylons
 """
 
-VERSION = (0, 7, 3, 'beta')
+VERSION = (0, 7, 4, 'beta')
 
 __version__ = '.'.join((str(each) for each in VERSION[:4]))
 

pylons_app/controllers/changeset.py

 from pylons.controllers.util import abort, redirect
 from pylons_app.lib.auth import LoginRequired
 from pylons_app.lib.base import BaseController, render
-from pylons_app.lib.utils import get_repo_slug
 from pylons_app.model.hg_model import HgModel
+from vcs.utils import diffs as differ
 import logging
+from vcs.nodes import FileNode
 
 
 log = logging.getLogger(__name__)
     def index(self, revision):
         hg_model = HgModel()
         c.changeset = hg_model.get_repo(c.repo_name).get_changeset(revision)
-                          
+        c.changeset_old = c.changeset.parents[0]
+        c.changes = []
+        
+                
+        for node in c.changeset.added:
+            filenode_old = FileNode(node.path, '')
+            f_udiff = differ.get_udiff(filenode_old, node)
+            diff = differ.DiffProcessor(f_udiff).as_html()
+            c.changes.append(('added', node, diff))
+            
+        for node in c.changeset.changed:
+            filenode_old = c.changeset_old.get_node(node.path)
+            f_udiff = differ.get_udiff(filenode_old, node)
+            diff = differ.DiffProcessor(f_udiff).as_html()
+            c.changes.append(('changed', node, diff))
+            
+        for node in c.changeset.removed:
+            c.changes.append(('removed', node, None))            
+            
         return render('changeset/changeset.html')

pylons_app/lib/middleware/simplehg.py

                 app = wsgiapplication(self.__make_app)
             except Exception as e:
                 return HTTPNotFound()(environ, start_response)
-            
             action = self.__get_action(environ)            
             #invalidate cache on push
             if action == 'push':
             
             if action:
                 username = self.__get_environ_user(environ)
-                self.__log_user_action(username, action, repo_name)            
+                self.__log_user_action(username, action, repo_name)
+                         
             return app(environ, start_response)            
 
     def __make_app(self):
         hgserve = hgweb(self.repo_path)
-        return  self.load_web_settings(hgserve)
+        return  self.__load_web_settings(hgserve)
     
     def __get_environ_user(self, environ):
         return environ.get('REMOTE_USER')
         invalidate_cache('full_changelog', repo_name)
            
                    
-    def load_web_settings(self, hgserve):
+    def __load_web_settings(self, hgserve):
         repoui = make_ui(os.path.join(self.repo_path, '.hg', 'hgrc'), False)
         #set the global ui for hgserve
         hgserve.repo.ui = self.baseui
             hgserve.repo.ui = repoui
             
         return hgserve
-
-

pylons_app/templates/changeset/changeset.html

 <%def name="page_nav()">
     ${self.menu('changelog')}     
 </%def>
-
+<%def name="css()">
+<link rel="stylesheet" href="/css/monoblue_custom.css" type="text/css" />
+<link rel="stylesheet" href="/css/diff.css" type="text/css" />
+</%def>
 <%def name="main()">
-    <h2 class="no-link no-border">${_('Changeset')}</h2>
+    <h2 class="no-link no-border">${_('Changeset')} - r${c.changeset.revision}:${c.changeset.raw_id}</h2>
+    
+    <div id="changeset_content">
+		<div class="container">
+			<div class="left">
+				<div class="date">${_('Date')}: ${c.changeset.date}</div>
+				<div class="author">${_('Author')}: ${c.changeset.author}</div>
+				<div class="message">
+					${c.changeset.message}
+				</div>
+			</div>	
+			<div class="right">
+				<span class="logtags">
+					<span class="branchtag">${c.changeset.branch}</span>
+					%for tag in c.changeset.tags:
+						<span class="tagtag">${tag}</span>
+					%endfor
+				</span>					
+				%if len(c.changeset.parents)>1:
+				<div class="merge">		
+				${_('merge')}
+				<img alt="merge" src="/images/icons/arrow_join.png">
+				</div>
+				%endif						
+				%for p_cs in reversed(c.changeset.parents):
+					<div class="parent">${_('Parrent')} ${p_cs.revision}: ${h.link_to(p_cs.raw_id,
+						h.url('changeset_home',repo_name=c.repo_name,revision=p_cs.raw_id),title=p_cs.message)}
+					</div>
+				%endfor								
+			</div>		
+		</div>    
+    </div>
+    
+    <div style="clear: both"></div>
     <div class="cs_files">
-			%for filenode in c.changeset.added:
-				<p class="cs_added">${filenode}</p>
+			%for change,filenode,diff in c.changes:
+				<div class="cs_${change}">${h.link_to(filenode.path,h.url.current(anchor='CHANGE-%s'%filenode.path))}</div>
 			%endfor
-			%for filenode in c.changeset.changed:
-				<p class="cs_changed">${filenode}</p>
-			%endfor
-			%for filenode in c.changeset.removed:
-				<p class="cs_removed">${filenode}</p>
-			%endfor
-	</div>			
+	</div>
+	
+	%for change,filenode,diff in c.changes:
+		%if change !='removed':
+		<div style="clear:both;height:10px"></div>
+		<div id="body" class="diffblock">
+			<div id="${'CHANGE-%s'%filenode.path}" class="code-header">
+				<div>
+				<span>
+					${h.link_to_if(change!='removed',filenode.path,h.url('files_home',repo_name=c.repo_name,
+					revision=filenode.changeset.raw_id,f_path=filenode.path))}
+				</span>
+				
+				##&raquo; <span style="font-size:77%">${h.link_to(_('diff'),
+				##h.url.current(diff2=c.diff2,diff1=c.diff1,diff='diff'))}</span>
+				##&raquo; <span style="font-size:77%">${h.link_to(_('raw diff'),
+				##h.url.current(diff2=c.diff2,diff1=c.diff1.split(':')[-1],diff='raw'))}</span>
+				##&raquo; <span style="font-size:77%">${h.link_to(_('download diff'),
+				##h.url.current(diff2=c.diff2,diff1=c.diff1,diff='download'))}</span>
+				</div>
+			</div>
+			<div class="code-body">        
+					${diff|n}
+			</div>
+		</div>
+		%endif
+	%endfor
+			
 </%def>    
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.