route: recognize hierarchical branch names

Branch names in Git may be hierarchical (for example, "wip/parser/fix"),
however, git-arr's Bottle routing rules do not take this into account.
Fix this shortcoming.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
This commit is contained in:
Eric Sunshine 2014-12-31 04:50:10 -05:00 committed by Alberto Bertogli
parent e930f9e4f7
commit 56fcfd0278

12
git-arr

@ -224,8 +224,8 @@ def commit(repo, cid):
return dict(repo = repo, c=c) return dict(repo = repo, c=c)
@bottle.route('/r/<repo:repo>/b/<bname>/t/f=<fname:path>.html') @bottle.route('/r/<repo:repo>/b/<bname:path>/t/f=<fname:path>.html')
@bottle.route('/r/<repo:repo>/b/<bname>/t/<dirname:path>/f=<fname:path>.html') @bottle.route('/r/<repo:repo>/b/<bname:path>/t/<dirname:path>/f=<fname:path>.html')
@bottle.view('blob') @bottle.view('blob')
@with_utils @with_utils
def blob(repo, bname, fname, dirname = ''): def blob(repo, bname, fname, dirname = ''):
@ -244,8 +244,8 @@ def blob(repo, bname, fname, dirname = ''):
return dict(repo = r, dirname = dirname, fname = fname, blob = content) return dict(repo = r, dirname = dirname, fname = fname, blob = content)
@bottle.route('/r/<repo:repo>/b/<bname>/t/') @bottle.route('/r/<repo:repo>/b/<bname:path>/t/')
@bottle.route('/r/<repo:repo>/b/<bname>/t/<dirname:path>/') @bottle.route('/r/<repo:repo>/b/<bname:path>/t/<dirname:path>/')
@bottle.view('tree') @bottle.view('tree')
@with_utils @with_utils
def tree(repo, bname, dirname = ''): def tree(repo, bname, dirname = ''):
@ -257,8 +257,8 @@ def tree(repo, bname, dirname = ''):
r = repo.new_in_branch(bname) r = repo.new_in_branch(bname)
return dict(repo = r, tree = r.tree(), dirname = dirname) return dict(repo = r, tree = r.tree(), dirname = dirname)
@bottle.route('/r/<repo:repo>/b/<bname>/') @bottle.route('/r/<repo:repo>/b/<bname:path>/')
@bottle.route('/r/<repo:repo>/b/<bname>/<offset:int>.html') @bottle.route('/r/<repo:repo>/b/<bname:path>/<offset:int>.html')
@bottle.view('branch') @bottle.view('branch')
@with_utils @with_utils
def branch(repo, bname, offset = 0): def branch(repo, bname, offset = 0):