[PATCH] largefiles: correctly catch exception on localized systems (issue3196)

Na'Tosha Bard natosha at unity3d.com
Fri Jan 13 03:56:05 CST 2012


2012/1/12 Matt Mackall <mpm at selenic.com>

> On Thu, 2012-01-12 at 14:35 +0100, Na'Tosha Bard wrote:
> > 2012/1/12 Mads Kiilerich <mads at kiilerich.com>
> >
> > > On 01/12/2012 02:13 PM, Na'Tosha Bard wrote:
> > >
> > >> # HG changeset patch
> > >> # User Na'Tosha Bard<natosha at unity3d.com>
> > >> # Date 1326373926 -3600
> > >> # Node ID 88edae221c023d2073f4e2d45b120f**76766c73ef
> > >> # Parent  c47d69ce5208d5b5cfd2fb2f0f1d7a**2b4795fbf5
> > >> largefiles: correctly catch exception on localized systems (issue3196)
> > >>
> > >> diff -r c47d69ce5208 -r 88edae221c02 hgext/largefiles/overrides.py
> > >> --- a/hgext/largefiles/overrides.**py     Wed Jan 11 09:27:53 2012
> -0600
> > >> +++ b/hgext/largefiles/overrides.**py     Thu Jan 12 14:12:06 2012
> +0100
> > >> @@ -413,7 +413,7 @@
> > >>              installnormalfilesmatchfn(**repo[None].manifest())
> > >>              result = orig(ui, repo, pats, opts, rename)
> > >>          except util.Abort, e:
> > >> -            if str(e) != 'no files to copy':
> > >> +            if str(e) != _('no files to copy'):
> > >>                  raise e
> > >>              else:
> > >>                  nonormalfiles = True
> > >> @@ -500,7 +500,7 @@
> > >>                      lfdirstate.add(destlfile)
> > >>              lfdirstate.write()
> > >>          except util.Abort, e:
> > >> -            if str(e) != 'no files to copy':
> > >> +            if str(e) != _('no files to copy'):
> > >>
> > >
> > > I agree that this needs to fixed - it is the most ugly spot in the
> whole
> > > Mercurial code base. But papering it over like this is at most an
> temporary
> > > workaround - not a solution.
> > >
> > > It might have been the best way to get the job done back when it had to
> > > work with existing Mercurial versions, but now when it is distributed
> with
> > > Mercurial we should have a proper solution - possibly by modifying core
> > > Mercurial so the extension has a chance to handle it decently.
>
> > If you have pointers on how to fix it in a more proper way, then I'm all
> > ears.  I am pretty sure the largefiles extension is not considered
> > important enough to get any special treatment in core Mercurial, though.
>
> After spending a few minutes staring at it, my suggestion is:
>
> try:
>    result += orig(ui, repo, listpats, opts, rename)
> finally:
>    if copiedfiles:
>         # do post-processing
>
> ..and make no attempt to inspect/handle exceptions directly.
>

Alrighty, I will make a new patch and re-send it.  Ignore this one.

Cheers,
Na'Tosha

-- 
*Na'Tosha Bard*
Build & Infrastructure Developer | Unity Technologies - Copenhagen

*E-Mail:* natosha at unity3d.com
*Skype:* natosha.bard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20120113/d8f7e64f/attachment.html>


More information about the Mercurial-devel mailing list