##// END OF EJS Templates
api: exposed modified added/modified/deleted functions of commit to return only paths....
marcink -
r4242:a0c2e883 stable
parent child Browse files
Show More
@@ -355,12 +355,12 b' def get_pull_request_or_error(pullreques'
355 def build_commit_data(commit, detail_level):
355 def build_commit_data(commit, detail_level):
356 parsed_diff = []
356 parsed_diff = []
357 if detail_level == 'extended':
357 if detail_level == 'extended':
358 for f in commit.added:
358 for f_path in commit.added_paths:
359 parsed_diff.append(_get_commit_dict(filename=f.path, op='A'))
359 parsed_diff.append(_get_commit_dict(filename=f_path, op='A'))
360 for f in commit.changed:
360 for f_path in commit.changed_paths:
361 parsed_diff.append(_get_commit_dict(filename=f.path, op='M'))
361 parsed_diff.append(_get_commit_dict(filename=f_path, op='M'))
362 for f in commit.removed:
362 for f_path in commit.removed_paths:
363 parsed_diff.append(_get_commit_dict(filename=f.path, op='D'))
363 parsed_diff.append(_get_commit_dict(filename=f_path, op='D'))
364
364
365 elif detail_level == 'full':
365 elif detail_level == 'full':
366 from rhodecode.lib.diffs import DiffProcessor
366 from rhodecode.lib.diffs import DiffProcessor
@@ -432,8 +432,11 b' class GitCommit(base.BaseCommit):'
432 """
432 """
433 if not self.parents:
433 if not self.parents:
434 return list(self._get_file_nodes())
434 return list(self._get_file_nodes())
435 return AddedFileNodesGenerator(
435 return AddedFileNodesGenerator(self.added_paths, self)
436 [n for n in self._get_paths_for_status('added')], self)
436
437 @LazyProperty
438 def added_paths(self):
439 return [n for n in self._get_paths_for_status('added')]
437
440
438 @LazyProperty
441 @LazyProperty
439 def changed(self):
442 def changed(self):
@@ -442,8 +445,11 b' class GitCommit(base.BaseCommit):'
442 """
445 """
443 if not self.parents:
446 if not self.parents:
444 return []
447 return []
445 return ChangedFileNodesGenerator(
448 return ChangedFileNodesGenerator(self.changed_paths, self)
446 [n for n in self._get_paths_for_status('modified')], self)
449
450 @LazyProperty
451 def changed_paths(self):
452 return [n for n in self._get_paths_for_status('modified')]
447
453
448 @LazyProperty
454 @LazyProperty
449 def removed(self):
455 def removed(self):
@@ -452,8 +458,11 b' class GitCommit(base.BaseCommit):'
452 """
458 """
453 if not self.parents:
459 if not self.parents:
454 return []
460 return []
455 return RemovedFileNodesGenerator(
461 return RemovedFileNodesGenerator(self.removed_paths, self)
456 [n for n in self._get_paths_for_status('deleted')], self)
462
463 @LazyProperty
464 def removed_paths(self):
465 return [n for n in self._get_paths_for_status('deleted')]
457
466
458 def _get_submodule_url(self, submodule_path):
467 def _get_submodule_url(self, submodule_path):
459 git_modules_path = '.gitmodules'
468 git_modules_path = '.gitmodules'
@@ -372,18 +372,30 b' class MercurialCommit(base.BaseCommit):'
372 """
372 """
373 Returns list of added ``FileNode`` objects.
373 Returns list of added ``FileNode`` objects.
374 """
374 """
375 return AddedFileNodesGenerator([n for n in self.status[1]], self)
375 return AddedFileNodesGenerator(self.added_paths, self)
376
377 @LazyProperty
378 def added_paths(self):
379 return [n for n in self.status[1]]
376
380
377 @property
381 @property
378 def changed(self):
382 def changed(self):
379 """
383 """
380 Returns list of modified ``FileNode`` objects.
384 Returns list of modified ``FileNode`` objects.
381 """
385 """
382 return ChangedFileNodesGenerator([n for n in self.status[0]], self)
386 return ChangedFileNodesGenerator(self.changed_paths, self)
387
388 @LazyProperty
389 def changed_paths(self):
390 return [n for n in self.status[0]]
383
391
384 @property
392 @property
385 def removed(self):
393 def removed(self):
386 """
394 """
387 Returns list of removed ``FileNode`` objects.
395 Returns list of removed ``FileNode`` objects.
388 """
396 """
389 return RemovedFileNodesGenerator([n for n in self.status[2]], self)
397 return RemovedFileNodesGenerator(self.removed_paths, self)
398
399 @LazyProperty
400 def removed_paths(self):
401 return [n for n in self.status[2]]
@@ -218,18 +218,27 b' class SubversionCommit(base.BaseCommit):'
218
218
219 @property
219 @property
220 def added(self):
220 def added(self):
221 return nodes.AddedFileNodesGenerator(
221 return nodes.AddedFileNodesGenerator(self.added_paths, self)
222 self._changes_cache['added'], self)
222
223 @LazyProperty
224 def added_paths(self):
225 return [n for n in self._changes_cache['added']]
223
226
224 @property
227 @property
225 def changed(self):
228 def changed(self):
226 return nodes.ChangedFileNodesGenerator(
229 return nodes.ChangedFileNodesGenerator(self.changed_paths, self)
227 self._changes_cache['changed'], self)
230
231 @LazyProperty
232 def changed_paths(self):
233 return [n for n in self._changes_cache['changed']]
228
234
229 @property
235 @property
230 def removed(self):
236 def removed(self):
231 return nodes.RemovedFileNodesGenerator(
237 return nodes.RemovedFileNodesGenerator(self.removed_paths, self)
232 self._changes_cache['removed'], self)
238
239 @LazyProperty
240 def removed_paths(self):
241 return [n for n in self._changes_cache['removed']]
233
242
234
243
235 def _date_from_svn_properties(properties):
244 def _date_from_svn_properties(properties):
General Comments 0
You need to be logged in to leave comments. Login now