api: fixed SVN raw diff export. The API method was incosistent, and used different logic.
Now it shares the same code as raw-diff from web-ui
This commit is contained in:
parent
2195ed33ab
commit
1bfda61f13
2 changed files with 15 additions and 8 deletions
|
|
@ -351,7 +351,10 @@ def get_pull_request_or_error(pullrequestid):
|
|||
return pull_request
|
||||
|
||||
|
||||
def build_commit_data(commit, detail_level):
|
||||
def build_commit_data(rhodecode_vcs_repo, commit, detail_level):
|
||||
commit2 = commit
|
||||
commit1 = commit.first_parent
|
||||
|
||||
parsed_diff = []
|
||||
if detail_level == 'extended':
|
||||
for f_path in commit.added_paths:
|
||||
|
|
@ -362,8 +365,11 @@ def build_commit_data(commit, detail_level):
|
|||
parsed_diff.append(_get_commit_dict(filename=f_path, op='D'))
|
||||
|
||||
elif detail_level == 'full':
|
||||
from rhodecode.lib.diffs import DiffProcessor
|
||||
diff_processor = DiffProcessor(commit.diff())
|
||||
from rhodecode.lib import diffs
|
||||
|
||||
_diff = rhodecode_vcs_repo.get_diff(commit1, commit2,)
|
||||
diff_processor = diffs.DiffProcessor(_diff, format='newdiff', show_full_diff=True)
|
||||
|
||||
for dp in diff_processor.prepare():
|
||||
del dp['stats']['ops']
|
||||
_stats = dp['stats']
|
||||
|
|
|
|||
|
|
@ -317,17 +317,18 @@ def get_repo_changeset(request, apiuser, repoid, revision,
|
|||
'ret_type must be one of %s' % (
|
||||
','.join(_changes_details_types)))
|
||||
|
||||
vcs_repo = repo.scm_instance()
|
||||
pre_load = ['author', 'branch', 'date', 'message', 'parents',
|
||||
'status', '_commit', '_file_paths']
|
||||
|
||||
try:
|
||||
cs = repo.get_commit(commit_id=revision, pre_load=pre_load)
|
||||
commit = repo.get_commit(commit_id=revision, pre_load=pre_load)
|
||||
except TypeError as e:
|
||||
raise JSONRPCError(safe_str(e))
|
||||
_cs_json = cs.__json__()
|
||||
_cs_json['diff'] = build_commit_data(cs, changes_details)
|
||||
_cs_json = commit.__json__()
|
||||
_cs_json['diff'] = build_commit_data(vcs_repo, commit, changes_details)
|
||||
if changes_details == 'full':
|
||||
_cs_json['refs'] = cs._get_refs()
|
||||
_cs_json['refs'] = commit._get_refs()
|
||||
return _cs_json
|
||||
|
||||
|
||||
|
|
@ -398,7 +399,7 @@ def get_repo_changesets(request, apiuser, repoid, start_rev, limit,
|
|||
if cnt >= limit != -1:
|
||||
break
|
||||
_cs_json = commit.__json__()
|
||||
_cs_json['diff'] = build_commit_data(commit, changes_details)
|
||||
_cs_json['diff'] = build_commit_data(vcs_repo, commit, changes_details)
|
||||
if changes_details == 'full':
|
||||
_cs_json['refs'] = {
|
||||
'branches': [commit.branch],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue