# HG changeset patch # User Marcin Kuzminski # Date 1275250101 -7200 # Node ID 48727add84c9ce4c2abacb3e7bc2b5d1861fe8d6 # Parent 7c4fa2a66195e04f31d196dd4fe73c30b4df2a40 Made repos path config configurable from pylons app configs. update Readme diff -r 7c4fa2a66195 -r 48727add84c9 README.txt --- a/README.txt Sun May 30 21:30:09 2010 +0200 +++ b/README.txt Sun May 30 22:08:21 2010 +0200 @@ -16,3 +16,9 @@ This software is still in beta mode. I don't guarantee that it'll work. I started this project since i was tired of sad looks, and zero controll over our company regular hgwebdir. + + +== INSTALATION +run dbmanage.py from pylons_app/lib it should create all needed table and +an admin account, Edit file repositories.config and change the path for you +mercurial repositories, remember about permissions. \ No newline at end of file diff -r 7c4fa2a66195 -r 48727add84c9 development.ini --- a/development.ini Sun May 30 21:30:09 2010 +0200 +++ b/development.ini Sun May 30 22:08:21 2010 +0200 @@ -40,6 +40,7 @@ cache_dir = %(here)s/data ##a name for our application hg_app_name = Python-works +hg_app_repo_conf = repositories.config #################################### ### BEAKER CACHE #### diff -r 7c4fa2a66195 -r 48727add84c9 hgwebdir.config --- a/hgwebdir.config Sun May 30 21:30:09 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -[hooks] -#to do push with autoupdate -changegroup = hg update >&2 - -[extensions] -hgext.highlight= -#hgk= - -[web] -push_ssl = false -allow_archive = gz zip bz2 -allow_push = * -baseurl = / - -[paths] -/ = /home/marcink/python_workspace/** diff -r 7c4fa2a66195 -r 48727add84c9 production.ini --- a/production.ini Sun May 30 21:30:09 2010 +0200 +++ b/production.ini Sun May 30 22:08:21 2010 +0200 @@ -40,6 +40,7 @@ cache_dir = %(here)s/data ##a name for our application hg_app_name = Python-works +hg_app_repo_conf = repositories.config #################################### ### BEAKER CACHE #### diff -r 7c4fa2a66195 -r 48727add84c9 pylons_app/lib/app_globals.py --- a/pylons_app/lib/app_globals.py Sun May 30 21:30:09 2010 +0200 +++ b/pylons_app/lib/app_globals.py Sun May 30 22:08:21 2010 +0200 @@ -18,7 +18,7 @@ """ self.cache = CacheManager(**parse_cache_config_options(config)) - self.baseui = make_ui('hgwebdir.config') + self.baseui = make_ui(config['hg_app_repo_conf']) self.paths = self.baseui.configitems('paths') self.base_path = self.paths[0][1].replace('*', '') self.changeset_annotation_colors = {} diff -r 7c4fa2a66195 -r 48727add84c9 pylons_app/lib/backup_manager.py --- a/pylons_app/lib/backup_manager.py Sun May 30 21:30:09 2010 +0200 +++ b/pylons_app/lib/backup_manager.py Sun May 30 22:08:21 2010 +0200 @@ -10,19 +10,19 @@ format="%(asctime)s %(levelname)-5.5s %(message)s") class BackupManager(object): - def __init__(self): + def __init__(self, id_rsa_path, repo_conf): self.repos_path = None self.backup_file_name = None - self.id_rsa_path = '/home/pylons/id_rsa' + self.id_rsa_path = id_rsa_path self.check_id_rsa() cur_dir = os.path.realpath(__file__) dn = os.path.dirname self.backup_file_path = os.path.join(dn(dn(dn(cur_dir))), 'data') cfg = config.config() try: - cfg.read(os.path.join(dn(dn(dn(cur_dir))), 'hgwebdir.config')) + cfg.read(os.path.join(dn(dn(dn(cur_dir))), repo_conf)) except IOError: - logging.error('Could not read hgwebdir.config') + logging.error('Could not read %s', repo_conf) sys.exit() self.set_repos_path(cfg.items('paths')) logging.info('starting backup for %s', self.repos_path) @@ -80,7 +80,7 @@ if __name__ == "__main__": - B_MANAGER = BackupManager() + B_MANAGER = BackupManager('/home/pylons/id_rsa', 'repositories.config') B_MANAGER.backup_repos() B_MANAGER.transfer_files() B_MANAGER.rm_file() diff -r 7c4fa2a66195 -r 48727add84c9 pylons_app/lib/middleware/simplehg.py --- a/pylons_app/lib/middleware/simplehg.py Sun May 30 21:30:09 2010 +0200 +++ b/pylons_app/lib/middleware/simplehg.py Sun May 30 22:08:21 2010 +0200 @@ -56,7 +56,7 @@ #since we wrap into hgweb, just reset the path environ['PATH_INFO'] = '/' - self.baseui = make_ui() + self.baseui = make_ui(self.config['hg_app_repo_conf']) self.basepath = self.baseui.configitems('paths')[0][1]\ .replace('*', '') self.repo_path = os.path.join(self.basepath, repo_name) diff -r 7c4fa2a66195 -r 48727add84c9 pylons_app/lib/utils.py --- a/pylons_app/lib/utils.py Sun May 30 21:30:09 2010 +0200 +++ b/pylons_app/lib/utils.py Sun May 30 22:08:21 2010 +0200 @@ -46,12 +46,15 @@ #it means that there is no valid repo there... return True -def make_ui(path='hgwebdir.config', checkpaths=True): +def make_ui(path=None, checkpaths=True): """ A funcion that will read python rc files and make an ui from read options @param path: path to mercurial config file """ + if not path: + log.error('repos config path is empty !') + if not os.path.isfile(path): log.warning('Unable to read config file %s' % path) return False diff -r 7c4fa2a66195 -r 48727add84c9 repositories.config --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/repositories.config Sun May 30 22:08:21 2010 +0200 @@ -0,0 +1,16 @@ +[hooks] +#to do push with autoupdate +changegroup = hg update >&2 + +[extensions] +hgext.highlight= +#hgk= + +[web] +push_ssl = false +allow_archive = gz zip bz2 +allow_push = * +baseurl = / + +[paths] +/ = /home/marcink/python_workspace/**