changeset 5943:ffaf2419de44

Ensure that absolutized paths from hgrc do not contain ../ segments.
author Jesse Glick <jesse.glick@sun.com>
date Tue, 08 Jan 2008 22:40:51 -0500
parents d8878742a924
children 5963c0ad2853
files mercurial/ui.py tests/test-keyword.out tests/test-paths tests/test-paths.out
diffstat 4 files changed, 19 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/ui.py	Fri Jan 25 16:18:49 2008 +0100
+++ b/mercurial/ui.py	Tue Jan 08 22:40:51 2008 -0500
@@ -204,7 +204,8 @@
                     pathsitems = items
                 for n, path in pathsitems:
                     if path and "://" not in path and not os.path.isabs(path):
-                        cdata.set("paths", n, os.path.join(root, path))
+                        cdata.set("paths", n,
+                                  os.path.normpath(os.path.join(root, path)))
 
         # update verbosity/interactive/report_untrusted settings
         if section is None or section == 'ui':
--- a/tests/test-keyword.out	Fri Jan 25 16:18:49 2008 +0100
+++ b/tests/test-keyword.out	Tue Jan 08 22:40:51 2008 -0500
@@ -293,7 +293,7 @@
 added 1 changesets with 3 changes to 3 files
 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
 % incoming
-comparing with test-keyword/Test-a/../Test
+comparing with test-keyword/Test
 searching for changes
 changeset:   1:0729690beff6
 tag:         tip
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-paths	Tue Jan 08 22:40:51 2008 -0500
@@ -0,0 +1,11 @@
+#!/bin/sh
+base=`pwd`
+hg init a
+hg clone a b
+cd a
+echo '[paths]' >> .hg/hgrc
+echo 'dupe = ../b' >> .hg/hgrc
+hg in dupe | sed "s!$base!<base>!g"
+cd ..
+hg -R a in dupe | sed "s!$base!<base>!g"
+true
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-paths.out	Tue Jan 08 22:40:51 2008 -0500
@@ -0,0 +1,5 @@
+0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+comparing with <base>/b
+no changes found
+comparing with <base>/b
+no changes found