Mercurial > hg
diff contrib/shrink-revlog.py @ 11294:7b5d05e0fb1e
shrink-revlog: use util.mktempcopy() to preserve mode of index file.
(There's still a chmod() call to manually preserve the mode of the
data file.)
author | Greg Ward <greg-hg@gerg.ca> |
---|---|
date | Thu, 03 Jun 2010 10:18:33 -0400 |
parents | f73baa069113 |
children | 3e46d76eaabf |
line wrap: on
line diff
--- a/contrib/shrink-revlog.py Sat Jun 05 09:58:02 2010 -0500 +++ b/contrib/shrink-revlog.py Thu Jun 03 10:18:33 2010 -0400 @@ -190,10 +190,7 @@ ui.write(_('shrinking %s\n') % indexfn) prefix = os.path.basename(indexfn)[:-1] - (tmpfd, tmpindexfn) = tempfile.mkstemp(dir=os.path.dirname(indexfn), - prefix=prefix, - suffix='.i') - os.close(tmpfd) + tmpindexfn = util.mktempcopy(indexfn, emptyok=True) r1 = revlog.revlog(util.opener(os.getcwd(), audit=False), indexfn) r2 = revlog.revlog(util.opener(os.getcwd(), audit=False), tmpindexfn) @@ -255,9 +252,6 @@ util.os_link(indexfn, oldindexfn) ignoremissing(util.os_link)(datafn, olddatafn) - # mkstemp() creates files only readable by the owner - os.chmod(tmpindexfn, os.stat(indexfn).st_mode) - # rename util.rename(tmpindexfn, indexfn) try: