merge with stable
authorMatt Mackall <mpm@selenic.com>
Wed, 25 Aug 2010 15:20:25 -0500
changeset 12040 529e712cb1ba
parent 12037 aaf9968bd8b7 (current diff)
parent 12039 18e1e7520b67 (diff)
child 12041 270fb4d39153
merge with stable
mercurial/dispatch.py
--- a/mercurial/dispatch.py	Tue Aug 24 13:13:35 2010 -0500
+++ b/mercurial/dispatch.py	Wed Aug 25 15:20:25 2010 -0500
@@ -189,7 +189,7 @@
 
 class cmdalias(object):
     def __init__(self, name, definition, cmdtable):
-        self.name = name
+        self.name = self.cmd = name
         self.definition = definition
         self.args = []
         self.opts = []
@@ -198,7 +198,11 @@
         self.badalias = False
 
         try:
-            cmdutil.findcmd(self.name, cmdtable, True)
+            aliases, entry = cmdutil.findcmd(self.name, cmdtable)
+            for alias, e in cmdtable.iteritems():
+                if e is entry:
+                    self.cmd = alias
+                    break
             self.shadows = True
         except error.UnknownCommand:
             self.shadows = False
@@ -295,7 +299,7 @@
     # but only if they have been defined prior to the current definition.
     for alias, definition in ui.configitems('alias'):
         aliasdef = cmdalias(alias, definition, cmdtable)
-        cmdtable[alias] = (aliasdef, aliasdef.opts, aliasdef.help)
+        cmdtable[aliasdef.cmd] = (aliasdef, aliasdef.opts, aliasdef.help)
         if aliasdef.norepo:
             commands.norepo += ' %s' % alias
 
--- a/mercurial/hgweb/hgwebdir_mod.py	Tue Aug 24 13:13:35 2010 -0500
+++ b/mercurial/hgweb/hgwebdir_mod.py	Wed Aug 25 15:20:25 2010 -0500
@@ -233,6 +233,10 @@
                 # update time with local timezone
                 try:
                     r = hg.repository(self.ui, path)
+                except error.RepoError:
+                    u.warn(_('error accessing repository at %s\n') % path)
+                    continue
+                try:
                     d = (get_mtime(r.spath), util.makedate()[1])
                 except OSError:
                     continue
--- a/tests/test-hgwebdir	Tue Aug 24 13:13:35 2010 -0500
+++ b/tests/test-hgwebdir	Wed Aug 25 15:20:25 2010 -0500
@@ -26,6 +26,10 @@
 echo c > c/c
 hg --cwd c ci -Amc -d'3 0'
 
+# create repository without .hg/store
+hg init nostore
+rm -R nostore/.hg/store
+
 root=`pwd`
 cd ..
 
@@ -112,6 +116,20 @@
 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=raw'
 
 
+"$TESTDIR/killdaemons.py"
+cat > paths.conf <<EOF
+[paths]
+nostore = $root/nostore
+inexistent = $root/inexistent
+EOF
+
+hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \
+    -A access-paths.log -E error-paths-4.log
+cat hg.pid >> $DAEMON_PIDS
+echo % test inexistent and inaccessible repo should be ignored silently
+"$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/'
+
+
 cat > collections.conf <<EOF
 [collections]
 $root=$root
--- a/tests/test-hgwebdir.out	Tue Aug 24 13:13:35 2010 -0500
+++ b/tests/test-hgwebdir.out	Wed Aug 25 15:20:25 2010 -0500
@@ -406,6 +406,45 @@
 /t/a/
 /t/b/
 
+% test inexistent and inaccessible repo should be ignored silently
+200 Script output follows
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
+<head>
+<link rel="icon" href="/static/hgicon.png" type="image/png" />
+<meta name="robots" content="index, nofollow" />
+<link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
+
+<title>Mercurial repositories index</title>
+</head>
+<body>
+
+<div class="container">
+<div class="menu">
+<a href="http://mercurial.selenic.com/">
+<img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
+</div>
+<div class="main">
+<h2>Mercurial Repositories</h2>
+
+<table class="bigtable">
+    <tr>
+        <th><a href="?sort=name">Name</a></th>
+        <th><a href="?sort=description">Description</a></th>
+        <th><a href="?sort=contact">Contact</a></th>
+        <th><a href="?sort=lastchange">Last modified</a></th>
+        <th>&nbsp;</th>
+    </tr>
+    
+</table>
+</div>
+</div>
+
+
+</body>
+</html>
+
 % collections: should succeed
 200 Script output follows