[PATCH] lfcommands.py crashes if 'path' is None

Matt Mackall mpm at selenic.com
Tue Sep 18 16:30:51 CDT 2012


On Tue, 2012-09-18 at 15:01 +0200, Christian Tismer wrote:
> # HG changeset patch
> # User Christian Tismer  <tismer at stackless.com>
> # Date 1347972429 -7200
> # Branch stable
> # Node ID a110a7be04aa27291ed93f295b718877a3c3e6e6
> # Parent  495d3c671a8b01f19d5bfdafbbba908331d98879
> This code crashes if 'path' is None.
> Made it conditional to skip this case.

This page describes our commit message format:

http://mercurial.selenic.com/wiki/ContributingChanges

> diff -r 495d3c671a8b -r a110a7be04aa hgext/largefiles/lfcommands.py
> --- a/hgext/largefiles/lfcommands.py    Mon Sep 17 15:13:03 2012 -0500
> +++ b/hgext/largefiles/lfcommands.py    Tue Sep 18 14:47:09 2012 +0200
> @@ -145,8 +145,9 @@
>               data = ''
>               fd = None
>               try:
> -                fd = open(path, 'rb')
> -                data = fd.read()
> +                if path:
> +                    fd = open(path, 'rb')
> +                    data = fd.read()

This is almost certainly not the right fix. path = None is probably
indicative of a bug somewhere else, that this change papers over.
Applying this change would, if anything, make it less likely that the
real issue would be addressed.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list