reviewboard.diffviewer.forms¶
Forms for uploading diffs.
- class BaseCommitValidationForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]¶
A form mixin for handling validation metadata for commits.
- clean_validation_info()[source]¶
Clean the validation_info field.
This method ensures that if the field is supplied that it parses as base64-encoded JSON.
- Returns
The parsed validation information.
- Return type
- Raises
django.core.exceptions.ValidationError – The value could not be parsed.
- class UploadCommitForm(diffset, request=None, *args, **kwargs)[source]¶
The form for uploading a diff and creating a DiffCommit.
- clean()[source]¶
Clean the form.
- Returns
The cleaned form data.
- Return type
- Raises
django.core.exceptions.ValidationError – The form data was not valid.
- clean_author_date()[source]¶
Parse the date and time in the author_date field.
- Returns
The parsed date and time.
- Return type
- class UploadDiffForm(repository, request=None, *args, **kwargs)[source]¶
The form for uploading a diff and creating a DiffSet.
- clean_base_commit_id()[source]¶
Clean the
base_commit_id
field.- Returns
The
base_commit_id
field stripped of leading and trailing whitespace, orNone
if that value would be empty.- Return type
unicode
- clean_basedir()[source]¶
Clean the
basedir
field.- Returns
The basedir field as a unicode string with leading and trailing whitespace removed.
- Return type
unicode
- create(diffset_history=None)[source]¶
Create the DiffSet.
- Parameters
diffset_history (reviewboard.diffviewer.models.diffset_history.DiffSetHistory) – The DiffSet history to attach the created DiffSet to.
- Returns
The created DiffSet.
- Return type
- class ValidateCommitForm(repository, request=None, *args, **kwargs)[source]¶
A form for validating of DiffCommits.
- clean()[source]¶
Clean the form.
- Returns
The cleaned form data.
- Return type
- Raises
django.core.exceptions.ValidationError – The form data was not valid.
- validate_diff()[source]¶
Validate the DiffCommit.
This will attempt to parse the given diff (and optionally parent diff) into
FileDiffs
. This will not result in anything being committed to the database.- Returns
A 2-tuple containing the following:
A list of the created FileDiffs.
A list of the parent FileDiffs, or
None
.
- Return type
- Raises
reviewboard.diffviewer.errors.DiffParserError – The diff could not be parsed.
reviewboard.diffviewer.errors.DiffTooBigError – The diff was too big.
reviewboard.diffviewer.errors.EmptyDiffError – The diff did not contain any changes.
reviewboard.scmtools.errors.FileNotFoundError – A file was not found in the repository.
reviewboard.scmtools.errors.SCMError – An error occurred within the SCMTool.