allura
修訂 | 9942793c2cf8a8d5b85949bc75c213e9597d26ba (tree) |
---|---|
時間 | 2010-05-19 22:25:05 |
作者 | Rick Copeland <rcopeland@geek...> |
Commiter | Rick Copeland |
Add neighborhood prefixes to all repository paths
@@ -108,12 +108,10 @@ class ForgeGitApp(Application): | ||
108 | 108 | create=[role_developer], |
109 | 109 | write=[role_developer], |
110 | 110 | admin=c.project.acl['tool']) |
111 | - repo = model.GitRepository() | |
112 | - repo.name = self.config.options.mount_point + '.git' | |
113 | - repo.fs_path = '/git/' + c.project.shortname + '/' | |
114 | - repo.url_path = '/' + c.project.shortname + '/' | |
115 | - repo.tool = 'git' | |
116 | - repo.status = 'initing' | |
111 | + repo = model.GitRepository( | |
112 | + name=self.config.options.mount_point + '.git', | |
113 | + tool='git', | |
114 | + status='initing') | |
117 | 115 | ThreadLocalORMSession.flush_all() |
118 | 116 | cloned_from_id = self.config.options.get('cloned_from') |
119 | 117 | if cloned_from_id is not None: |
@@ -110,12 +110,10 @@ class ForgeHgApp(Application): | ||
110 | 110 | write=[role_developer], |
111 | 111 | create=[role_developer], |
112 | 112 | admin=c.project.acl['tool']) |
113 | - repo = model.HgRepository() | |
114 | - repo.name = self.config.options.mount_point | |
115 | - repo.fs_path = '/hg/' + c.project.shortname + '/' | |
116 | - repo.url_path = '/' + c.project.shortname + '/' | |
117 | - repo.tool = 'hg' | |
118 | - repo.status = 'initing' | |
113 | + repo = model.HgRepository( | |
114 | + name=self.config.options.mount_point, | |
115 | + tool='hg', | |
116 | + status='initing') | |
119 | 117 | ThreadLocalORMSession.flush_all() |
120 | 118 | cloned_from_id = self.config.options.get('cloned_from') |
121 | 119 | if cloned_from_id is not None: |
@@ -92,8 +92,6 @@ class ForgeSVNApp(Application): | ||
92 | 92 | admin=c.project.acl['tool']) |
93 | 93 | repo = model.SVNRepository( |
94 | 94 | name=self.config.options.mount_point, |
95 | - fs_path='/svn/' + c.project.shortname + '/', | |
96 | - url_path = '/' + c.project.shortname + '/', | |
97 | 95 | tool = 'svn', |
98 | 96 | status = 'creating') |
99 | 97 | g.publish('audit', 'scm.svn.init', dict(repo_name=repo.name, repo_path=repo.fs_path)) |
@@ -21,6 +21,19 @@ class Repository(Artifact): | ||
21 | 21 | status=FieldProperty(str) |
22 | 22 | email_address='' |
23 | 23 | |
24 | + def __init__(self, **kw): | |
25 | + if 'name' in kw and 'tool' in kw: | |
26 | + if 'fs_path' not in kw: | |
27 | + kw['fs_path'] = '/' + os.path.join( | |
28 | + kw['tool'], | |
29 | + pylons.c.project.url()[1:], | |
30 | + kw['name']) | |
31 | + if 'url_path' not in kw: | |
32 | + kw['url_path'] = os.path.join( | |
33 | + pylons.c.project.url(), | |
34 | + kw['name']) | |
35 | + super(Repository, self).__init__(**kw) | |
36 | + | |
24 | 37 | def url(self): |
25 | 38 | return self.app_config.url() |
26 | 39 |