Changeset - 48727add84c9
[Not reviewed]
default
1 7 1
Marcin Kuzminski - 15 years ago 2010-05-30 22:08:21
marcin@python-works.com
Made repos path config configurable from pylons app configs. update Readme
8 files changed with 19 insertions and 8 deletions:
0 comments (0 inline, 0 general)
README.txt
Show inline comments
 
@@ -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
development.ini
Show inline comments
 
@@ -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        ####
production.ini
Show inline comments
 
@@ -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        ####
pylons_app/lib/app_globals.py
Show inline comments
 
@@ -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 = {}
pylons_app/lib/backup_manager.py
Show inline comments
 
@@ -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()
pylons_app/lib/middleware/simplehg.py
Show inline comments
 
@@ -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)
pylons_app/lib/utils.py
Show inline comments
 
@@ -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
repositories.config
Show inline comments
 
file renamed from hgwebdir.config to repositories.config
0 comments (0 inline, 0 general)