diff --git a/README.txt b/README.txt --- a/README.txt +++ b/README.txt @@ -16,3 +16,9 @@ with authentication, permissions. Based 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 --git a/development.ini b/development.ini --- a/development.ini +++ b/development.ini @@ -40,6 +40,7 @@ lang=en cache_dir = %(here)s/data ##a name for our application hg_app_name = Python-works +hg_app_repo_conf = repositories.config #################################### ### BEAKER CACHE #### diff --git a/production.ini b/production.ini --- a/production.ini +++ b/production.ini @@ -40,6 +40,7 @@ lang=en cache_dir = %(here)s/data ##a name for our application hg_app_name = Python-works +hg_app_repo_conf = repositories.config #################################### ### BEAKER CACHE #### diff --git a/pylons_app/lib/app_globals.py b/pylons_app/lib/app_globals.py --- a/pylons_app/lib/app_globals.py +++ b/pylons_app/lib/app_globals.py @@ -18,7 +18,7 @@ class Globals(object): """ 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 --git a/pylons_app/lib/backup_manager.py b/pylons_app/lib/backup_manager.py --- a/pylons_app/lib/backup_manager.py +++ b/pylons_app/lib/backup_manager.py @@ -10,19 +10,19 @@ logging.basicConfig(level=logging.DEBUG, 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 @@ class BackupManager(object): 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 --git a/pylons_app/lib/middleware/simplehg.py b/pylons_app/lib/middleware/simplehg.py --- a/pylons_app/lib/middleware/simplehg.py +++ b/pylons_app/lib/middleware/simplehg.py @@ -56,7 +56,7 @@ class SimpleHg(object): #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 --git a/pylons_app/lib/utils.py b/pylons_app/lib/utils.py --- a/pylons_app/lib/utils.py +++ b/pylons_app/lib/utils.py @@ -46,12 +46,15 @@ def check_repo(repo_name, base_path): #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 --git a/hgwebdir.config b/repositories.config rename from hgwebdir.config rename to repositories.config