changeset 11267:d3ebb1a0bc49 stable

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.
author Greg Ward <greg-hg@gerg.ca>
date Tue, 01 Jun 2010 18:29:52 -0400
parents 5ce1949be1e3
children f73baa069113 05ac42e56452
files contrib/shrink-revlog.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/shrink-revlog.py	Tue Jun 01 10:54:03 2010 -0500
+++ b/contrib/shrink-revlog.py	Tue Jun 01 18:29:52 2010 -0400
@@ -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: