diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -78,6 +78,7 @@ class localrepository(repo.repository): except OSError: mode = None + self._createmode = mode self.opener.createmode = mode sopener = util.opener(self.spath) sopener.createmode = mode @@ -563,8 +564,9 @@ class localrepository(repo.repository): (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 --git a/mercurial/transaction.py b/mercurial/transaction.py --- a/mercurial/transaction.py +++ b/mercurial/transaction.py @@ -15,7 +15,7 @@ from i18n import _ 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 @@ class transaction(object): 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 --git a/tests/test-inherit-mode b/tests/test-inherit-mode --- a/tests/test-inherit-mode +++ b/tests/test-inherit-mode @@ -48,7 +48,7 @@ echo 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 --git a/tests/test-inherit-mode.out b/tests/test-inherit-mode.out --- a/tests/test-inherit-mode.out +++ b/tests/test-inherit-mode.out @@ -9,7 +9,7 @@ 02770 ./.hg/store/ % 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/ 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/ 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