Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mirror
ccan
Commits
bb4b8b6b
Commit
bb4b8b6b
authored
Aug 07, 2010
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
web: handle symlinks in bzrbrowse.cgi, fix images.
parent
b7cb6af1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
4 deletions
+17
-4
Makefile-web
Makefile-web
+1
-1
web/bzrbrowse/bzrbrowse.cgi
web/bzrbrowse/bzrbrowse.cgi
+16
-3
web/bzrbrowse/symlink.png
web/bzrbrowse/symlink.png
+0
-0
No files found.
Makefile-web
View file @
bb4b8b6b
...
...
@@ -10,7 +10,7 @@ WEB_SUBDIRS=$(WEBDIR)/tarballs $(WEBDIR)/junkcode $(WEBDIR)/tarballs/with-deps $
JUNKDIRS=$(wildcard junkcode/*)
JUNKPAGES=$(JUNKDIRS:%=$(WEBDIR)/%.html)
JUNKBALLS=$(JUNKDIRS:%=$(WEBDIR)/%.tar.bz2)
BZRBROWSE=$(WEBDIR)/bzrbrowse.cgi $(WEBDIR)/file.png $(WEBDIR)/folder.png
BZRBROWSE=$(WEBDIR)/bzrbrowse.cgi $(WEBDIR)/file.png $(WEBDIR)/folder.png
$(WEBDIR)/symlink.png
upload: fastcheck webpages
bzr push
...
...
web/bzrbrowse/bzrbrowse.cgi
View file @
bb4b8b6b
...
...
@@ -21,16 +21,16 @@
config = {
'root': '/home/ccan/ccan',
'base_url': '/browse',
'images_url': '
/browse
',
'images_url': '',
'branch_url': 'http://ccan.ozlabs.org/repo',
}
import os, sys
import os, sys
, string
from bzrlib.branch import Branch
from bzrlib.errors import NotBranchError
from bzrlib import urlutils, osutils
__version__ = '0.0.1'
__version__ = '0.0.1
-rusty
'
class HTTPError(Exception):
...
...
@@ -55,6 +55,7 @@ class BzrBrowse(object):
icons = {
'file': 'file.png',
'directory': 'folder.png',
'symlink': 'symlink.png',
}
page_tmpl = '''
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
...
...
@@ -147,12 +148,24 @@ code { background-color: #000; color: #FFF; font-size: 90%%;}
linenumbers + '
</pre></td><td
class=
"text"
><pre>
' + escape_html(text) +
'
</pre></td></tr></table>
')
# Symlinks in ccan contain .., and bzr refuses to serve that. Simplify.
def squish(self, linkname):
result = []
for elem in string.split(linkname, os.sep):
if elem == '..':
result = result[:-1]
else:
result.append(elem)
return string.join(result, os.sep)
def list_branch_directory(self, branch, path, relpath):
tree = branch.basis_tree()
file_id = tree.path2id(relpath)
ie = tree.inventory[file_id]
if ie.kind == 'file':
return self.view_branch_file(tree, ie)
if ie.kind == 'symlink':
return self.list_branch_directory(branch, path, self.squish(osutils.dirname(relpath) + os.sep + ie.symlink_target))
entries = []
if path:
entries.append({
...
...
web/bzrbrowse/symlink.png
0 → 100644
View file @
bb4b8b6b
210 Bytes
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment