Return-Path: X-Original-To: apmail-incubator-allura-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-allura-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 97287D142 for ; Wed, 31 Oct 2012 18:08:58 +0000 (UTC) Received: (qmail 56098 invoked by uid 500); 31 Oct 2012 18:08:58 -0000 Delivered-To: apmail-incubator-allura-commits-archive@incubator.apache.org Received: (qmail 56077 invoked by uid 500); 31 Oct 2012 18:08:58 -0000 Mailing-List: contact allura-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: allura-dev@incubator.apache.org Delivered-To: mailing list allura-commits@incubator.apache.org Received: (qmail 56061 invoked by uid 99); 31 Oct 2012 18:08:57 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Oct 2012 18:08:57 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 5FFEB512D7; Wed, 31 Oct 2012 18:08:57 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: brondsem@apache.org To: allura-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: git commit: [#5005] Allow fs_path option to be passed in, and remove warning if repo dir already exists Message-Id: <20121031180857.5FFEB512D7@tyr.zones.apache.org> Date: Wed, 31 Oct 2012 18:08:57 +0000 (UTC) Updated Branches: refs/heads/master a37b35a6a -> 709d5471d [#5005] Allow fs_path option to be passed in, and remove warning if repo dir already exists Signed-off-by: Cory Johns Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/709d5471 Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/709d5471 Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/709d5471 Branch: refs/heads/master Commit: 709d5471d1ebcbf1bb5b0d0683a85925c0799104 Parents: a37b35a Author: Cory Johns Authored: Tue Oct 30 21:43:15 2012 +0000 Committer: Dave Brondsema Committed: Wed Oct 31 18:08:34 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/709d5471/Allura/allura/model/repository.py ---------------------------------------------------------------------- diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py index 30351fa..ba8df55 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.mkdir(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/709d5471/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/709d5471/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/709d5471/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')