[PATCH STABLE] shrink-revlog: preserve mode of the shrunken index and data file
Greg Ward
greg-hg at gerg.ca
Tue Jun 1 17:31:58 CDT 2010
# HG changeset patch
# User Greg Ward <greg-hg at gerg.ca>
# Date 1275431392 14400
# Branch stable
# Node ID d3ebb1a0bc49559e1e41d37f69c2afa06722563e
# Parent 5ce1949be1e3bd7ee3443f494b038d018f498699
shrink-revlog: preserve mode of the shrunken index and data file.
Otherwise, the shrunken index file always has mode 0600 thanks to
mkstemp(). This is annoying on a server, where multiple users may need
to read/write the manifest. chmod()ing the data file is not strictly
necessary, but it's nice for consistency.
diff --git a/contrib/shrink-revlog.py b/contrib/shrink-revlog.py
--- a/contrib/shrink-revlog.py
+++ b/contrib/shrink-revlog.py
@@ -202,9 +202,14 @@
# copy files
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:
+ os.chmod(tmpdatafn, os.stat(datafn).st_mode)
util.rename(tmpdatafn, datafn)
except OSError, inst:
if inst.errno != errno.ENOENT:
More information about the Mercurial-devel
mailing list