[PATCH V3] largefiles: replace tempfile.NamedTemporaryFile with tempfile.mkstemp

Greg Ward greg-hg at gerg.ca
Sun Oct 30 18:52:32 CDT 2011


On Thu, Oct 27, 2011 at 11:03 AM, Hao Lian <hao at fogcreek.com> wrote:
> # HG changeset patch
> # User Hao Lian <hao at fogcreek.com>
> # Date 1319145899 14400
> # Branch stable
> # Node ID 724db0c36c67a07581deaf8b7567fc3a8542523f
> # Parent  8fee2bc0d35916dd38231e97bfa7ef77f53b215d
> largefiles: replace tempfile.NamedTemporaryFile with tempfile.mkstemp

Better, but still one little nit...
> +def mkstemp(repo, prefix):
> +    '''Returns a file descriptor and a filename corresponding to a temporary
> +    file in the repo's largefiles store.'''
> +    path = repo.join(longname)
> +    util.makedirs(repo.join(path))
> +    return tempfile.mkstemp(prefix=prefix, dir=path)

...you're calling repo.join() twice on effectively the same path. Wouldn't

  util.makedirs(path)

have exactly the same effect as your version?

Greg


More information about the Mercurial-devel mailing list