[PATCH] [mq]: svn_subrepo
Brett Cannon
brett at python.org
Sun Apr 18 16:41:58 CDT 2010
# HG changeset patch
# User Brett Cannon <brett at python.org>
# Date 1271625608 25200
# Node ID e76b1184500a27dcdbdc77e0ca16b7911bc8c11b
# Parent c2bf61e48f35e34f24b88c8903c4dc4819e08e6c
[mq]: svn_subrepo
diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -274,7 +274,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)
diff --git a/tests/test-subrepo-svn b/tests/test-subrepo-svn
--- a/tests/test-subrepo-svn
+++ b/tests/test-subrepo-svn
@@ -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')"
diff --git a/tests/test-subrepo-svn.out b/tests/test-subrepo-svn.out
--- a/tests/test-subrepo-svn.out
+++ b/tests/test-subrepo-svn.out
@@ -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
More information about the Mercurial-devel
mailing list