You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2012/10/31 18:34:54 UTC
[1/5] git commit: [#5005] Allow fs_path option to be passed in,
and remove warning if repo dir already exists
Updated Branches:
refs/heads/cj/5005 a4ddb5593 -> f549926f9 (forced update)
[#5005] Allow fs_path option to be passed in, and remove warning if repo dir already exists
Signed-off-by: Cory Johns <jo...@geek.net>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/f549926f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/f549926f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/f549926f
Branch: refs/heads/cj/5005
Commit: f549926f908ab1d4119a7e59e55f7e955c6f0d81
Parents: a37b35a
Author: Cory Johns <jo...@geek.net>
Authored: Tue Oct 30 21:43:15 2012 +0000
Committer: Cory Johns <jo...@geek.net>
Committed: Wed Oct 31 17:25:43 2012 +0000
----------------------------------------------------------------------
Allura/allura/model/repository.py | 22 ++++++++++++----------
ForgeGit/forgegit/git_main.py | 3 ++-
ForgeHg/forgehg/hg_main.py | 3 ++-
ForgeSVN/forgesvn/svn_main.py | 3 ++-
4 files changed, 18 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f549926f/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index 30351fa..365052a 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -124,16 +124,18 @@ class RepositoryImplementation(object):
return '%sci/%s/' % (self._repo.url(), object_id)
def _setup_paths(self, create_repo_dir=True):
+ '''
+ Ensure that the base directory in which the repo lives exists.
+ If create_repo_dir is True, also ensure that the directory
+ of the repo itself exists.
+ '''
if not self._repo.fs_path.endswith('/'): self._repo.fs_path += '/'
fullname = self._repo.fs_path + self._repo.name
- path = fullname if create_repo_dir else self._repo.fs_path
- try:
- os.makedirs(path)
- except OSError, e: # pragma no cover
- if e.errno != errno.EEXIST:
- raise
- else:
- log.warn('setup_paths error %s' % path, exc_info=True)
+ # make the base dir for repo, regardless
+ if not os.path.exists(self._repo.fs_path):
+ os.makedirs(self._repo.fs_path)
+ if create_repo_dir and not os.path.exists(fullname):
+ os.makedir(fullname)
return fullname
def _setup_special_files(self, source_path=None):
@@ -167,9 +169,9 @@ class Repository(Artifact, ActivityObject):
def __init__(self, **kw):
if 'name' in kw and 'tool' in kw:
- if 'fs_path' not in kw:
+ if kw.get('fs_path') is None:
kw['fs_path'] = self.default_fs_path(c.project, kw['tool'])
- if 'url_path' not in kw:
+ if kw.get('url_path') is None:
kw['url_path'] = self.default_url_path(c.project, kw['tool'])
super(Repository, self).__init__(**kw)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f549926f/ForgeGit/forgegit/git_main.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/git_main.py b/ForgeGit/forgegit/git_main.py
index c4a2e7b..95bce77 100644
--- a/ForgeGit/forgegit/git_main.py
+++ b/ForgeGit/forgegit/git_main.py
@@ -53,7 +53,8 @@ class ForgeGitApp(RepositoryApp):
repo = GM.Repository(
name=self.config.options.mount_point + '.git',
tool='git',
- status='initializing')
+ status='initializing',
+ fs_path=self.config.options.get('fs_path'))
ThreadLocalORMSession.flush_all()
cloned_from_project_id = self.config.options.get('cloned_from_project_id')
cloned_from_repo_id = self.config.options.get('cloned_from_repo_id')
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f549926f/ForgeHg/forgehg/hg_main.py
----------------------------------------------------------------------
diff --git a/ForgeHg/forgehg/hg_main.py b/ForgeHg/forgehg/hg_main.py
index 77ccdbb..a2631ac 100644
--- a/ForgeHg/forgehg/hg_main.py
+++ b/ForgeHg/forgehg/hg_main.py
@@ -53,7 +53,8 @@ class ForgeHgApp(RepositoryApp):
HM.Repository(
name=self.config.options.mount_point,
tool='hg',
- status='initializing')
+ status='initializing',
+ fs_path=self.config.options.get('fs_path'))
ThreadLocalORMSession.flush_all()
cloned_from_project_id = self.config.options.get('cloned_from_project_id')
cloned_from_repo_id = self.config.options.get('cloned_from_repo_id')
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f549926f/ForgeSVN/forgesvn/svn_main.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/svn_main.py b/ForgeSVN/forgesvn/svn_main.py
index f8aa748..3f0c8b6 100644
--- a/ForgeSVN/forgesvn/svn_main.py
+++ b/ForgeSVN/forgesvn/svn_main.py
@@ -62,7 +62,8 @@ class ForgeSVNApp(RepositoryApp):
SM.Repository(
name=self.config.options.mount_point,
tool='svn',
- status='initializing')
+ status='initializing',
+ fs_path=self.config.options.get('fs_path'))
ThreadLocalORMSession.flush_all()
init_from_url = self.config.options.get('init_from_url')
init_from_path = self.config.options.get('init_from_path')