changeset 10954:33119d0252c1 stable

subrepo: fix repo root path handling in svn subrepo
author Brett Cannon <brett@python.org>
date Sun, 18 Apr 2010 14:20:08 -0700
parents f1250e2e8fd1
children 8d5f5122a732 6a3377851d45 d16315e811de
files mercurial/subrepo.py tests/test-subrepo-svn tests/test-subrepo-svn.out
diffstat 3 files changed, 16 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/subrepo.py	Thu Apr 08 00:13:33 2010 +0900
+++ b/mercurial/subrepo.py	Sun Apr 18 14:20:08 2010 -0700
@@ -273,7 +273,8 @@
         self._ui = ctx._repo.ui
 
     def _svncommand(self, commands):
-        cmd = ['svn'] + commands + [self._path]
+        path = os.path.join(self._ctx._repo.origroot, self._path)
+        cmd = ['svn'] + commands + [path]
         cmd = [util.shellquote(arg) for arg in cmd]
         cmd = util.quotecommand(' '.join(cmd))
         env = dict(os.environ)
--- a/tests/test-subrepo-svn	Thu Apr 08 00:13:33 2010 +0900
+++ b/tests/test-subrepo-svn	Sun Apr 18 14:20:08 2010 -0700
@@ -16,7 +16,8 @@
 fi
 escapedwd=`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$escapedwd"`
 filterpath="s|$escapedwd|/root|"
-filtersvn='s/ in transaction.*/ is out of date/;s/Out of date: /File /'
+filteroutofdate='s/ in transaction.*/ is out of date/;s/Out of date: /File /'
+filterexternal="s|Fetching external item into '.*/s/externals'|Fetching external item into 's/externals'|g"
 
 echo % create subversion repo
 
@@ -62,7 +63,7 @@
 echo % change file in svn and hg, commit
 echo a >> a
 echo alpha >> s/alpha
-hg commit -m 'Message!'
+hg commit -m 'Message!' | sed "$filterexternal"
 hg debugsub | sed "$filterpath"
 
 echo
@@ -81,12 +82,12 @@
 
 echo % this commit from hg will fail
 echo zzz >> s/alpha
-hg ci -m 'amend alpha from hg' 2>&1 | sed "$filtersvn"
+hg ci -m 'amend alpha from hg' 2>&1 | sed "$filteroutofdate"
 svn revert -q s/alpha
 
 echo % this commit fails because of meta changes
 svn propset svn:mime-type 'text/html' s/alpha
-hg ci -m 'amend alpha from hg' 2>&1 | sed "$filtersvn"
+hg ci -m 'amend alpha from hg' 2>&1 | sed "$filteroutofdate"
 svn revert -q s/alpha
 
 echo % this commit fails because of externals changes
@@ -106,3 +107,6 @@
 cd tc
 echo % debugsub in clone
 hg debugsub | sed "$filterpath"
+
+echo % verify subrepo is contained within the repo directory
+python -c "import os.path; print os.path.exists('s')"
--- a/tests/test-subrepo-svn.out	Thu Apr 08 00:13:33 2010 +0900
+++ b/tests/test-subrepo-svn.out	Sun Apr 18 14:20:08 2010 -0700
@@ -72,11 +72,11 @@
 
 % clone
 updating to branch default
-A    s/alpha
- U   s
+A    tc/s/alpha
+ U   tc/s
 
-Fetching external item into 's/externals'
-A    s/externals/other
+Fetching external item into 'tc/s/externals'
+A    tc/s/externals/other
 Checked out external at revision 1.
 
 Checked out revision 3.
@@ -85,3 +85,5 @@
 path s
  source   file:///root/svn-repo/src
  revision 3
+% verify subrepo is contained within the repo directory
+True