Show More
@@ -16,3 +16,9 b' with authentication, permissions. Based ' | |||
|
16 | 16 | This software is still in beta mode. I don't guarantee that it'll work. |
|
17 | 17 | I started this project since i was tired of sad looks, and zero controll over |
|
18 | 18 | our company regular hgwebdir. |
|
19 | ||
|
20 | ||
|
21 | == INSTALATION | |
|
22 | run dbmanage.py from pylons_app/lib it should create all needed table and | |
|
23 | an admin account, Edit file repositories.config and change the path for you | |
|
24 | mercurial repositories, remember about permissions. No newline at end of file |
@@ -40,6 +40,7 b' lang=en' | |||
|
40 | 40 | cache_dir = %(here)s/data |
|
41 | 41 | ##a name for our application |
|
42 | 42 | hg_app_name = Python-works |
|
43 | hg_app_repo_conf = repositories.config | |
|
43 | 44 | |
|
44 | 45 | #################################### |
|
45 | 46 | ### BEAKER CACHE #### |
@@ -40,6 +40,7 b' lang=en' | |||
|
40 | 40 | cache_dir = %(here)s/data |
|
41 | 41 | ##a name for our application |
|
42 | 42 | hg_app_name = Python-works |
|
43 | hg_app_repo_conf = repositories.config | |
|
43 | 44 | |
|
44 | 45 | #################################### |
|
45 | 46 | ### BEAKER CACHE #### |
@@ -18,7 +18,7 b' class Globals(object):' | |||
|
18 | 18 | |
|
19 | 19 | """ |
|
20 | 20 | self.cache = CacheManager(**parse_cache_config_options(config)) |
|
21 |
self.baseui = make_ui('hg |
|
|
21 | self.baseui = make_ui(config['hg_app_repo_conf']) | |
|
22 | 22 | self.paths = self.baseui.configitems('paths') |
|
23 | 23 | self.base_path = self.paths[0][1].replace('*', '') |
|
24 | 24 | self.changeset_annotation_colors = {} |
@@ -10,19 +10,19 b' logging.basicConfig(level=logging.DEBUG,' | |||
|
10 | 10 | format="%(asctime)s %(levelname)-5.5s %(message)s") |
|
11 | 11 | |
|
12 | 12 | class BackupManager(object): |
|
13 | def __init__(self): | |
|
13 | def __init__(self, id_rsa_path, repo_conf): | |
|
14 | 14 | self.repos_path = None |
|
15 | 15 | self.backup_file_name = None |
|
16 |
self.id_rsa_path = |
|
|
16 | self.id_rsa_path = id_rsa_path | |
|
17 | 17 | self.check_id_rsa() |
|
18 | 18 | cur_dir = os.path.realpath(__file__) |
|
19 | 19 | dn = os.path.dirname |
|
20 | 20 | self.backup_file_path = os.path.join(dn(dn(dn(cur_dir))), 'data') |
|
21 | 21 | cfg = config.config() |
|
22 | 22 | try: |
|
23 |
cfg.read(os.path.join(dn(dn(dn(cur_dir))), |
|
|
23 | cfg.read(os.path.join(dn(dn(dn(cur_dir))), repo_conf)) | |
|
24 | 24 | except IOError: |
|
25 |
logging.error('Could not read |
|
|
25 | logging.error('Could not read %s', repo_conf) | |
|
26 | 26 | sys.exit() |
|
27 | 27 | self.set_repos_path(cfg.items('paths')) |
|
28 | 28 | logging.info('starting backup for %s', self.repos_path) |
@@ -80,7 +80,7 b' class BackupManager(object):' | |||
|
80 | 80 | |
|
81 | 81 | |
|
82 | 82 | if __name__ == "__main__": |
|
83 | B_MANAGER = BackupManager() | |
|
83 | B_MANAGER = BackupManager('/home/pylons/id_rsa', 'repositories.config') | |
|
84 | 84 | B_MANAGER.backup_repos() |
|
85 | 85 | B_MANAGER.transfer_files() |
|
86 | 86 | B_MANAGER.rm_file() |
@@ -56,7 +56,7 b' class SimpleHg(object):' | |||
|
56 | 56 | |
|
57 | 57 | #since we wrap into hgweb, just reset the path |
|
58 | 58 | environ['PATH_INFO'] = '/' |
|
59 | self.baseui = make_ui() | |
|
59 | self.baseui = make_ui(self.config['hg_app_repo_conf']) | |
|
60 | 60 | self.basepath = self.baseui.configitems('paths')[0][1]\ |
|
61 | 61 | .replace('*', '') |
|
62 | 62 | self.repo_path = os.path.join(self.basepath, repo_name) |
@@ -46,12 +46,15 b' def check_repo(repo_name, base_path):' | |||
|
46 | 46 | #it means that there is no valid repo there... |
|
47 | 47 | return True |
|
48 | 48 | |
|
49 |
def make_ui(path= |
|
|
49 | def make_ui(path=None, checkpaths=True): | |
|
50 | 50 | """ |
|
51 | 51 | A funcion that will read python rc files and make an ui from read options |
|
52 | 52 | |
|
53 | 53 | @param path: path to mercurial config file |
|
54 | 54 | """ |
|
55 | if not path: | |
|
56 | log.error('repos config path is empty !') | |
|
57 | ||
|
55 | 58 | if not os.path.isfile(path): |
|
56 | 59 | log.warning('Unable to read config file %s' % path) |
|
57 | 60 | return False |
|
1 | NO CONTENT: file renamed from hgwebdir.config to repositories.config |
General Comments 0
You need to be logged in to leave comments.
Login now