view tests/test-convert-bzr-directories @ 11109:a2bc2f2d77a9

subrepo: normalize path part of URLs so that pulling subrepos from webdir works For a "all projects at root" repo layout eg: /main /sub Where subrepos are used such that a clone of main has this layout: ./main/ ./main/.hgsub ./main/sub/ And the .hgsub content is: sub = ../sub This allows a pull from a hgweb where main and sub are exposed at the root (or same directory level) The current code doesn't normalize the path component of a pull url. this results in trying to pull from http://server.com/hg/main/../sub Current hgweb implementation doesn't reduce the path component so this results in a 404 error though everything is setup logically. This patch adresses this 404 error on the puller side normalizing the URLs used for pulling sub repos. For this example, the URL would be reduced to http://server.com/hg/sub Fix + test
author Edouard Gomez <ed.gomez@free.fr>
date Sat, 01 May 2010 23:05:19 +0200
parents 9e6d6568bf7a
children
line wrap: on
line source

#!/bin/sh

. "$TESTDIR/bzr-definitions"

echo % empty directory
mkdir test-empty
cd test-empty
bzr init -q source
cd source
echo content > a
bzr add -q a
bzr commit -q -m 'Initial add'
mkdir empty
bzr add -q empty
bzr commit -q -m 'Empty directory added'
echo content > empty/something
bzr add -q empty/something
bzr commit -q -m 'Added file into directory'
cd ..
hg convert source source-hg
manifest source-hg 1
manifest source-hg tip
cd ..

echo % directory renames
mkdir test-dir-rename
cd test-dir-rename
bzr init -q source
cd source
mkdir tpyo
echo content > tpyo/something
bzr add -q tpyo
bzr commit -q -m 'Added directory'
bzr mv tpyo typo
bzr commit -q -m 'Oops, typo'
cd ..
hg convert source source-hg
manifest source-hg 0
manifest source-hg tip
cd ..

echo % nested directory renames
mkdir test-nested-dir-rename
cd test-nested-dir-rename
bzr init -q source
cd source
mkdir -p firstlevel/secondlevel/thirdlevel
echo content > firstlevel/secondlevel/file
echo this_needs_to_be_there_too > firstlevel/secondlevel/thirdlevel/stuff
bzr add -q firstlevel
bzr commit -q -m 'Added nested directories'
bzr mv firstlevel/secondlevel secondlevel
bzr commit -q -m 'Moved secondlevel one level up'
cd ..
hg convert source source-hg
manifest source-hg tip
cd ..

echo % directory remove
mkdir test-dir-remove
cd test-dir-remove
bzr init -q source
cd source
mkdir src
echo content > src/sourcecode
bzr add -q src
bzr commit -q -m 'Added directory'
bzr rm -q src
bzr commit -q -m 'Removed directory'
cd ..
hg convert source source-hg
manifest source-hg 0
manifest source-hg tip
cd ..

echo % directory replace
mkdir test-dir-replace
cd test-dir-replace
bzr init -q source
cd source
mkdir first second
echo content > first/file
echo morecontent > first/dummy
echo othercontent > second/something
bzr add -q first second
bzr commit -q -m 'Initial layout'
bzr mv first/file second/file
bzr mv first third
bzr commit -q -m 'Some conflicting moves'
cd ..
hg convert source source-hg
manifest source-hg tip
cd ..