--- a/hgext/convert/subversion.py Mon Apr 07 09:26:40 2008 +0200
+++ b/hgext/convert/subversion.py Mon Apr 07 13:16:11 2008 +0200
@@ -247,6 +247,10 @@
def getheads(self):
+ def isdir(path, revnum):
+ kind = svn.ra.check_path(self.ra, path, revnum)
+ return kind == svn.core.svn_node_dir
+
def getcfgpath(name, rev):
cfgpath = self.ui.config('convert', 'svn.' + name)
if cfgpath is not None and cfgpath.strip() == '':
@@ -288,6 +292,8 @@
self.ctx)
for branch in branchnames.keys():
module = '%s/%s/%s' % (oldmodule, branches, branch)
+ if not isdir(module, self.last_changed):
+ continue
brevid = self.latest(module, self.last_changed)
if not brevid:
self.ui.note(_('ignoring empty branch %s\n') %
--- a/tests/test-convert-svn-branches Mon Apr 07 09:26:40 2008 +0200
+++ b/tests/test-convert-svn-branches Mon Apr 07 13:16:11 2008 +0200
@@ -38,7 +38,9 @@
echo hello > trunk/letter.txt
echo hey > trunk/letter2.txt
echo ho > trunk/letter3.txt
-svn add trunk/letter.txt trunk/letter2.txt trunk/letter3.txt
+# Add a file within branches, used to confuse branch detection
+echo a > branches/readme.txt
+svn add trunk/letter.txt trunk/letter2.txt trunk/letter3.txt branches/readme.txt
svn ci -m hello
echo % branch to old letters
--- a/tests/test-convert-svn-branches.out Mon Apr 07 09:26:40 2008 +0200
+++ b/tests/test-convert-svn-branches.out Mon Apr 07 13:16:11 2008 +0200
@@ -12,10 +12,12 @@
A trunk/letter.txt
A trunk/letter2.txt
A trunk/letter3.txt
+A branches/readme.txt
+Adding branches/readme.txt
Adding trunk/letter.txt
Adding trunk/letter2.txt
Adding trunk/letter3.txt
-Transmitting file data ...
+Transmitting file data ....
Committed revision 2.
% branch to old letters
A branches/old