changeset 19886:e828975722c8

merge with stable
author Matt Mackall <mpm@selenic.com>
date Wed, 09 Oct 2013 14:15:34 -0700
parents 6cc696179869 (current diff) 904061628dc4 (diff)
children dd7c294365f0
files mercurial/hgweb/webcommands.py mercurial/templatefilters.py mercurial/ui.py
diffstat 5 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/server.py	Wed Oct 09 14:15:20 2013 -0700
+++ b/mercurial/hgweb/server.py	Wed Oct 09 14:15:34 2013 -0700
@@ -60,7 +60,10 @@
         self._log_any(self.server.accesslog, format, *args)
 
     def log_request(self, code='-', size='-'):
-        xheaders = [h for h in self.headers.items() if h[0].startswith('x-')]
+        xheaders = []
+        if util.safehasattr(self, 'headers'):
+            xheaders = [h for h in self.headers.items()
+                        if h[0].startswith('x-')]
         self.log_message('"%s" %s %s%s',
                          self.requestline, str(code), str(size),
                          ''.join([' %s:%s' % h for h in sorted(xheaders)]))
--- a/mercurial/hgweb/webcommands.py	Wed Oct 09 14:15:20 2013 -0700
+++ b/mercurial/hgweb/webcommands.py	Wed Oct 09 14:15:34 2013 -0700
@@ -994,7 +994,7 @@
             desc = templatefilters.firstline(ctx.description())
             desc = cgi.escape(templatefilters.nonempty(desc))
             user = cgi.escape(templatefilters.person(ctx.user()))
-            branch = ctx.branch()
+            branch = cgi.escape(ctx.branch())
             try:
                 branchnode = web.repo.branchtip(branch)
             except error.RepoLookupError:
@@ -1003,7 +1003,8 @@
 
             if usetuples:
                 data.append((node, vtx, edges, desc, user, age, branch,
-                             ctx.tags(), ctx.bookmarks()))
+                             [cgi.escape(x) for x in ctx.tags()],
+                             [cgi.escape(x) for x in ctx.bookmarks()]))
             else:
                 edgedata = [dict(col=edge[0], nextcol=edge[1],
                                  color=(edge[2] - 1) % 6 + 1,
--- a/mercurial/templatefilters.py	Wed Oct 09 14:15:20 2013 -0700
+++ b/mercurial/templatefilters.py	Wed Oct 09 14:15:34 2013 -0700
@@ -215,6 +215,7 @@
 _escapes = [
     ('\\', '\\\\'), ('"', '\\"'), ('\t', '\\t'), ('\n', '\\n'),
     ('\r', '\\r'), ('\f', '\\f'), ('\b', '\\b'),
+    ('<', '\\u003c'), ('>', '\\u003e')
 ]
 
 def jsonescape(s):
--- a/mercurial/ui.py	Wed Oct 09 14:15:20 2013 -0700
+++ b/mercurial/ui.py	Wed Oct 09 14:15:34 2013 -0700
@@ -665,7 +665,7 @@
         if not self.interactive():
             return default
         try:
-            self.write(self.label(prompt or _('password: '), 'ui.prompt'))
+            self.write_err(self.label(prompt or _('password: '), 'ui.prompt'))
             return getpass.getpass('')
         except EOFError:
             raise util.Abort(_('response expected'))
--- a/tests/test-propertycache.py	Wed Oct 09 14:15:20 2013 -0700
+++ b/tests/test-propertycache.py	Wed Oct 09 14:15:34 2013 -0700
@@ -42,7 +42,7 @@
 # create an empty repo. and instanciate it. It is important to run
 # those test on the real object to detect regression.
 repopath = os.path.join(os.environ['TESTTMP'], 'repo')
-subprocess.check_call(['hg', 'init', repopath])
+assert subprocess.call(['hg', 'init', repopath]) == 0
 ui = uimod.ui()
 repo = mercurial.hg.repository(ui, path=repopath).unfiltered()