##// END OF EJS Templates
shrink-revlog: use util.mktempcopy() to preserve mode of index file....
Greg Ward -
r11294:7b5d05e0 default
parent child Browse files
Show More
@@ -190,10 +190,7 b' def shrink(ui, repo, **opts):'
190
190
191 ui.write(_('shrinking %s\n') % indexfn)
191 ui.write(_('shrinking %s\n') % indexfn)
192 prefix = os.path.basename(indexfn)[:-1]
192 prefix = os.path.basename(indexfn)[:-1]
193 (tmpfd, tmpindexfn) = tempfile.mkstemp(dir=os.path.dirname(indexfn),
193 tmpindexfn = util.mktempcopy(indexfn, emptyok=True)
194 prefix=prefix,
195 suffix='.i')
196 os.close(tmpfd)
197
194
198 r1 = revlog.revlog(util.opener(os.getcwd(), audit=False), indexfn)
195 r1 = revlog.revlog(util.opener(os.getcwd(), audit=False), indexfn)
199 r2 = revlog.revlog(util.opener(os.getcwd(), audit=False), tmpindexfn)
196 r2 = revlog.revlog(util.opener(os.getcwd(), audit=False), tmpindexfn)
@@ -255,9 +252,6 b' def shrink(ui, repo, **opts):'
255 util.os_link(indexfn, oldindexfn)
252 util.os_link(indexfn, oldindexfn)
256 ignoremissing(util.os_link)(datafn, olddatafn)
253 ignoremissing(util.os_link)(datafn, olddatafn)
257
254
258 # mkstemp() creates files only readable by the owner
259 os.chmod(tmpindexfn, os.stat(indexfn).st_mode)
260
261 # rename
255 # rename
262 util.rename(tmpindexfn, indexfn)
256 util.rename(tmpindexfn, indexfn)
263 try:
257 try:
General Comments 0
You need to be logged in to leave comments. Login now