Mercurial > hgweb.cgi > hwm
changeset 14:5180b80b0dd1
Fixed problem with loosing read permissions. IN: -
author | John Schneiderman <JohnMS@CodeGNU.com> |
---|---|
date | Sat, 26 Jul 2014 14:43:35 -0500 |
parents | b09caec3d202 |
children | 22a0c93c7c25 |
files | src/manager.py |
diffstat | 1 files changed, 10 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/manager.py Sat Jul 26 14:42:31 2014 -0500 +++ b/src/manager.py Sat Jul 26 14:43:35 2014 -0500 @@ -62,13 +62,17 @@ print "Wrote repository details." else: print >>sys.stderr, "Failed to write repository details." - os.chmod(settings.RepositoryPath + os.sep + repository.StorageName + os.sep + ".hg" + os.sep + "hgrc", stat.S_IWRITE) + os.chmod(settings.RepositoryPath + os.sep + repository.StorageName + os.sep + '.hg' + os.sep + "hgrc", stat.S_IWRITE) shutil.rmtree(settings.RepositoryPath + os.sep + repository.StorageName) return False if not register(repository): - os.chmod(settings.RepositoryPath + os.sep + repository.StorageName + os.sep + ".hg" + os.sep + "hgrc", stat.S_IWRITE) + os.chmod(settings.RepositoryPath + os.sep + repository.StorageName + os.sep + '.hg' + os.sep + "hgrc", stat.S_IWRITE) shutil.rmtree(settings.RepositoryPath + os.sep + repository.StorageName) + return False + else: + print 'Repository generated.' + return True def register(repository): """ Connects an existing repository to the mercurial web registry. @@ -280,7 +284,7 @@ import os import stat - os.chmod(settings.RepositoryPath + os.sep + repo.StorageName + os.sep + ".hg" + os.sep + "hgrc", stat.S_IWRITE) + os.chmod(settings.RepositoryPath + os.sep + repo.StorageName + os.sep + '.hg' + os.sep + "hgrc", stat.S_IWRITE) shutil.rmtree(settings.RepositoryPath + os.sep + repo.StorageName) return True @@ -322,12 +326,12 @@ import stat import sys - config = settings.RepositoryPath + os.sep + repo.StorageName + os.sep + ".hg" + os.sep + "hgrc" + config = settings.RepositoryPath + os.sep + repo.StorageName + os.sep + '.hg' + os.sep + "hgrc" if os.path.exists(config): hgrcMode = os.stat(config)[stat.ST_MODE] os.chmod(config, hgrcMode | stat.S_IWRITE) else: - hgrcMode = stat.S_IRUSR & stat.S_IRGRP & stat.S_IROTH + hgrcMode = stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH with open(config, "w") as hgrc: hgrc.write("[web]\n") @@ -343,7 +347,7 @@ if repo.Contact is not None: hgrc.write("contact = " + repo.Contact + '\n') # Ensure the repository details isn't accidentally modified. - os.chmod(config, hgrcMode & ~stat.S_IWUSR & ~stat.S_IWGRP & ~stat.S_IWOTH) + os.chmod(config, hgrcMode & (~stat.S_IWUSR & ~stat.S_IWGRP & ~stat.S_IWOTH)) # Ensure the repository isn't accidentally deleted, moved, or blocked. if "win32" == sys.platform: