##// 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 355 def build_commit_data(commit, detail_level):
356 356 parsed_diff = []
357 357 if detail_level == 'extended':
358 for f in commit.added:
359 parsed_diff.append(_get_commit_dict(filename=f.path, op='A'))
360 for f in commit.changed:
361 parsed_diff.append(_get_commit_dict(filename=f.path, op='M'))
362 for f in commit.removed:
363 parsed_diff.append(_get_commit_dict(filename=f.path, op='D'))
358 for f_path in commit.added_paths:
359 parsed_diff.append(_get_commit_dict(filename=f_path, op='A'))
360 for f_path in commit.changed_paths:
361 parsed_diff.append(_get_commit_dict(filename=f_path, op='M'))
362 for f_path in commit.removed_paths:
363 parsed_diff.append(_get_commit_dict(filename=f_path, op='D'))
364 364
365 365 elif detail_level == 'full':
366 366 from rhodecode.lib.diffs import DiffProcessor
@@ -432,8 +432,11 b' class GitCommit(base.BaseCommit):'
432 432 """
433 433 if not self.parents:
434 434 return list(self._get_file_nodes())
435 return AddedFileNodesGenerator(
436 [n for n in self._get_paths_for_status('added')], self)
435 return AddedFileNodesGenerator(self.added_paths, self)
436
437 @LazyProperty
438 def added_paths(self):
439 return [n for n in self._get_paths_for_status('added')]
437 440
438 441 @LazyProperty
439 442 def changed(self):
@@ -442,8 +445,11 b' class GitCommit(base.BaseCommit):'
442 445 """
443 446 if not self.parents:
444 447 return []
445 return ChangedFileNodesGenerator(
446 [n for n in self._get_paths_for_status('modified')], self)
448 return ChangedFileNodesGenerator(self.changed_paths, self)
449
450 @LazyProperty
451 def changed_paths(self):
452 return [n for n in self._get_paths_for_status('modified')]
447 453
448 454 @LazyProperty
449 455 def removed(self):
@@ -452,8 +458,11 b' class GitCommit(base.BaseCommit):'
452 458 """
453 459 if not self.parents:
454 460 return []
455 return RemovedFileNodesGenerator(
456 [n for n in self._get_paths_for_status('deleted')], self)
461 return RemovedFileNodesGenerator(self.removed_paths, self)
462
463 @LazyProperty
464 def removed_paths(self):
465 return [n for n in self._get_paths_for_status('deleted')]
457 466
458 467 def _get_submodule_url(self, submodule_path):
459 468 git_modules_path = '.gitmodules'
@@ -372,18 +372,30 b' class MercurialCommit(base.BaseCommit):'
372 372 """
373 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 381 @property
378 382 def changed(self):
379 383 """
380 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 392 @property
385 393 def removed(self):
386 394 """
387 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 219 @property
220 220 def added(self):
221 return nodes.AddedFileNodesGenerator(
222 self._changes_cache['added'], self)
221 return nodes.AddedFileNodesGenerator(self.added_paths, self)
222
223 @LazyProperty
224 def added_paths(self):
225 return [n for n in self._changes_cache['added']]
223 226
224 227 @property
225 228 def changed(self):
226 return nodes.ChangedFileNodesGenerator(
227 self._changes_cache['changed'], self)
229 return nodes.ChangedFileNodesGenerator(self.changed_paths, self)
230
231 @LazyProperty
232 def changed_paths(self):
233 return [n for n in self._changes_cache['changed']]
228 234
229 235 @property
230 236 def removed(self):
231 return nodes.RemovedFileNodesGenerator(
232 self._changes_cache['removed'], self)
237 return nodes.RemovedFileNodesGenerator(self.removed_paths, self)
238
239 @LazyProperty
240 def removed_paths(self):
241 return [n for n in self._changes_cache['removed']]
233 242
234 243
235 244 def _date_from_svn_properties(properties):
General Comments 0
You need to be logged in to leave comments. Login now