--- a/ForgeHg/forgehg/hg_main.py
+++ b/ForgeHg/forgehg/hg_main.py
@@ -99,6 +99,13 @@
write=[role_developer],
create=[role_developer],
admin=c.project.acl['tool'])
+ repo = model.HgRepository()
+ repo.name = self.config.options.mount_point
+ repo.fs_path = '/hg/' + c.project.shortname + '/'
+ repo.url_path = '/' + c.project.shortname + '/'
+ repo.tool = 'hg'
+ repo.status = 'initing'
+ g.publish('audit', 'scm.hg.init', dict(repo_name=repo.name, repo_path=repo.fs_path))
def uninstall(self, project):
@@ -108,8 +115,8 @@
def _uninstall(self, routing_key, data):
"Remove all the tool's artifacts and the physical repository"
repo = self.repo
- if repo is not None and repo.path:
- shutil.rmtree(repo.path, ignore_errors=True)
+ if repo is not None:
+ shutil.rmtree(repo.full_fs_path, ignore_errors=True)
model.HgRepository.query.remove(dict(app_config_id=self.config._id))
super(ForgeHgApp, self).uninstall(project_id=data['project_id'])
@@ -145,29 +152,6 @@
next_link=next_link,
offset=offset)
- @expose()
- def init(self, name=None):
- require(has_artifact_access('create'))
- if request.method != 'POST':
- raise Exception('init must be a POST request')
- repo = c.app.repo
- if repo is None:
- repo = model.HgRepository()
- if not name:
- name = c.project.shortname.split('/')[-1]
- path = '/hg/' + c.project.shortname + '/' + c.app.config.options.mount_point + '/'
- repo.name = name
- repo.path = path
- repo.tool = 'hg'
- repo.status = 'initing'
- g.publish('audit', 'scm.hg.init', dict(repo_name=name, repo_path=path))
- redirect('.')
-
- #Instantiate a Page object, and continue dispatch there
-# @expose()
-# def _lookup(self, pname, *remainder):
-# return PageController(pname), remainder
-
@with_trailing_slash
@expose('forgewiki.templates.search')
@validate(dict(q=validators.UnicodeString(if_empty=None),
@@ -214,12 +198,6 @@
return feed.writeString('utf-8')
@expose()
- def _lookup(self, name, *remainder):
- return RepoController(), remainder
-
-class RepoController(object):
-
- @expose()
def _lookup(self, hash, *remainder):
return CommitController(hash), remainder