396
396
committer_name='Committer',
397
397
committer_email='committer@example.com',
398
398
committer_date=None,
400
401
"""Create a DiffCommit for testing.
403
By default, this also parses the provided diff data and creates a
403
404
:py:class:`reviewboard.diffviewer.models.filediff.FileDiff` attached to
405
the commit. Callers can turn this off using ``with_diff=False``.
409
Added the ``with_diff`` option.
407
412
repository (reviewboard.scmtools.models.Repository, optional):
443
448
committer_date (datetime.datetime, optional):
444
449
The date the commit was committed, if any.
451
with_diff (bool, optional):
452
Whether to create this with a diff.
454
If ``True`` (the default), this will also create a
455
:py:class:`~reviewboard.diffviewer.models.filediff.FileDiff`
456
based on ``diff_contents`` and ``parent_diff_contents``.
457
The diffs will be parsed using the repository's tool's native
458
parser in order to create the commit.
460
If ``False``, this will just create the object in the
447
464
Keyword arguments to be passed to the
448
465
:py:class:`~reviewboard.diffviewer.models.diffcommit.
478
495
parent_diff_file_name = None
480
return DiffCommit.objects.create_from_data(
481
repository=repository,
482
diff_file_name='diff',
483
diff_file_contents=diff_contents,
484
parent_diff_file_name=parent_diff_file_name,
485
parent_diff_file_contents=parent_diff_contents,
489
author_name=author_name,
490
author_email=author_email,
491
author_date=author_date,
492
commit_message=commit_message,
494
committer_name=committer_name,
495
committer_email=committer_email,
496
committer_date=committer_date,
497
check_existence=False,
498
return DiffCommit.objects.create_from_data(
499
repository=repository,
500
diff_file_name='diff',
501
diff_file_contents=diff_contents,
502
parent_diff_file_name=parent_diff_file_name,
503
parent_diff_file_contents=parent_diff_contents,
507
author_name=author_name,
508
author_email=author_email,
509
author_date=author_date,
510
commit_message=commit_message,
512
committer_name=committer_name,
513
committer_email=committer_email,
514
committer_date=committer_date,
515
check_existence=False,
518
return DiffCommit.objects.create(
522
author_name=author_name,
523
author_email=author_email,
524
author_date=author_date,
525
commit_message=commit_message,
526
committer_name=committer_name,
527
committer_email=committer_email,
528
committer_date=committer_date,
500
531
def create_diffset(self, review_request=None, revision=1, repository=None,
501
532
draft=False, name='diffset'):