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 A790710CE6 for ; Tue, 17 Dec 2013 21:30:46 +0000 (UTC) Received: (qmail 12020 invoked by uid 500); 17 Dec 2013 21:30:46 -0000 Delivered-To: apmail-incubator-allura-commits-archive@incubator.apache.org Received: (qmail 11999 invoked by uid 500); 17 Dec 2013 21:30:46 -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 11991 invoked by uid 99); 17 Dec 2013 21:30:46 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Dec 2013 21:30:46 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 5F74C8BB03B; Tue, 17 Dec 2013 21:30:46 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: johnsca@apache.org To: allura-commits@incubator.apache.org Message-Id: <6ada6c3eb7174e73bddc22a8bd6e43bf@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: [#6821] Remove LCD dependency on DiffInfoDoc Date: Tue, 17 Dec 2013 21:30:46 +0000 (UTC) Updated Branches: refs/heads/cj/6821 6578d12a2 -> 8b567de15 [#6821] Remove LCD dependency on DiffInfoDoc 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/8b567de1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/8b567de1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/8b567de1 Branch: refs/heads/cj/6821 Commit: 8b567de15a6d77ac976b6946ecf0e1efa9b82acd Parents: 6578d12 Author: Cory Johns Authored: Tue Dec 17 21:30:11 2013 +0000 Committer: Cory Johns Committed: Tue Dec 17 21:30:11 2013 +0000 ---------------------------------------------------------------------- Allura/allura/model/repo.py | 23 +++++++++++------------ Allura/allura/model/repository.py | 8 ++++++++ ForgeGit/forgegit/model/git_repo.py | 7 +++++++ ForgeSVN/forgesvn/model/svn.py | 13 +++++++++++++ 4 files changed, 39 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b567de1/Allura/allura/model/repo.py ---------------------------------------------------------------------- diff --git a/Allura/allura/model/repo.py b/Allura/allura/model/repo.py index 682670a..9977a0f 100644 --- a/Allura/allura/model/repo.py +++ b/Allura/allura/model/repo.py @@ -430,18 +430,17 @@ class Commit(RepoObject, ActivityObject): If the file /foo/bar is changed in the commit, this would return ['', 'foo', 'foo/bar'] ''' - diff_info = DiffInfoDoc.m.get(_id=self._id) - diffs = set() - if diff_info: - for d in diff_info.differences: - node = d.name.strip('/') - diffs.add(node) - node_path = os.path.dirname(node) - while node_path: - diffs.add(node_path) - node_path = os.path.dirname(node_path) - diffs.add('') # include '/' if there are any changes - return diffs + changes = self.repo.get_changes(self._id) + changed_paths = set() + for c in changes: + node = c.strip('/') + changed_paths.add(node) + node_path = os.path.dirname(node) + while node_path: + changed_paths.add(node_path) + node_path = os.path.dirname(node_path) + changed_paths.add('') # include '/' if there are any changes + return changed_paths @LazyProperty def added_paths(self): http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b567de1/Allura/allura/model/repository.py ---------------------------------------------------------------------- diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py index 10f2950..7d0fae0 100644 --- a/Allura/allura/model/repository.py +++ b/Allura/allura/model/repository.py @@ -280,6 +280,12 @@ class RepositoryImplementation(object): """ raise NotImplementedError('_get_last_commit') + def get_changes(self, commit_id): + """ + Return the list of files changed by a given commit. + """ + raise NotImplemented('get_changes') + class Repository(Artifact, ActivityObject): BATCH_SIZE=100 class __mongometa__: @@ -387,6 +393,8 @@ class Repository(Artifact, ActivityObject): return self._impl.compute_tree_new(commit, path) def last_commit_ids(self, commit, paths): return self._impl.last_commit_ids(commit, paths) + def get_changes(self, commit_id): + return self._impl.get_changes(commit_id) def is_empty(self): return self._impl.is_empty() def is_file(self, path, rev=None): http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b567de1/ForgeGit/forgegit/model/git_repo.py ---------------------------------------------------------------------- diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py index 5a2c3b9..ae9f63e 100644 --- a/ForgeGit/forgegit/model/git_repo.py +++ b/ForgeGit/forgegit/model/git_repo.py @@ -526,6 +526,13 @@ class GitImplementation(M.RepositoryImplementation): else: return None, set() + def get_changes(self, commit_id): + return self._git.git.log( + commit_id, + name_only=True, + pretty='format:', + max_count=1).splitlines()[1:] + class _OpenedGitBlob(object): CHUNK_SIZE=4096 http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b567de1/ForgeSVN/forgesvn/model/svn.py ---------------------------------------------------------------------- diff --git a/ForgeSVN/forgesvn/model/svn.py b/ForgeSVN/forgesvn/model/svn.py index 9e6eb83..f4d0ac0 100644 --- a/ForgeSVN/forgesvn/model/svn.py +++ b/ForgeSVN/forgesvn/model/svn.py @@ -683,6 +683,19 @@ class SVNImplementation(M.RepositoryImplementation): entries[path] = self._oid(info.last_changed_rev.number) return entries + def get_changes(self, oid): + rev = self._revision(oid) + try: + log_entry = self._svn.log( + self._url, + revision_start=rev, + limit=1, + discover_changed_paths=True)[0] + except pysvn.ClientError: + log.info('ClientError processing %r %r, treating as empty', oid, self._repo, exc_info=True) + log_entry = Object(date='', message='', changed_paths=[]) + return [p.path for p in log_entry.changed_paths] + def _path_to_root(self, path, rev=None): '''Return tag/branch/trunk root for given path inside svn repo''' if path: