##// END OF EJS Templates
api: fixed SVN raw diff export. The API method was incosistent, and used different logic....
marcink -
r4531:5d43c7d2 default
parent child Browse files
Show More
@@ -351,7 +351,10 b' def get_pull_request_or_error(pullreques'
351 351 return pull_request
352 352
353 353
354 def build_commit_data(commit, detail_level):
354 def build_commit_data(rhodecode_vcs_repo, commit, detail_level):
355 commit2 = commit
356 commit1 = commit.first_parent
357
355 358 parsed_diff = []
356 359 if detail_level == 'extended':
357 360 for f_path in commit.added_paths:
@@ -362,8 +365,11 b' def build_commit_data(commit, detail_lev'
362 365 parsed_diff.append(_get_commit_dict(filename=f_path, op='D'))
363 366
364 367 elif detail_level == 'full':
365 from rhodecode.lib.diffs import DiffProcessor
366 diff_processor = DiffProcessor(commit.diff())
368 from rhodecode.lib import diffs
369
370 _diff = rhodecode_vcs_repo.get_diff(commit1, commit2,)
371 diff_processor = diffs.DiffProcessor(_diff, format='newdiff', show_full_diff=True)
372
367 373 for dp in diff_processor.prepare():
368 374 del dp['stats']['ops']
369 375 _stats = dp['stats']
@@ -317,17 +317,18 b' def get_repo_changeset(request, apiuser,'
317 317 'ret_type must be one of %s' % (
318 318 ','.join(_changes_details_types)))
319 319
320 vcs_repo = repo.scm_instance()
320 321 pre_load = ['author', 'branch', 'date', 'message', 'parents',
321 322 'status', '_commit', '_file_paths']
322 323
323 324 try:
324 cs = repo.get_commit(commit_id=revision, pre_load=pre_load)
325 commit = repo.get_commit(commit_id=revision, pre_load=pre_load)
325 326 except TypeError as e:
326 327 raise JSONRPCError(safe_str(e))
327 _cs_json = cs.__json__()
328 _cs_json['diff'] = build_commit_data(cs, changes_details)
328 _cs_json = commit.__json__()
329 _cs_json['diff'] = build_commit_data(vcs_repo, commit, changes_details)
329 330 if changes_details == 'full':
330 _cs_json['refs'] = cs._get_refs()
331 _cs_json['refs'] = commit._get_refs()
331 332 return _cs_json
332 333
333 334
@@ -398,7 +399,7 b' def get_repo_changesets(request, apiuser'
398 399 if cnt >= limit != -1:
399 400 break
400 401 _cs_json = commit.__json__()
401 _cs_json['diff'] = build_commit_data(commit, changes_details)
402 _cs_json['diff'] = build_commit_data(vcs_repo, commit, changes_details)
402 403 if changes_details == 'full':
403 404 _cs_json['refs'] = {
404 405 'branches': [commit.branch],
General Comments 0
You need to be logged in to leave comments. Login now