[PATCH] Removed unnecessary os.path.basename call

Ry4an Brase ry4an-hg at ry4an.org
Wed Oct 15 12:59:54 CDT 2008


# HG changeset patch
# User Ry4an Brase <ry4an-hg at ry4an.org>
# Date 1224093431 18000
# Node ID 61822b4dcc15f829f4996e6e3f231ef0471a5d02
# Parent  baf12d52add4a3d4d87b8c8370cefaee9943b740
Removed unnecessary os.path.basename call.

As part of a forthcoming patch I noticed a call that seemed unnecessary
since the else clause makes sure that ther are no slashes in 'remain'.

<Ry4an> Am I mis-understanding what os.path.basename does or is it a
    windows workaround thing or is it unnecessary?
<Tonfa> Ry4an: we shouldn't it the else
<Tonfa> Ry4an: please remove it in a different patch

diff -r baf12d52add4 -r 61822b4dcc15 mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py	Wed Oct 15 16:27:36 2008 +0200
+++ b/mercurial/hgweb/webcommands.py	Wed Oct 15 12:57:11 2008 -0500
@@ -280,8 +280,7 @@
             short = remain[:remain.index("/") + 1] # bleah
             files[short] = (f, None)
         else:
-            short = os.path.basename(remain)
-            files[short] = (f, n)
+            files[remain] = (f, n)
 
     if not files:
         raise ErrorResponse(HTTP_NOT_FOUND, 'path not found: ' + path)


More information about the Mercurial-devel mailing list