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