Patchwork [1,of,2] convert: don't ignore errors from git diff-tree

login
register
mail settings
Submitter Julien Cristau
Date April 6, 2016, 8:25 p.m.
Message ID <14688347f01754b9d1c5.1459974324@betterave.cristau.org>
Download mbox | patch
Permalink /patch/14399/
State Accepted
Headers show

Comments

Julien Cristau - April 6, 2016, 8:25 p.m.
# HG changeset patch
# User Julien Cristau <julien.cristau@logilab.fr>
# Date 1459777128 -7200
#      Mon Apr 04 15:38:48 2016 +0200
# Node ID 14688347f01754b9d1c5bd31e59b4966e3335986
# Parent  ea86cdcd9b50bf38c6b9dd7bbaa04b9c8cc0aefb
convert: don't ignore errors from git diff-tree
timeless - April 6, 2016, 8:37 p.m.
can you provide a test for this?

On Wed, Apr 6, 2016 at 4:25 PM, Julien Cristau <jcristau@debian.org> wrote:
> # HG changeset patch
> # User Julien Cristau <julien.cristau@logilab.fr>
> # Date 1459777128 -7200
> #      Mon Apr 04 15:38:48 2016 +0200
> # Node ID 14688347f01754b9d1c5bd31e59b4966e3335986
> # Parent  ea86cdcd9b50bf38c6b9dd7bbaa04b9c8cc0aefb
> convert: don't ignore errors from git diff-tree
>
> diff --git a/hgext/convert/git.py b/hgext/convert/git.py
> --- a/hgext/convert/git.py
> +++ b/hgext/convert/git.py
> @@ -357,6 +357,8 @@ class convert_git(common.converter_sourc
>              output, status = self.gitrunlines('diff-tree', '--name-only',
>                                                '--root', '-r', version,
>                                                '%s^%s' % (version, i + 1), '--')
> +            if status:
> +                raise error.Abort(_('cannot read changes in %s') % version)
>              changes = [f.rstrip('\n') for f in output]
>
>          return changes
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Julien Cristau - April 6, 2016, 9:14 p.m.
On Wed, Apr  6, 2016 at 16:37:34 -0400, timeless wrote:

> can you provide a test for this?
> 
I noticed this by inspection (most other calls to git in
https://selenic.com/hg/rev/cdda7b96afff are error checked).  I'm not
sure I can easily figure out what kind of broken repo would cause this
error.

Cheers,
Julien

> On Wed, Apr 6, 2016 at 4:25 PM, Julien Cristau <jcristau@debian.org> wrote:
> > # HG changeset patch
> > # User Julien Cristau <julien.cristau@logilab.fr>
> > # Date 1459777128 -7200
> > #      Mon Apr 04 15:38:48 2016 +0200
> > # Node ID 14688347f01754b9d1c5bd31e59b4966e3335986
> > # Parent  ea86cdcd9b50bf38c6b9dd7bbaa04b9c8cc0aefb
> > convert: don't ignore errors from git diff-tree
> >
> > diff --git a/hgext/convert/git.py b/hgext/convert/git.py
> > --- a/hgext/convert/git.py
> > +++ b/hgext/convert/git.py
> > @@ -357,6 +357,8 @@ class convert_git(common.converter_sourc
> >              output, status = self.gitrunlines('diff-tree', '--name-only',
> >                                                '--root', '-r', version,
> >                                                '%s^%s' % (version, i + 1), '--')
> > +            if status:
> > +                raise error.Abort(_('cannot read changes in %s') % version)
> >              changes = [f.rstrip('\n') for f in output]
> >
> >          return changes

Patch

diff --git a/hgext/convert/git.py b/hgext/convert/git.py
--- a/hgext/convert/git.py
+++ b/hgext/convert/git.py
@@ -357,6 +357,8 @@  class convert_git(common.converter_sourc
             output, status = self.gitrunlines('diff-tree', '--name-only',
                                               '--root', '-r', version,
                                               '%s^%s' % (version, i + 1), '--')
+            if status:
+                raise error.Abort(_('cannot read changes in %s') % version)
             changes = [f.rstrip('\n') for f in output]
 
         return changes