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.)
--- 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: