# HG changeset patch # User Alexis S. L. Carvalho # Date 1202589534 7200 # Node ID 53ed9b40cfc497c81cea29c457605f66407a2bad # Parent c608f67a87c0a419ef40ca4485f9e8ee684b401f make the journal/undo files from transactions inherit the mode from .hg/store diff -r c608f67a87c0 -r 53ed9b40cfc4 mercurial/localrepo.py --- a/mercurial/localrepo.py Sat Feb 09 18:38:54 2008 -0200 +++ b/mercurial/localrepo.py Sat Feb 09 18:38:54 2008 -0200 @@ -78,6 +78,7 @@ except OSError: mode = None + self._createmode = mode self.opener.createmode = mode sopener = util.opener(self.spath) sopener.createmode = mode @@ -563,8 +564,9 @@ (self.join("journal.dirstate"), self.join("undo.dirstate")), (self.join("journal.branch"), self.join("undo.branch"))] tr = transaction.transaction(self.ui.warn, self.sopener, - self.sjoin("journal"), - aftertrans(renames)) + self.sjoin("journal"), + aftertrans(renames), + self._createmode) self._transref = weakref.ref(tr) return tr diff -r c608f67a87c0 -r 53ed9b40cfc4 mercurial/transaction.py --- a/mercurial/transaction.py Sat Feb 09 18:38:54 2008 -0200 +++ b/mercurial/transaction.py Sat Feb 09 18:38:54 2008 -0200 @@ -15,7 +15,7 @@ import os class transaction(object): - def __init__(self, report, opener, journal, after=None): + def __init__(self, report, opener, journal, after=None, createmode=None): self.journal = None self.count = 1 @@ -27,6 +27,8 @@ self.journal = journal self.file = open(self.journal, "w") + if createmode is not None: + os.chmod(self.journal, createmode & 0666) def __del__(self): if self.journal: diff -r c608f67a87c0 -r 53ed9b40cfc4 tests/test-inherit-mode --- a/tests/test-inherit-mode Sat Feb 09 18:38:54 2008 -0200 +++ b/tests/test-inherit-mode Sat Feb 09 18:38:54 2008 -0200 @@ -48,7 +48,7 @@ echo '% after commit' echo '% working dir files can only be written by the owner' echo '% files created in .hg can be written by the group' -echo '% (in particular, store/**, dirstate, branch.cache)' +echo '% (in particular, store/**, dirstate, branch.cache, undo files)' echo '% new directories are setgid' python ../printmodes.py . diff -r c608f67a87c0 -r 53ed9b40cfc4 tests/test-inherit-mode.out --- a/tests/test-inherit-mode.out Sat Feb 09 18:38:54 2008 -0200 +++ b/tests/test-inherit-mode.out Sat Feb 09 18:38:54 2008 -0200 @@ -9,7 +9,7 @@ % after commit % working dir files can only be written by the owner % files created in .hg can be written by the group -% (in particular, store/**, dirstate, branch.cache) +% (in particular, store/**, dirstate, branch.cache, undo files) % new directories are setgid 00700 ./.hg/ 00600 ./.hg/00changelog.i @@ -22,7 +22,7 @@ 02770 ./.hg/store/data/dir/ 00660 ./.hg/store/data/dir/bar.i 00660 ./.hg/store/data/foo.i -00600 ./.hg/store/undo +00660 ./.hg/store/undo 00660 ./.hg/undo.branch 00660 ./.hg/undo.dirstate 00700 ./dir/ @@ -49,6 +49,6 @@ 00770 ../push/.hg/store/data/dir/ 00660 ../push/.hg/store/data/dir/bar.i 00660 ../push/.hg/store/data/foo.i -00600 ../push/.hg/store/undo +00660 ../push/.hg/store/undo 00660 ../push/.hg/undo.branch 00660 ../push/.hg/undo.dirstate