mirror of
https://github.com/correl/codereview.git
synced 2024-12-26 03:00:05 +00:00
Added paths to log view
This commit is contained in:
parent
e7285b2324
commit
981150f901
3 changed files with 10 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
|||
from django.conf.urls.defaults import *
|
||||
|
||||
urlpatterns = patterns('',
|
||||
(r'^(?P<repository>.*?)/log/$', 'codereview.browser.views.log'),
|
||||
(r'^(?P<repository>.*?)/log/(?P<path>(.*?/)+)?$', 'codereview.browser.views.log'),
|
||||
(r'^(?P<repository>.*?)/view/(?P<ref>.*?)/$', 'codereview.browser.views.view'),
|
||||
)
|
||||
|
|
|
@ -144,7 +144,7 @@ class Git(VCS):
|
|||
def log(self, commit=None, path=None, max=50, offset=0):
|
||||
commit = commit if commit else self._ref
|
||||
result = []
|
||||
for c in self._repo.iter_commits(commit, path, max_count=max,
|
||||
for c in self._repo.iter_commits(rev=commit, paths=path, max_count=max,
|
||||
skip=offset):
|
||||
result.append(self.commit(c))
|
||||
return result
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import os
|
||||
from django.http import Http404
|
||||
from django.shortcuts import render_to_response
|
||||
from codereview.dashboard.models import Repository
|
||||
from codereview.browser import vcs
|
||||
|
||||
def log(request,repository):
|
||||
def log(request,repository, path=None):
|
||||
try:
|
||||
repository = Repository.objects.get(name=repository)
|
||||
except:
|
||||
|
@ -12,7 +13,10 @@ def log(request,repository):
|
|||
ref = request.GET['c'] if 'c' in request.GET else repo.ref()
|
||||
offset = int(request.GET['o']) if 'o' in request.GET else 0
|
||||
limit = 20
|
||||
log = repo.log(ref, max=limit, offset=offset)
|
||||
|
||||
path = os.path.dirname(path) if path else ''
|
||||
log = repo.log(ref, path=path, max=limit, offset=offset)
|
||||
navigation = dict(zip(('dirs', 'files'), repo.browse()))
|
||||
|
||||
newer = offset - limit if offset > limit else 0
|
||||
# Inspect the last commit. If it has no parents, we can't go any further
|
||||
|
@ -23,8 +27,10 @@ def log(request,repository):
|
|||
return render_to_response('browser/log.html',
|
||||
{
|
||||
'repository': repository,
|
||||
'path': path,
|
||||
'repo': repo,
|
||||
'log': log,
|
||||
'navigation': navigation,
|
||||
'ref': ref,
|
||||
'offset': offset,
|
||||
'newer': newer,
|
||||
|
|
Loading…
Reference in a new issue