Mercurial > hg-stable
changeset 2165:d821918e3bee
Use better names (hg-{usage}-{random}.{suffix}) for temporary files.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Sun, 30 Apr 2006 21:11:22 +0200 |
parents | cbd458228a96 |
children | f5c2c6e69fd7 dd4ec4576cc8 |
files | hgext/gpg.py hgext/patchbomb.py mercurial/appendfile.py mercurial/commands.py mercurial/localrepo.py mercurial/util.py |
diffstat | 6 files changed, 9 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/gpg.py Sun Apr 30 19:30:59 2006 +0200 +++ b/hgext/gpg.py Sun Apr 30 21:11:22 2006 +0200 @@ -23,11 +23,11 @@ """ returns of the good and bad signatures""" try: # create temporary files - fd, sigfile = tempfile.mkstemp(prefix="hggpgsig") + fd, sigfile = tempfile.mkstemp(prefix="hg-gpg-", suffix=".sig") fp = os.fdopen(fd, 'wb') fp.write(sig) fp.close() - fd, datafile = tempfile.mkstemp(prefix="hggpgdata") + fd, datafile = tempfile.mkstemp(prefix="hg-gpg-", suffix=".txt") fp = os.fdopen(fd, 'wb') fp.write(data) fp.close()
--- a/hgext/patchbomb.py Sun Apr 30 19:30:59 2006 +0200 +++ b/hgext/patchbomb.py Sun Apr 30 21:11:22 2006 +0200 @@ -62,7 +62,7 @@ except ImportError: pass def diffstat(patch): - fd, name = tempfile.mkstemp() + fd, name = tempfile.mkstemp(prefix="hg-patchbomb-", suffix=".txt") try: p = popen2.Popen3('diffstat -p1 -w79 2>/dev/null > ' + name) try:
--- a/mercurial/appendfile.py Sun Apr 30 19:30:59 2006 +0200 +++ b/mercurial/appendfile.py Sun Apr 30 21:11:22 2006 +0200 @@ -38,7 +38,7 @@ self.tmpname = tmpname self.tmpfp = open(self.tmpname, 'ab+') else: - fd, self.tmpname = tempfile.mkstemp() + fd, self.tmpname = tempfile.mkstemp(prefix="hg-appendfile-") self.tmpfp = os.fdopen(fd, 'ab+') self.realfp = fp self.offset = fp.tell()
--- a/mercurial/commands.py Sun Apr 30 19:30:59 2006 +0200 +++ b/mercurial/commands.py Sun Apr 30 21:11:22 2006 +0200 @@ -303,7 +303,7 @@ raise util.Abort(_("file '%s' already exists"), filename) fh = open(filename, "wb") else: - fd, filename = tempfile.mkstemp(suffix=".hg", prefix="hg-bundle-") + fd, filename = tempfile.mkstemp(prefix="hg-bundle-", suffix=".hg") fh = os.fdopen(fd, "wb") cleanup = filename
--- a/mercurial/localrepo.py Sun Apr 30 19:30:59 2006 +0200 +++ b/mercurial/localrepo.py Sun Apr 30 21:11:22 2006 +0200 @@ -1824,7 +1824,7 @@ def temp(prefix, node): pre = "%s~%s." % (os.path.basename(fn), prefix) - (fd, name) = tempfile.mkstemp("", pre) + (fd, name) = tempfile.mkstemp(prefix=pre) f = os.fdopen(fd, "wb") self.wwrite(fn, fl.read(node), f) f.close()
--- a/mercurial/util.py Sun Apr 30 19:30:59 2006 +0200 +++ b/mercurial/util.py Sun Apr 30 21:11:22 2006 +0200 @@ -46,11 +46,11 @@ the temporary files generated.''' inname, outname = None, None try: - infd, inname = tempfile.mkstemp(prefix='hgfin') + infd, inname = tempfile.mkstemp(prefix='hg-filter-in-') fp = os.fdopen(infd, 'wb') fp.write(s) fp.close() - outfd, outname = tempfile.mkstemp(prefix='hgfout') + outfd, outname = tempfile.mkstemp(prefix='hg-filter-out-') os.close(outfd) cmd = cmd.replace('INFILE', inname) cmd = cmd.replace('OUTFILE', outname) @@ -464,7 +464,7 @@ def mktempcopy(name): d, fn = os.path.split(name) - fd, temp = tempfile.mkstemp(prefix=fn, dir=d) + fd, temp = tempfile.mkstemp(prefix=".%s-" % fn, dir=d) fp = os.fdopen(fd, "wb") try: fp.write(file(name, "rb").read())