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 A42F510C9C for ; Fri, 13 Sep 2013 02:17:51 +0000 (UTC) Received: (qmail 79159 invoked by uid 500); 12 Sep 2013 20:52:26 -0000 Delivered-To: apmail-incubator-allura-commits-archive@incubator.apache.org Received: (qmail 78910 invoked by uid 500); 12 Sep 2013 20:52:25 -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 78083 invoked by uid 99); 12 Sep 2013 20:51:53 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Sep 2013 20:51:53 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 682B01661A; Thu, 12 Sep 2013 20:51:52 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tvansteenburgh@apache.org To: allura-commits@incubator.apache.org Date: Thu, 12 Sep 2013 20:52:01 -0000 Message-Id: <6f20fa29cffa4098980ae9d137cf43c4@git.apache.org> In-Reply-To: <1a519fc425a04cefafad0bdff9ac2877@git.apache.org> References: <1a519fc425a04cefafad0bdff9ac2877@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [11/29] git commit: [#5775] ticket:405 adding rename detection to svn [#5775] ticket:405 adding rename detection to svn Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/de91d9d7 Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/de91d9d7 Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/de91d9d7 Branch: refs/heads/tv/6457 Commit: de91d9d74f1c0702f7e798c321d8b437bae86d84 Parents: 9a5ec88 Author: Anton Kasyanov Authored: Thu Aug 8 17:05:20 2013 +0300 Committer: Tim Van Steenburgh Committed: Thu Aug 29 19:00:45 2013 +0000 ---------------------------------------------------------------------- ForgeSVN/forgesvn/model/svn.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/de91d9d7/ForgeSVN/forgesvn/model/svn.py ---------------------------------------------------------------------- diff --git a/ForgeSVN/forgesvn/model/svn.py b/ForgeSVN/forgesvn/model/svn.py index 9074946..3e6ea25 100644 --- a/ForgeSVN/forgesvn/model/svn.py +++ b/ForgeSVN/forgesvn/model/svn.py @@ -533,28 +533,39 @@ class SVNImplementation(M.RepositoryImplementation): while revno > exclude: rev = pysvn.Revision(pysvn.opt_revision_kind.number, revno) try: - logs = self._svn.log(url, revision_start=rev, limit=page_size) + logs = self._svn.log(url, revision_start=rev, limit=page_size, + discover_changed_paths=True) except pysvn.ClientError as e: if 'Unable to connect' in e.message: raise # repo error return # no (more) history for this path for ci in logs: + if ci.revision.number <= exclude: return if id_only: yield ci.revision.number else: - yield self._map_log(ci, url) + yield self._map_log(ci, url, path) if len(logs) < page_size: return # we didn't get a full page, don't bother calling SVN again revno = ci.revision.number - 1 - def _map_log(self, ci, url): + def _map_log(self, ci, url, path=None): revno = ci.revision.number try: size = int(self._svn.list(url)[0][0].size) - except pysvn.ClientError as e: + except pysvn.ClientError: size = None + rename_details = {} + changed_paths = ci.get('changed_paths', []) + for changed_path in changed_paths: + if changed_path['copyfrom_path'] and changed_path['path'] == path and changed_path['action'] == 'A': + rename_details['path'] = changed_path['copyfrom_path'] + rename_details['commit_url'] = self._repo.url_for_commit( + changed_path['copyfrom_revision'].number + ) + break return { 'id': revno, 'message': h.really_unicode(ci.get('message', '--none--')), @@ -571,6 +582,7 @@ class SVNImplementation(M.RepositoryImplementation): 'refs': ['HEAD'] if revno == self.head else [], 'parents': [revno-1] if revno > 1 else [], 'size': size, + 'rename_details': rename_details, } def open_blob(self, blob):