[PATCH] [convert] With -d svn, recover gracefully from empty cset

Patrick Mézard pmezard at gmail.com
Thu Dec 10 14:28:39 CST 2009


Le 07/12/09 18:44, Jesse Glick a écrit :
> # HG changeset patch
> # User Jesse Glick <jesse.glick at sun.com>
> # Date 1260207855 18000
> # Branch stable
> # Node ID a589087ef528cd4bb25e6371257e46d25f9fae30
> # Parent  4ddfad7ebd98525e577074e1ee456adf39192336
> [convert] With -d svn, recover gracefully from empty cset.
> 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

Crazy, someone uses the svn sink.
 
> diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py
> --- a/hgext/convert/subversion.py
> +++ b/hgext/convert/subversion.py
> @@ -1138,6 +1138,8 @@
>              try:
>                  rev = self.commit_re.search(output).group(1)
>              except AttributeError:
> +                if not files:
> +                    return "nothing at 0";
>                  self.ui.warn(_('unexpected svn output:\n'))
>                  self.ui.warn(output)
>                  raise util.Abort(_('unable to cope with svn output'))

Do you mind if we return the first parent instead? like:

diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py
--- a/hgext/convert/subversion.py
+++ b/hgext/convert/subversion.py
@@ -1139,7 +1139,7 @@
                 rev = self.commit_re.search(output).group(1)
             except AttributeError:
                 if not files:
-                    return "nothing at 0";
+                    return parents[0]
                 self.ui.warn(_('unexpected svn output:\n'))
                 self.ui.warn(output)
                 raise util.Abort(_('unable to cope with svn output'))


That's what the hg sink does in this case, it seems to work with my test.

--
Patrick Mézard


More information about the Mercurial-devel mailing list