From f9b8c79d22e8e86be4551e5952b9322a003bdd79 Mon Sep 17 00:00:00 2001 From: "Alexis S. L. Carvalho" Date: Tue, 3 Jul 2007 03:06:40 -0300 Subject: [PATCH] hgweb: use lrwxrwxrwx as the permissions of a symlink --- mercurial/hgweb/hgweb_mod.py | 6 +++--- mercurial/templater.py | 9 ++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py index e1c4b8a24a..19cb9fa601 100644 --- a/mercurial/hgweb/hgweb_mod.py +++ b/mercurial/hgweb/hgweb_mod.py @@ -404,7 +404,7 @@ class hgweb(object): parent=self.siblings(fctx.parents()), child=self.siblings(fctx.children()), rename=self.renamelink(fl, n), - permissions=fctx.manifest().execf(f)) + permissions=fctx.manifest().flags(f)) def fileannotate(self, fctx): f = fctx.path() @@ -440,7 +440,7 @@ class hgweb(object): rename=self.renamelink(fl, n), parent=self.siblings(fctx.parents()), child=self.siblings(fctx.children()), - permissions=fctx.manifest().execf(f)) + permissions=fctx.manifest().flags(f)) def manifest(self, ctx, path): mf = ctx.manifest() @@ -477,7 +477,7 @@ class hgweb(object): "parity": parity.next(), "basename": f, "size": ctx.filectx(full).size(), - "permissions": mf.execf(full)} + "permissions": mf.flags(full)} def dirlist(**map): fl = files.keys() diff --git a/mercurial/templater.py b/mercurial/templater.py index dc1db66a52..66deb31bd5 100644 --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -245,6 +245,13 @@ def indent(text, prefix): yield '\n' return "".join(indenter()) +def permissions(flags): + if "l" in flags: + return "lrwxrwxrwx" + if "x" in flags: + return "-rwxr-xr-x" + return "-rw-r--r--" + common_filters = { "addbreaks": nl2br, "basename": os.path.basename, @@ -260,7 +267,7 @@ common_filters = { "hgdate": hgdate, "isodate": isodate, "obfuscate": obfuscate, - "permissions": lambda x: x and "-rwxr-xr-x" or "-rw-r--r--", + "permissions": permissions, "person": person, "rfc822date": lambda x: util.datestr(x, "%a, %d %b %Y %H:%M:%S"), "short": lambda x: x[:12],