[PATCH 3 of 5] largefiles: remove a standin check that could never be true

Matt Harbison matt_harbison at yahoo.com
Thu Jun 21 07:55:04 CDT 2012


Na'Tosha Bard wrote:
> 2012/6/20 Matt Harbison <matt_harbison at yahoo.com
> <mailto:matt_harbison at yahoo.com>>
>
>     # HG changeset patch
>     # User Matt Harbison <matt_harbison at yahoo.com
>     <mailto:matt_harbison at yahoo.com>>
>     # Date 1340073921 14400
>     # Node ID f4bc770430b15cdabf07676f5ae1d6611696aba2
>     # Parent  0588cf50d6e8b4c06d4263418ef3b1dcc87a2bf8
>     largefiles: remove a standin check that could never be true
>
>     diff --git a/hgext/largefiles/overrides.py
>     b/hgext/largefiles/overrides.py
>     --- a/hgext/largefiles/overrides.py
>     +++ b/hgext/largefiles/overrides.py
>     @@ -818,8 +818,6 @@
>          lfcommands.cachelfiles(ui, repo._repo, ctx.node())
>
>          def write(name, mode, islink, getdata):
>     -        if lfutil.isstandin(name):
>     -            return
>              data = getdata()
>
>              archiver.addfile(prefix + repo._path + '/' + name, mode,
>     islink, data)
>
>
> Without a larger context from the diff, it is hard to tell -- why could
> this never be true?  Simply because there is no codepath that calls
> write() with a standin?
>
> Cheers,
> Na'Tosha
>

The calling code is basically:

     for f in ctx:
         ff = ctx.flags(f)
         getdata = ctx[f].data
         if lfutil.isstandin(f):
             ...
             f = lfutil.splitstandin(f)

             def getdatafn():
                 ## read largefile content

             getdata = getdatafn

         write(f, 'x' in ff and 0755 or 0644, 'l' in ff, getdata)

So any standin 'f' has been replaced by the time write() is called.  I'm 
not sure what I was originally thinking, because I basically pilfered 
the code for the original patch from the override of archival.archive(), 
which doesn't do that check either.

Thanks for the reviews.

--Matt



More information about the Mercurial-devel mailing list