You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2013/08/29 21:27:42 UTC
[07/10] 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/master
Commit: de91d9d74f1c0702f7e798c321d8b437bae86d84
Parents: 9a5ec88
Author: Anton Kasyanov <mi...@gmail.com>
Authored: Thu Aug 8 17:05:20 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
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):