changeset 10051:a02d43acbc04 stable

convert/svn: make sink recover gracefully from empty changeset Otherwise when processing a changeset that in fact changes no files (perhaps due to bug in import from CVS) can get something like: unexpected svn output: abort: unable to cope with svn output Bug report and patch draft by Jesse Glick <jesse.glick@sun.com>
author Patrick Mezard <pmezard@gmail.com>
date Mon, 07 Dec 2009 12:44:15 -0500
parents 46de82e50790
children dfc3ed37d58d 8f14f749f471 9d1195b2f00d
files hgext/convert/subversion.py tests/test-convert-hg-svn tests/test-convert-hg-svn.out
diffstat 3 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/subversion.py	Fri Dec 11 15:09:52 2009 +0900
+++ b/hgext/convert/subversion.py	Mon Dec 07 12:44:15 2009 -0500
@@ -1138,6 +1138,8 @@
             try:
                 rev = self.commit_re.search(output).group(1)
             except AttributeError:
+                if not files:
+                    return parents[0]
                 self.ui.warn(_('unexpected svn output:\n'))
                 self.ui.warn(output)
                 raise util.Abort(_('unable to cope with svn output'))
--- a/tests/test-convert-hg-svn	Fri Dec 11 15:09:52 2009 +0900
+++ b/tests/test-convert-hg-svn	Mon Dec 07 12:44:15 2009 -0500
@@ -9,6 +9,7 @@
 
 echo "[extensions]" >> $HGRCPATH
 echo "convert = " >> $HGRCPATH
+echo "mq = " >> $HGRCPATH
 
 svnpath=`pwd | fix_path`/svn-repo
 svnadmin create $svnpath
@@ -59,9 +60,14 @@
 echo % new hg rev
 
 hg clone $svnpath-hg $svnpath-work
-echo b > $svnpath-work/b
-hg --cwd $svnpath-work add b
-hg --cwd $svnpath-work ci -mb
+cd $svnpath-work
+echo b > b
+hg add b
+hg ci -mb
+echo '% adding an empty revision'
+hg qnew -m emtpy empty
+hg qfinish -a
+cd ..
 
 echo % echo hg to svn
 hg --cwd $svnpath-hg pull -q $svnpath-work
--- a/tests/test-convert-hg-svn.out	Fri Dec 11 15:09:52 2009 +0900
+++ b/tests/test-convert-hg-svn.out	Mon Dec 07 12:44:15 2009 -0500
@@ -21,11 +21,13 @@
 % new hg rev
 updating to branch default
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+% adding an empty revision
 % echo hg to svn
 scanning source...
 sorting...
 converting...
-0 b
+1 b
+0 emtpy
 % svn back to hg should do nothing
 scanning source...
 sorting...