On Wed, 2005-08-31 at 08:37 -0700, TK Soh wrote:
> I made a few changes including use of mkstemp(), but I am not sure what you
> really mean with f.name. See if this patch is better.
It is, thanks. Still a few bits, though.
> + for patch in patches:
> + ui.status("applying %s\n" % patch)
> + pf = os.path.join(d, patch)
> + splits = []
> + if opts['csplit']:
> + splits = splitpatch(pf)
> + if splits:
> + if len(splits) > 1:
> + ui.status("found %d Hg patches in %s\n" % (len(splits), pf))
> + try:
> + for spl in splits:
> + do_import(spl)
> + os.unlink(spl)
> + except:
> + for spl in splits:
> + os.unlink(spl)
> + raise
> + else:
> + do_import(pf)
You're not cleaning up the temporary file if only one patch is
generated.
The inner try/except block should get hoisted up la level of scope, and
get turned into try/finally. You only need to clean up the temp files
in one place.
<b
|