• Get Review Board
  • What's New
  • Products
  • Review Board Code review, image review, and document review
  • Documentation
  • Release Notes
  • Power Pack Enterprise integrations, reports, and enhanced document review
  • Try for 60 Days
  • Purchase
  • RBCommons Review Board as a Service, hosted by us
  • Pricing
  • RBTools Command line tools and Python API for Review Board
  • Documentation
  • Release Notes
  • Review Bot Automated code review, connecting tools you already use
  • Documentation
  • Release Notes
  • RB Gateway Manage Git and Mercurial repositories in your network
  • Documentation
  • Release Notes
  • Learn and Explore
  • What is Code Review?
  • Documentation
  • Frequently Asked Questions
  • Support Options
  • Third-Party Integrations
  • Demo
  • Review Board RBTools Power Pack Review Bot Djblets RB Gateway
    1. Review Board 7.x
    2. Version 7.x
    3. Version 6.x
    4. Version 5.0
    5. Version 4.0
    6. Version 3.0
    7. Version 2.5
    8. Version 2.0
    9. Version 1.7
    10. Version 1.6
    11. Version 1.5
    12. Version 1.0
    13. Extending Review Board
    14. Module and Class References
    15. reviewboard.diffviewer.diffutils
  • Home
  • Users Guide
  • Getting Started
  • Introduction
  • What is Code Review?
  • Review Board Workflows
  • Account Settings
  • Dashboard
  • Working with Review Requests
  • Overview
  • Creating Review Requests
  • Editing Fields
  • Uploading Diffs
  • Uploading File Attachments
  • Publishing Review Requests
  • Closing Review Requests
  • Reviewing
  • Reviews and Comments
  • The Review Banner
  • Managing and Publishing Drafts
  • Issue Tracking
  • Reviewing Code (Diffs)
  • Reviewing File Attachments
  • Reviewing Images
  • Reviewing Markdown Files
  • Reviewing Text Files
  • Creating and Editing Reviews
  • Approving Changes (Ship It!)
  • Replying to Comments
  • Automated Code Reviews
  • Searching
  • Quick Search
  • Full-Text Search
  • Using Markdown
  • Administration Guide
  • Installation
  • Installing Review Board
  • Linux System Compatibility
  • Installing with Docker
  • Manually Installing on Linux
  • Installing on macOS
  • Installing on Windows
  • Installing Development Releases
  • Creating a Review Board Site
  • Upgrading
  • Upgrading Review Board
  • Upgrading Review Board Sites
  • Optimization
  • Optimizing and Scaling Review Board
  • Administration UI
  • Overview of the Administration UI
  • Administrator Dashboard
  • Database Management
  • Configuration
  • Site Settings
  • General Settings
  • Authentication Settings
  • Avatar Services Settings
  • E-Mail Settings
  • Diff Viewer Settings
  • Logging Settings
  • SSH Settings
  • File Storage Settings
  • User Privacy Settings
  • Search Settings
  • Access Control
  • Working with E-Mail
  • Default Reviewers
  • Permission Groups
  • Repositories
  • Bazaar Repositories
  • CVS Repositories
  • Git Repositories
  • HCL VersionVault and IBM ClearCase
  • Mercurial Repositories
  • Perforce Repositories
  • Subversion Repositories
  • Assembla Repositories
  • AWS CodeCommit Repositories
  • Beanstalk Repositories
  • Bitbucket Repositories
  • Bitbucket Server Repositories
  • Codebase HQ Repositories
  • Fedora Hosted Repositories
  • Gerrit Repositories
  • GitHub Repositories
  • GitHub Enterprise Repositories
  • GitLab Repositories
  • Gitorious Repositories
  • Cliosoft SOS Repositories
  • SourceForge Repositories
  • Unfuddle STACK Repositories
  • VisualStudio.com Repositories
  • Review Groups
  • Users
  • WebHooks
  • Extensions
  • Integrations
  • Asana Integration
  • CircleCI Integration
  • Discord Integration
  • I Done This Integration
  • Jenkins CI Integration
  • Matrix Integration
  • Mattermost Integration
  • Microsoft Teams Integration
  • Slack Integration
  • Travis CI Integration
  • Trello Integration
  • Site Maintenance
  • The rb-site Tool
  • Advanced Management Commands
  • Monitoring Review Board
  • Health Checks
  • Web API Guide
  • Resource Tree
  • Resources
  • Root List Resource
  • Default Reviewer List Resource
  • Default Reviewer Resource
  • Extension List Resource
  • Extension Resource
  • Hosting Service Account List Resource
  • Hosting Service Account Resource
  • Remote Repository List Resource
  • Hosting Service List Resource
  • Hosting Service Resource
  • OAuth2 Applications List Resource
  • OAuth2 Applications Resource
  • OAuth2 Tokens List Resource
  • OAuth2 Tokens Resource
  • Repository List Resource
  • Repository Resource
  • Diff File Attachment List Resource
  • Repository Branches Resource
  • Repository Commits Resource
  • Repository Group List Resource
  • Repository Info Resource
  • Repository User List Resource
  • Review Group List Resource
  • Review Group Resource
  • Review Group User List Resource
  • Review Request List Resource
  • Review Request Resource
  • Change List Resource
  • Diff Context Resource
  • Diff List Resource
  • File Attachment List Resource
  • Review List Resource
  • Review Request Draft Resource
  • Review Request Last Update Resource
  • Screenshot List Resource
  • Status Update List Resource
  • Root Diff Comment List Resource
  • Root File Attachment Comment List Resource
  • Root General Comment List Resource
  • Root Review List Resource
  • Search Resource
  • Server Info Resource
  • Session Resource
  • User List Resource
  • User Resource
  • API Token List Resource
  • Archived Review Request List Resource
  • Muted Review Request List Resource
  • User File Attachment List Resource
  • Watched List Resource
  • Validation List Resource
  • Validate Diff List Resource
  • Validate Diff Commit List Resource
  • WebHook List Resource
  • WebHook Resource
  • Server Info Resource
  • Default Reviewer List Resource
  • Default Reviewer Resource
  • Default Reviewer Resource
  • Diff Context Resource
  • Diff List Resource
  • Diff Resource
  • Diff Commit List Resource
  • Diff Commit Resource
  • File Diff List Resource
  • File Diff Resource
  • Diff Resource
  • Diff Commit List Resource
  • Diff Commit Resource
  • File Diff List Resource
  • File Diff Resource
  • File Diff Comment List Resource
  • Original File Resource
  • Patched File Resource
  • Diff Commit List Resource
  • Diff Commit Resource
  • Diff Commit Resource
  • Diff File Attachment List Resource
  • Diff File Attachment Resource
  • Diff File Attachment Resource
  • Original File Resource
  • Patched File Resource
  • Extension List Resource
  • Extension Resource
  • Extension Resource
  • Hosting Service List Resource
  • Hosting Service Resource
  • Hosting Service Resource
  • Hosting Service Account List Resource
  • Hosting Service Account Resource
  • Remote Repository List Resource
  • Remote Repository Resource
  • Hosting Service Account Resource
  • Remote Repository List Resource
  • Remote Repository Resource
  • Remote Repository List Resource
  • Remote Repository Resource
  • Remote Repository Resource
  • OAuth2 Applications List Resource
  • OAuth2 Applications Resource
  • OAuth2 Applications Resource
  • OAuth2 Tokens List Resource
  • OAuth2 Tokens Resource
  • OAuth2 Tokens Resource
  • Repository List Resource
  • Repository Resource
  • Diff File Attachment List Resource
  • Diff File Attachment Resource
  • Repository Branches Resource
  • Repository Commits Resource
  • Repository Group List Resource
  • Repository Group Resource
  • Repository Info Resource
  • Repository User List Resource
  • Repository User Resource
  • Repository Resource
  • Diff File Attachment List Resource
  • Diff File Attachment Resource
  • Repository Branches Resource
  • Repository Commits Resource
  • Repository Group List Resource
  • Repository Group Resource
  • Repository Info Resource
  • Repository User List Resource
  • Repository User Resource
  • Repository Branches Resource
  • Repository Commits Resource
  • Repository Group List Resource
  • Repository Group Resource
  • Repository Group Resource
  • Repository Info Resource
  • Repository User List Resource
  • Repository User Resource
  • Repository User Resource
  • Review Group List Resource
  • Review Group Resource
  • Review Group User List Resource
  • Review Group User Resource
  • Review Group Resource
  • Review Group User List Resource
  • Review Group User Resource
  • Review Group User List Resource
  • Review Group User Resource
  • Review Group User Resource
  • Change List Resource
  • Change Resource
  • Change Resource
  • File Attachment List Resource
  • File Attachment Resource
  • File Attachment Comment List Resource
  • File Attachment Resource
  • File Attachment Comment List Resource
  • File Attachment Comment List Resource
  • File Diff List Resource
  • File Diff Resource
  • File Diff Comment List Resource
  • Original File Resource
  • Patched File Resource
  • File Diff Resource
  • File Diff Comment List Resource
  • Original File Resource
  • Patched File Resource
  • File Diff Comment List Resource
  • Review Request List Resource
  • Review Request Resource
  • Change List Resource
  • Change Resource
  • Diff Context Resource
  • Diff List Resource
  • Diff Resource
  • File Attachment List Resource
  • File Attachment Resource
  • Review List Resource
  • Review Resource
  • Review Draft Resource
  • Review Request Draft Resource
  • Draft Diff List Resource
  • Draft File Attachment List Resource
  • Draft Screenshot List Resource
  • Review Request Last Update Resource
  • Screenshot List Resource
  • Screenshot Resource
  • Status Update List Resource
  • Status Update Resource
  • Review Request Resource
  • Change List Resource
  • Change Resource
  • Diff Context Resource
  • Diff List Resource
  • Diff Resource
  • Diff Commit List Resource
  • File Diff List Resource
  • File Attachment List Resource
  • File Attachment Resource
  • File Attachment Comment List Resource
  • Review List Resource
  • Review Resource
  • Review Diff Comment List Resource
  • Review File Attachment Comment List Resource
  • Review General Comment List Resource
  • Review Reply List Resource
  • Review Screenshot Comment List Resource
  • Review Draft Resource
  • Review Request Draft Resource
  • Draft Diff List Resource
  • Draft Diff Resource
  • Draft File Attachment List Resource
  • Draft File Attachment Resource
  • Draft Screenshot List Resource
  • Draft Screenshot Resource
  • Review Request Last Update Resource
  • Screenshot List Resource
  • Screenshot Resource
  • Screenshot Comment List Resource
  • Status Update List Resource
  • Status Update Resource
  • Review Request Last Update Resource
  • Screenshot List Resource
  • Screenshot Resource
  • Screenshot Comment List Resource
  • Screenshot Resource
  • Screenshot Comment List Resource
  • Screenshot Comment List Resource
  • Draft Diff List Resource
  • Draft Diff Resource
  • Draft Diff Commit List Resource
  • Draft Diff Commit Resource
  • Draft File Diff List Resource
  • Draft File Diff Resource
  • Draft Diff Resource
  • Draft Diff Commit List Resource
  • Draft Diff Commit Resource
  • Draft File Diff List Resource
  • Draft File Diff Resource
  • Draft Original File Resource
  • Draft Patched File Resource
  • Draft Diff Commit List Resource
  • Draft Diff Commit Resource
  • Draft Diff Commit Resource
  • Draft File Diff List Resource
  • Draft File Diff Resource
  • Draft Original File Resource
  • Draft Patched File Resource
  • Draft File Diff Resource
  • Draft Original File Resource
  • Draft Patched File Resource
  • Draft File Attachment List Resource
  • Draft File Attachment Resource
  • Draft File Attachment Resource
  • Draft Original File Resource
  • Draft Patched File Resource
  • Draft Screenshot List Resource
  • Draft Screenshot Resource
  • Draft Screenshot Resource
  • Review Request Draft Resource
  • Draft Diff List Resource
  • Draft Diff Resource
  • Draft Diff Commit List Resource
  • Draft File Diff List Resource
  • Draft File Attachment List Resource
  • Draft File Attachment Resource
  • Draft Screenshot List Resource
  • Draft Screenshot Resource
  • Root Review List Resource
  • Root Diff Comment List Resource
  • Root File Attachment Comment List Resource
  • Root General Comment List Resource
  • Review List Resource
  • Review Resource
  • Review Diff Comment List Resource
  • Review Diff Comment Resource
  • Review File Attachment Comment List Resource
  • Review File Attachment Comment Resource
  • Review General Comment List Resource
  • Review General Comment Resource
  • Review Reply List Resource
  • Review Reply Resource
  • Review Reply Draft Resource
  • Review Screenshot Comment List Resource
  • Review Screenshot Comment Resource
  • Review Draft Resource
  • Review Resource
  • Review Diff Comment List Resource
  • Review Diff Comment Resource
  • Review File Attachment Comment List Resource
  • Review File Attachment Comment Resource
  • Review General Comment List Resource
  • Review General Comment Resource
  • Review Reply List Resource
  • Review Reply Resource
  • Review Reply Diff Comment List Resource
  • Review Reply File Attachment Comment List Resource
  • Review Reply General Comment List Resource
  • Review Reply Screenshot Comment List Resource
  • Review Reply Draft Resource
  • Review Screenshot Comment List Resource
  • Review Screenshot Comment Resource
  • Review Draft Resource
  • Review Diff Comment List Resource
  • Review Diff Comment Resource
  • Review Diff Comment Resource
  • Review File Attachment Comment List Resource
  • Review File Attachment Comment Resource
  • Review File Attachment Comment Resource
  • Review General Comment List Resource
  • Review General Comment Resource
  • Review General Comment Resource
  • Review Screenshot Comment List Resource
  • Review Screenshot Comment Resource
  • Review Screenshot Comment Resource
  • Review Reply Draft Resource
  • Review Reply List Resource
  • Review Reply Resource
  • Review Reply Diff Comment List Resource
  • Review Reply Diff Comment Resource
  • Review Reply File Attachment Comment List Resource
  • Review Reply File Attachment Comment Resource
  • Review Reply General Comment List Resource
  • Review Reply General Comment Resource
  • Review Reply Screenshot Comment List Resource
  • Review Reply Screenshot Comment Resource
  • Review Reply Draft Resource
  • Review Reply Resource
  • Review Reply Diff Comment List Resource
  • Review Reply Diff Comment Resource
  • Review Reply File Attachment Comment List Resource
  • Review Reply File Attachment Comment Resource
  • Review Reply General Comment List Resource
  • Review Reply General Comment Resource
  • Review Reply Screenshot Comment List Resource
  • Review Reply Screenshot Comment Resource
  • Review Reply Diff Comment List Resource
  • Review Reply Diff Comment Resource
  • Review Reply Diff Comment Resource
  • Review Reply File Attachment Comment List Resource
  • Review Reply File Attachment Comment Resource
  • Review Reply File Attachment Comment Resource
  • Review Reply General Comment List Resource
  • Review Reply General Comment Resource
  • Review Reply General Comment Resource
  • Review Reply Screenshot Comment List Resource
  • Review Reply Screenshot Comment Resource
  • Review Reply Screenshot Comment Resource
  • Search Resource
  • Status Update List Resource
  • Status Update Resource
  • Status Update Resource
  • API Token List Resource
  • API Token Resource
  • API Token Resource
  • Archived Review Request List Resource
  • Archived Review Request Resource
  • Archived Review Request Resource
  • Muted Review Request List Resource
  • Muted Review Request Resource
  • Muted Review Request Resource
  • Session Resource
  • User List Resource
  • User Resource
  • API Token List Resource
  • API Token Resource
  • Archived Review Request List Resource
  • Archived Review Request Resource
  • Muted Review Request List Resource
  • Muted Review Request Resource
  • User File Attachment List Resource
  • User File Attachment Resource
  • Watched List Resource
  • Watched Review Group List Resource
  • Watched Review Request List Resource
  • User Resource
  • API Token List Resource
  • API Token Resource
  • Archived Review Request List Resource
  • Archived Review Request Resource
  • Muted Review Request List Resource
  • Muted Review Request Resource
  • User File Attachment List Resource
  • User File Attachment Resource
  • Watched List Resource
  • Watched Review Group List Resource
  • Watched Review Group Resource
  • Watched Review Request List Resource
  • Watched Review Request Resource
  • User File Attachment List Resource
  • User File Attachment Resource
  • User File Attachment Resource
  • Watched Review Group List Resource
  • Watched Review Group Resource
  • Watched Review Group Resource
  • Watched Review Request List Resource
  • Watched Review Request Resource
  • Watched Review Request Resource
  • Watched List Resource
  • Watched Review Group List Resource
  • Watched Review Group Resource
  • Watched Review Request List Resource
  • Watched Review Request Resource
  • Validation List Resource
  • Validate Diff List Resource
  • Validate Diff Commit List Resource
  • Validate Diff List Resource
  • Validate Diff Commit List Resource
  • WebHook List Resource
  • WebHook Resource
  • WebHook Resource
  • Errors
  • 100 - Does Not Exist
  • 101 - Permission Denied
  • 102 - Invalid Attribute
  • 103 - Not Logged In
  • 104 - Login Failed
  • 105 - Invalid Form Data
  • 106 - Missing Attribute
  • 107 - Enable Extension Failed
  • 108 - Disable Extension Failed
  • 109 - Extension Already Installed
  • 110 - Install Extension Failed
  • 111 - Duplicate Item
  • 112 - OAuth2 Missing Scope Error
  • 113 - OAuth2 Access Denied Error
  • 114 - Rate Limit Exceeded
  • 203 - Invalid Change Number
  • 204 - Change Number In Use
  • 205 - Missing Repository
  • 206 - Invalid Repository
  • 207 - Repository File Not Found
  • 208 - Invalid User
  • 209 - Repository Action Not Supported
  • 210 - Repository Information Error
  • 212 - Empty Changeset
  • 213 - Server Configuration Error
  • 214 - Bad Host Key
  • 215 - Unverified Host Key
  • 216 - Unverified Host Certificate
  • 217 - Missing User Key
  • 218 - Repository Authentication Error
  • 219 - Diff Empty
  • 220 - Diff Too Big
  • 221 - File Retrieval Error
  • 222 - Hosting Service Authentication Error
  • 223 - Group Already Exists
  • 224 - Diff Parse Error
  • 225 - Publish Error
  • 226 - User Query Error
  • 227 - Commit ID Already Exists
  • 228 - Token Generation Failed
  • 230 - Could not close review request
  • 231 - Could not reopen review request
  • 232 - Ship-It Revocation Error
  • REST API 2.0
  • Overview
  • Authenticating
  • API Token Policies
  • OAuth2 Authentication
  • Rich Text Fields and Types
  • Storing/Accessing Extra Data
  • Resources
  • Root List Resource
  • Default Reviewer List Resource
  • Default Reviewer Resource
  • Extension List Resource
  • Extension Resource
  • Hosting Service Account List Resource
  • Hosting Service Account Resource
  • Hosting Service List Resource
  • Hosting Service Resource
  • OAuth2 Applications List Resource
  • OAuth2 Applications Resource
  • OAuth2 Tokens List Resource
  • OAuth2 Tokens Resource
  • Repository List Resource
  • Repository Resource
  • Review Group List Resource
  • Review Group Resource
  • Review Request List Resource
  • Review Request Resource
  • Root Diff Comment List Resource
  • Root File Attachment Comment List Resource
  • Root General Comment List Resource
  • Root Review List Resource
  • Search Resource
  • Server Info Resource
  • Session Resource
  • User List Resource
  • User Resource
  • Validation List Resource
  • Validate Diff List Resource
  • Validate Diff Commit List Resource
  • WebHook List Resource
  • WebHook Resource
  • Server Info Resource
  • Default Reviewer List Resource
  • Default Reviewer Resource
  • Default Reviewer Resource
  • Diff Context Resource
  • Diff List Resource
  • Diff Resource
  • Diff Commit List Resource
  • File Diff List Resource
  • Diff Resource
  • Diff Commit List Resource
  • Diff Commit Resource
  • File Diff List Resource
  • File Diff Resource
  • Diff Commit List Resource
  • Diff Commit Resource
  • Diff Commit Resource
  • Diff File Attachment List Resource
  • Diff File Attachment Resource
  • Diff File Attachment Resource
  • Original File Resource
  • Patched File Resource
  • Extension List Resource
  • Extension Resource
  • Extension Resource
  • Hosting Service List Resource
  • Hosting Service Resource
  • Hosting Service Resource
  • Hosting Service Account List Resource
  • Hosting Service Account Resource
  • Remote Repository List Resource
  • Hosting Service Account Resource
  • Remote Repository List Resource
  • Remote Repository Resource
  • Remote Repository List Resource
  • Remote Repository Resource
  • Remote Repository Resource
  • OAuth2 Applications List Resource
  • OAuth2 Applications Resource
  • OAuth2 Applications Resource
  • OAuth2 Tokens List Resource
  • OAuth2 Tokens Resource
  • OAuth2 Tokens Resource
  • Repository List Resource
  • Repository Resource
  • Diff File Attachment List Resource
  • Repository Branches Resource
  • Repository Commits Resource
  • Repository Group List Resource
  • Repository Info Resource
  • Repository User List Resource
  • Repository Resource
  • Diff File Attachment List Resource
  • Diff File Attachment Resource
  • Repository Branches Resource
  • Repository Commits Resource
  • Repository Group List Resource
  • Repository Group Resource
  • Repository Info Resource
  • Repository User List Resource
  • Repository User Resource
  • Repository Branches Resource
  • Repository Commits Resource
  • Repository Group List Resource
  • Repository Group Resource
  • Repository Group Resource
  • Repository Info Resource
  • Repository User List Resource
  • Repository User Resource
  • Repository User Resource
  • Review Group List Resource
  • Review Group Resource
  • Review Group User List Resource
  • Review Group Resource
  • Review Group User List Resource
  • Review Group User Resource
  • Review Group User List Resource
  • Review Group User Resource
  • Review Group User Resource
  • Change List Resource
  • Change Resource
  • Change Resource
  • File Attachment List Resource
  • File Attachment Resource
  • File Attachment Comment List Resource
  • File Attachment Resource
  • File Attachment Comment List Resource
  • File Attachment Comment List Resource
  • File Diff List Resource
  • File Diff Resource
  • File Diff Comment List Resource
  • Original File Resource
  • Patched File Resource
  • File Diff Resource
  • File Diff Comment List Resource
  • Original File Resource
  • Patched File Resource
  • File Diff Comment List Resource
  • Review Request List Resource
  • Review Request Resource
  • Change List Resource
  • Diff Context Resource
  • Diff List Resource
  • File Attachment List Resource
  • Review List Resource
  • Review Request Draft Resource
  • Review Request Last Update Resource
  • Screenshot List Resource
  • Status Update List Resource
  • Review Request Resource
  • Change List Resource
  • Change Resource
  • Diff Context Resource
  • Diff List Resource
  • Diff Resource
  • File Attachment List Resource
  • File Attachment Resource
  • Review List Resource
  • Review Resource
  • Review Draft Resource
  • Review Request Draft Resource
  • Draft Diff List Resource
  • Draft File Attachment List Resource
  • Draft Screenshot List Resource
  • Review Request Last Update Resource
  • Screenshot List Resource
  • Screenshot Resource
  • Status Update List Resource
  • Status Update Resource
  • Review Request Last Update Resource
  • Screenshot List Resource
  • Screenshot Resource
  • Screenshot Comment List Resource
  • Screenshot Resource
  • Screenshot Comment List Resource
  • Screenshot Comment List Resource
  • Draft Diff List Resource
  • Draft Diff Resource
  • Draft Diff Commit List Resource
  • Draft File Diff List Resource
  • Draft Diff Resource
  • Draft Diff Commit List Resource
  • Draft Diff Commit Resource
  • Draft File Diff List Resource
  • Draft File Diff Resource
  • Draft Diff Commit List Resource
  • Draft Diff Commit Resource
  • Draft Diff Commit Resource
  • Draft File Diff List Resource
  • Draft File Diff Resource
  • Draft Original File Resource
  • Draft Patched File Resource
  • Draft File Diff Resource
  • Draft Original File Resource
  • Draft Patched File Resource
  • Draft File Attachment List Resource
  • Draft File Attachment Resource
  • Draft File Attachment Resource
  • Draft Original File Resource
  • Draft Patched File Resource
  • Draft Screenshot List Resource
  • Draft Screenshot Resource
  • Draft Screenshot Resource
  • Review Request Draft Resource
  • Draft Diff List Resource
  • Draft Diff Resource
  • Draft File Attachment List Resource
  • Draft File Attachment Resource
  • Draft Screenshot List Resource
  • Draft Screenshot Resource
  • Root Review List Resource
  • Root Diff Comment List Resource
  • Root File Attachment Comment List Resource
  • Root General Comment List Resource
  • Review List Resource
  • Review Resource
  • Review Diff Comment List Resource
  • Review File Attachment Comment List Resource
  • Review General Comment List Resource
  • Review Reply List Resource
  • Review Screenshot Comment List Resource
  • Review Draft Resource
  • Review Resource
  • Review Diff Comment List Resource
  • Review Diff Comment Resource
  • Review File Attachment Comment List Resource
  • Review File Attachment Comment Resource
  • Review General Comment List Resource
  • Review General Comment Resource
  • Review Reply List Resource
  • Review Reply Resource
  • Review Reply Draft Resource
  • Review Screenshot Comment List Resource
  • Review Screenshot Comment Resource
  • Review Draft Resource
  • Review Diff Comment List Resource
  • Review Diff Comment Resource
  • Review Diff Comment Resource
  • Review File Attachment Comment List Resource
  • Review File Attachment Comment Resource
  • Review File Attachment Comment Resource
  • Review General Comment List Resource
  • Review General Comment Resource
  • Review General Comment Resource
  • Review Screenshot Comment List Resource
  • Review Screenshot Comment Resource
  • Review Screenshot Comment Resource
  • Review Reply Draft Resource
  • Review Reply List Resource
  • Review Reply Resource
  • Review Reply Diff Comment List Resource
  • Review Reply File Attachment Comment List Resource
  • Review Reply General Comment List Resource
  • Review Reply Screenshot Comment List Resource
  • Review Reply Draft Resource
  • Review Reply Resource
  • Review Reply Diff Comment List Resource
  • Review Reply Diff Comment Resource
  • Review Reply File Attachment Comment List Resource
  • Review Reply File Attachment Comment Resource
  • Review Reply General Comment List Resource
  • Review Reply General Comment Resource
  • Review Reply Screenshot Comment List Resource
  • Review Reply Screenshot Comment Resource
  • Review Reply Diff Comment List Resource
  • Review Reply Diff Comment Resource
  • Review Reply Diff Comment Resource
  • Review Reply File Attachment Comment List Resource
  • Review Reply File Attachment Comment Resource
  • Review Reply File Attachment Comment Resource
  • Review Reply General Comment List Resource
  • Review Reply General Comment Resource
  • Review Reply General Comment Resource
  • Review Reply Screenshot Comment List Resource
  • Review Reply Screenshot Comment Resource
  • Review Reply Screenshot Comment Resource
  • Search Resource
  • Status Update List Resource
  • Status Update Resource
  • Status Update Resource
  • API Token List Resource
  • API Token Resource
  • API Token Resource
  • Archived Review Request List Resource
  • Archived Review Request Resource
  • Archived Review Request Resource
  • Muted Review Request List Resource
  • Muted Review Request Resource
  • Muted Review Request Resource
  • Session Resource
  • User List Resource
  • User Resource
  • API Token List Resource
  • Archived Review Request List Resource
  • Muted Review Request List Resource
  • User File Attachment List Resource
  • Watched List Resource
  • User Resource
  • API Token List Resource
  • API Token Resource
  • Archived Review Request List Resource
  • Archived Review Request Resource
  • Muted Review Request List Resource
  • Muted Review Request Resource
  • User File Attachment List Resource
  • User File Attachment Resource
  • Watched List Resource
  • Watched Review Group List Resource
  • Watched Review Request List Resource
  • User File Attachment List Resource
  • User File Attachment Resource
  • User File Attachment Resource
  • Watched Review Group List Resource
  • Watched Review Group Resource
  • Watched Review Group Resource
  • Watched Review Request List Resource
  • Watched Review Request Resource
  • Watched Review Request Resource
  • Watched List Resource
  • Watched Review Group List Resource
  • Watched Review Group Resource
  • Watched Review Request List Resource
  • Watched Review Request Resource
  • Validation List Resource
  • Validate Diff List Resource
  • Validate Diff Commit List Resource
  • Validate Diff List Resource
  • Validate Diff Commit List Resource
  • WebHook List Resource
  • WebHook Resource
  • WebHook Resource
  • Errors
  • 100 - Does Not Exist
  • 101 - Permission Denied
  • 102 - Invalid Attribute
  • 103 - Not Logged In
  • 104 - Login Failed
  • 105 - Invalid Form Data
  • 106 - Missing Attribute
  • 107 - Enable Extension Failed
  • 108 - Disable Extension Failed
  • 109 - Extension Already Installed
  • 110 - Install Extension Failed
  • 111 - Duplicate Item
  • 112 - OAuth2 Missing Scope Error
  • 113 - OAuth2 Access Denied Error
  • 114 - Rate Limit Exceeded
  • 203 - Invalid Change Number
  • 204 - Change Number In Use
  • 205 - Missing Repository
  • 206 - Invalid Repository
  • 207 - Repository File Not Found
  • 208 - Invalid User
  • 209 - Repository Action Not Supported
  • 210 - Repository Information Error
  • 212 - Empty Changeset
  • 213 - Server Configuration Error
  • 214 - Bad Host Key
  • 215 - Unverified Host Key
  • 216 - Unverified Host Certificate
  • 217 - Missing User Key
  • 218 - Repository Authentication Error
  • 219 - Diff Empty
  • 220 - Diff Too Big
  • 221 - File Retrieval Error
  • 222 - Hosting Service Authentication Error
  • 223 - Group Already Exists
  • 224 - Diff Parse Error
  • 225 - Publish Error
  • 226 - User Query Error
  • 227 - Commit ID Already Exists
  • 228 - Token Generation Failed
  • 230 - Could not close review request
  • 231 - Could not reopen review request
  • 232 - Ship-It Revocation Error
  • Glossary
  • Extending Review Board
  • Extension Files/Package Layout
  • Creating an Extension Class
  • Extension Configuration
  • Database Models
  • Extension Static Media Files
  • JavaScript Extensions
  • Testing Extensions
  • Extension Distribution
  • Writing Review Board Extensions
  • The rbext Tool
  • Extension Hooks
  • AccountPageFormsHook
  • AccountPagesHook
  • Action Hooks
  • AdminWidgetHook
  • APIExtraDataAccessHook
  • AuthBackendHook
  • AvatarServiceHook
  • CommentDetailDisplayHook
  • DashboardColumnsHook
  • DashboardSidebarItemsHook
  • DataGridColumnsHook
  • EmailHook
  • ReviewRequestPublishedEmailHook
  • ReviewRequestClosedEmailHook
  • ReviewPublishedEmailHook
  • ReviewReplyPublishedEmailHook
  • FileAttachmentThumbnailHook
  • FileDiffACLHook
  • HostingServiceHook
  • IntegrationHook
  • NavigationBarHook
  • ReviewRequestApprovalHook
  • ReviewRequestFieldsHook
  • ReviewRequestFieldSetsHook
  • ReviewUIHook
  • SCMToolHook
  • SignalHook
  • TemplateHook
  • URLHook
  • UserInfoboxHook
  • UserPageSidebarItemsHook
  • WebAPICapabilitiesHook
  • JavaScript Extension Hooks
  • CommentDialogHook
  • FileAttachmentThumbnailContainerHook
  • ReviewDialogCommentHook
  • ReviewDialogHook
  • Adding Review Request Fields
  • Review UI Integration
  • Writing Authentication Backends
  • Writing Legacy Authentication Backends
  • Extending the Web API
  • Module and Class References
  • reviewboard
  • reviewboard.deprecation
  • reviewboard.rb_platform
  • reviewboard.signals
  • reviewboard.accounts.backends
  • reviewboard.accounts.backends.ad
  • reviewboard.accounts.backends.base
  • reviewboard.accounts.backends.http_digest
  • reviewboard.accounts.backends.ldap
  • reviewboard.accounts.backends.nis
  • reviewboard.accounts.backends.registry
  • reviewboard.accounts.backends.standard
  • reviewboard.accounts.backends.x509
  • reviewboard.accounts.decorators
  • reviewboard.accounts.errors
  • reviewboard.accounts.forms.auth
  • reviewboard.accounts.forms.pages
  • reviewboard.accounts.forms.registration
  • reviewboard.accounts.managers
  • reviewboard.accounts.middleware
  • reviewboard.accounts.mixins
  • reviewboard.accounts.models
  • reviewboard.accounts.pages
  • reviewboard.accounts.privacy
  • reviewboard.accounts.templatetags.accounts
  • reviewboard.accounts.testing
  • reviewboard.accounts.testing.queries
  • reviewboard.accounts.trophies
  • reviewboard.actions
  • reviewboard.actions.base
  • reviewboard.actions.errors
  • reviewboard.actions.registry
  • reviewboard.admin
  • reviewboard.admin.admin_sites
  • reviewboard.admin.cache_stats
  • reviewboard.admin.checks
  • reviewboard.admin.decorators
  • reviewboard.admin.form_widgets
  • reviewboard.admin.middleware
  • reviewboard.admin.model_admin
  • reviewboard.admin.security_checks
  • reviewboard.admin.server
  • reviewboard.admin.siteconfig
  • reviewboard.admin.support
  • reviewboard.admin.validation
  • reviewboard.admin.widgets
  • reviewboard.attachments.errors
  • reviewboard.attachments.forms
  • reviewboard.attachments.managers
  • reviewboard.attachments.mimetypes
  • reviewboard.attachments.models
  • reviewboard.avatars.registry
  • reviewboard.avatars.services
  • reviewboard.avatars.settings
  • reviewboard.avatars.templatetags.avatars
  • reviewboard.avatars.testcase
  • reviewboard.changedescs.models
  • reviewboard.datagrids.columns
  • reviewboard.datagrids.grids
  • reviewboard.datagrids.sidebar
  • reviewboard.diffviewer.chunk_generator
  • reviewboard.diffviewer.differ
  • reviewboard.diffviewer.diffutils
  • reviewboard.diffviewer.errors
  • reviewboard.diffviewer.forms
  • reviewboard.diffviewer.managers
  • reviewboard.diffviewer.models
  • reviewboard.diffviewer.models.diffcommit
  • reviewboard.diffviewer.models.diffset
  • reviewboard.diffviewer.models.diffset_history
  • reviewboard.diffviewer.models.filediff
  • reviewboard.diffviewer.models.legacy_file_diff_data
  • reviewboard.diffviewer.models.raw_file_diff_data
  • reviewboard.diffviewer.myersdiff
  • reviewboard.diffviewer.opcode_generator
  • reviewboard.diffviewer.parser
  • reviewboard.diffviewer.processors
  • reviewboard.diffviewer.renderers
  • reviewboard.diffviewer.smdiff
  • reviewboard.certs
  • reviewboard.certs.cert
  • reviewboard.certs.errors
  • reviewboard.extensions.base
  • reviewboard.extensions.hooks
  • reviewboard.extensions.packaging
  • reviewboard.extensions.testing
  • reviewboard.extensions.testing.testcases
  • reviewboard.hostingsvcs.base
  • reviewboard.hostingsvcs.base.client
  • reviewboard.hostingsvcs.base.forms
  • reviewboard.hostingsvcs.base.hosting_service
  • reviewboard.hostingsvcs.base.http
  • reviewboard.hostingsvcs.base.paginator
  • reviewboard.hostingsvcs.base.registry
  • reviewboard.hostingsvcs.base.repository
  • reviewboard.hostingsvcs.errors
  • reviewboard.hostingsvcs.forms
  • reviewboard.hostingsvcs.hook_utils
  • reviewboard.hostingsvcs.models
  • reviewboard.hostingsvcs.repository
  • reviewboard.hostingsvcs.service
  • reviewboard.hostingsvcs.testing
  • reviewboard.hostingsvcs.testing.testcases
  • reviewboard.hostingsvcs.utils.paginator
  • reviewboard.integrations
  • reviewboard.integrations.base
  • reviewboard.integrations.forms
  • reviewboard.integrations.models
  • reviewboard.integrations.urls
  • reviewboard.integrations.views
  • reviewboard.notifications
  • reviewboard.notifications.email
  • reviewboard.notifications.email.backend
  • reviewboard.notifications.email.decorators
  • reviewboard.notifications.email.hooks
  • reviewboard.notifications.email.message
  • reviewboard.notifications.email.utils
  • reviewboard.notifications.email.views
  • reviewboard.notifications.forms
  • reviewboard.notifications.managers
  • reviewboard.notifications.models
  • reviewboard.notifications.webhooks
  • reviewboard.reviews.actions
  • reviewboard.reviews.builtin_fields
  • reviewboard.reviews.chunk_generators
  • reviewboard.reviews.conditions
  • reviewboard.reviews.context
  • reviewboard.reviews.default_actions
  • reviewboard.reviews.detail
  • reviewboard.reviews.errors
  • reviewboard.reviews.features
  • reviewboard.reviews.fields
  • reviewboard.reviews.forms
  • reviewboard.reviews.managers
  • reviewboard.reviews.markdown_utils
  • reviewboard.reviews.models
  • reviewboard.reviews.signals
  • reviewboard.reviews.templatetags.reviewtags
  • reviewboard.reviews.testing
  • reviewboard.reviews.testing.queries
  • reviewboard.reviews.testing.queries.review_groups
  • reviewboard.reviews.testing.queries.review_requests
  • reviewboard.reviews.testing.queries.reviews
  • reviewboard.reviews.ui.base
  • reviewboard.reviews.ui.image
  • reviewboard.reviews.ui.markdownui
  • reviewboard.reviews.ui.text
  • reviewboard.reviews.views.attachments
  • reviewboard.reviews.views.bug_trackers
  • reviewboard.reviews.views.diff_fragments
  • reviewboard.reviews.views.diffviewer
  • reviewboard.reviews.views.download_diff
  • reviewboard.reviews.views.email
  • reviewboard.reviews.views.mixins
  • reviewboard.reviews.views.new_review_request
  • reviewboard.reviews.views.review_request_detail
  • reviewboard.reviews.views.review_request_infobox
  • reviewboard.reviews.views.review_request_updates
  • reviewboard.reviews.views.root
  • reviewboard.scmtools.certs
  • reviewboard.scmtools.conditions
  • reviewboard.scmtools.core
  • reviewboard.scmtools.crypto_utils
  • reviewboard.scmtools.errors
  • reviewboard.scmtools.forms
  • reviewboard.scmtools.managers
  • reviewboard.scmtools.models
  • reviewboard.scmtools.signals
  • reviewboard.scmtools.testing
  • reviewboard.scmtools.testing.queries
  • reviewboard.scmtools.tests.testcases
  • reviewboard.search.fields
  • reviewboard.search.forms
  • reviewboard.search.indexes
  • reviewboard.search.search_backends.base
  • reviewboard.search.search_backends.elasticsearch
  • reviewboard.search.search_backends.registry
  • reviewboard.search.search_backends.whoosh
  • reviewboard.search.signal_processor
  • reviewboard.search.testing
  • reviewboard.site.conditions
  • reviewboard.site.context_processors
  • reviewboard.site.decorators
  • reviewboard.site.middleware
  • reviewboard.site.mixins
  • reviewboard.site.models
  • reviewboard.site.signals
  • reviewboard.site.templatetags.localsite
  • reviewboard.site.testing
  • reviewboard.site.testing.queries
  • reviewboard.site.urlresolvers
  • reviewboard.site.validation
  • reviewboard.ssh.client
  • reviewboard.ssh.errors
  • reviewboard.ssh.policy
  • reviewboard.ssh.storage
  • reviewboard.ssh.utils
  • reviewboard.testing.hosting_services
  • reviewboard.testing.queries
  • reviewboard.testing.queries.base
  • reviewboard.testing.queries.http
  • reviewboard.testing.scmtool
  • reviewboard.testing.testcase
  • reviewboard.themes
  • reviewboard.themes.context_processors
  • reviewboard.themes.ui
  • reviewboard.themes.ui.base
  • reviewboard.themes.ui.default
  • reviewboard.themes.ui.registry
  • reviewboard.webapi.auth_backends
  • reviewboard.webapi.base
  • reviewboard.webapi.decorators
  • reviewboard.webapi.errors
  • reviewboard.webapi.mixins
  • reviewboard.webapi.models
  • reviewboard.webapi.server_info
  • reviewboard.webapi.testing
  • reviewboard.webapi.testing.queries
  • reviewboard.webapi.tests.base
  • Frequently Asked Questions
  • General Index
  • Python Module Index
  • Release Notes
  • reviewboard.diffviewer.diffutils¶

    Utilities for processing and generating diffs.

    CHUNK_RANGE_RE = re.compile(b'^@@ -(?P<orig_start>\\d+)(,(?P<orig_len>\\d+))? \\+(?P<modified_start>\\d+)(,(?P<modified_len>\\d+))? @@', re.MULTILINE)[source]¶

    A regex for matching a diff chunk header.

    New in version 3.0.18.

    class SerializedDiffFile[source]¶

    Bases: TypedDict

    Serialized information on a diff file.

    New in version 7.0.

    base_filediff: Optional[FileDiff]¶

    The FileDiff for the base of a commit range diff.

    binary: bool¶

    Whether the file is binary.

    chunks_loaded: bool¶

    Whether the diff chunks have been loaded.

    copied: bool¶

    Whether the file was copied from another location.

    deleted: bool¶

    Whether the file was deleted.

    filediff: FileDiff¶

    The FileDiff for the file.

    force_interdiff: bool¶

    Whether to force rendering an interdiff.

    This is used to show correct interdiffs for files that were reverted in later versions.

    force_interdiff_revision: NotRequired[int]¶

    The revision to use when forcing an interdiff.

    index: int¶

    The index of the file within the change.

    interfilediff: Optional[FileDiff]¶

    The interdiff FileDiff to use.

    is_new_file: bool¶

    Whether the file should be rendered as a new file.

    is_symlink: bool¶

    Whether the file is a symbolic link.

    modified_filename: str¶

    The filename for the modified version of the file.

    modified_revision: str¶

    The revision for the modified version of the file.

    This may not always be a real revision, depending on the type of SCM in use.

    moved: bool¶

    Whether the file was moved from another location.

    moved_or_copied: bool¶

    Whether the file was either moved or copied.

    newfile: bool¶

    Whether the file was a new file in the original diff.

    orig_filename: str¶

    The filename for the original version of the file.

    orig_revision: str¶

    The revision for the original version of the file.

    public: bool¶

    Whether this file is part of a published diff.

    __annotations__ = {'base_filediff': ForwardRef('Optional[FileDiff]', module='reviewboard.diffviewer.diffutils'), 'binary': ForwardRef('bool', module='reviewboard.diffviewer.diffutils'), 'chunks_loaded': ForwardRef('bool', module='reviewboard.diffviewer.diffutils'), 'copied': ForwardRef('bool', module='reviewboard.diffviewer.diffutils'), 'deleted': ForwardRef('bool', module='reviewboard.diffviewer.diffutils'), 'filediff': ForwardRef('FileDiff', module='reviewboard.diffviewer.diffutils'), 'force_interdiff': ForwardRef('bool', module='reviewboard.diffviewer.diffutils'), 'force_interdiff_revision': ForwardRef('NotRequired[int]', module='reviewboard.diffviewer.diffutils'), 'index': ForwardRef('int', module='reviewboard.diffviewer.diffutils'), 'interfilediff': ForwardRef('Optional[FileDiff]', module='reviewboard.diffviewer.diffutils'), 'is_new_file': ForwardRef('bool', module='reviewboard.diffviewer.diffutils'), 'is_symlink': ForwardRef('bool', module='reviewboard.diffviewer.diffutils'), 'modified_filename': ForwardRef('str', module='reviewboard.diffviewer.diffutils'), 'modified_revision': ForwardRef('str', module='reviewboard.diffviewer.diffutils'), 'moved': ForwardRef('bool', module='reviewboard.diffviewer.diffutils'), 'moved_or_copied': ForwardRef('bool', module='reviewboard.diffviewer.diffutils'), 'newfile': ForwardRef('bool', module='reviewboard.diffviewer.diffutils'), 'orig_filename': ForwardRef('str', module='reviewboard.diffviewer.diffutils'), 'orig_revision': ForwardRef('str', module='reviewboard.diffviewer.diffutils'), 'public': ForwardRef('bool', module='reviewboard.diffviewer.diffutils')}¶
    __closed__ = False¶
    __extra_items__ = None¶
    __mutable_keys__ = frozenset({'base_filediff', 'binary', 'chunks_loaded', 'copied', 'deleted', 'filediff', 'force_interdiff', 'force_interdiff_revision', 'index', 'interfilediff', 'is_new_file', 'is_symlink', 'modified_filename', 'modified_revision', 'moved', 'moved_or_copied', 'newfile', 'orig_filename', 'orig_revision', 'public'})¶
    __optional_keys__ = frozenset({})¶
    __orig_bases__ = (<function TypedDict>,)¶
    __readonly_keys__ = frozenset({})¶
    __required_keys__ = frozenset({'base_filediff', 'binary', 'chunks_loaded', 'copied', 'deleted', 'filediff', 'force_interdiff', 'force_interdiff_revision', 'index', 'interfilediff', 'is_new_file', 'is_symlink', 'modified_filename', 'modified_revision', 'moved', 'moved_or_copied', 'newfile', 'orig_filename', 'orig_revision', 'public'})¶
    __total__ = True¶
    convert_to_unicode(s, encoding_list)[source]¶

    Return the passed string as a unicode object.

    If conversion to unicode fails, we try the user-specified encoding, which defaults to ISO 8859-15. This can be overridden by users inside the repository configuration, which gives users repository-level control over file encodings.

    Ideally, we’d like to have per-file encodings, but this is hard. The best we can do now is a comma-separated list of things to try.

    Returns the encoding type which was used and the decoded unicode object.

    Parameters:
    • s (bytes or bytearray or unicode) – The string to convert to Unicode.

    • encoding_list (list of unicode) – The list of encodings to try.

    Returns:

    A tuple with the following information:

    1. A compatible encoding (unicode).

    2. The Unicode data (unicode).

    Return type:

    tuple

    Raises:
    • TypeError – The provided value was not a Unicode string, byte string, or a byte array.

    • UnicodeDecodeError – None of the encoding types were valid for the provided string.

    convert_line_endings(data)[source]¶

    Convert line endings in a file.

    Some types of repositories provide files with a single trailing Carriage Return (\r), even if the rest of the file used a CRLF (\r\n) throughout. In these cases, GNU diff will add a \ No newline at end of file to the end of the diff, which GNU patch understands and will apply to files with just a trailing \r.

    However, we normalize \r to \n, which breaks GNU patch in these cases. This function works around this by removing the last \r and then converting standard types of newlines to a \n.

    This is not meant for use in providing byte-compatible versions of files, but rather to help with comparing lines-for-lines in situations where two versions of a file may come from different platforms with different newlines.

    Parameters:

    data (bytes or unicode) – A string to normalize. This supports either byte strings or Unicode strings.

    Returns:

    The data with newlines converted, in the original string type.

    Return type:

    bytes or unicode

    Raises:

    TypeError – The data argument provided is not a byte string or Unicode string.

    split_line_endings(data: AnyStr) → list[AnyStr][source]¶

    Split a string into lines while preserving all non-CRLF characters.

    Unlike str.splitlines(), this will only split on the following character sequences: \n, \r, \r\n, and \r\r\n.

    This is needed to prevent the sort of issues encountered with Unicode strings when calling str.splitlines`(), which is that form feed characters would be split. patch and diff accept form feed characters as valid characters in diffs, and doesn’t treat them as newlines, but str.splitlines() will treat it as a newline anyway.

    Parameters:

    data (bytes or unicode) – The data to split into lines.

    Returns:

    The list of lines.

    Return type:

    list of bytes or unicode

    patch(diff: bytes, orig_file: bytes, filename: str, request: Optional[HttpRequest] = None, *, workaround_errors: bool = True) → bytes[source]¶

    Apply a diff to a file.

    This delegates out to patch because no one except Larry Wall knows how to patch.

    If patching fails, this may attempt to work around the patch error, depending on the nature of the error. The end result may be a viewable diff, but may not be a byte-for-byte copy of the expected final patched file.

    Currently, patch workarounds only support the case where a file being patched does not end in a newline and the diff is missing a \ No newline at end of file marker.

    If patching fails and can’t be worked around, the diff, reject file, original file, and patched file will be made available to the caller via the reviewboard.diffutils.errors.PatchError exception.

    Changed in version 7.0.3: Added mitigation workarounds for certain types of bad diffs. This is controlled via the new workaround_errors.

    Parameters:
    • diff (bytes) – The contents of the diff to apply.

    • orig_file (bytes) – The contents of the original file.

    • filename (unicode) – The name of the file being patched.

    • request (django.http.HttpRequest, optional) – The HTTP request, for use in logging.

    • workaround_errors (bool, optional) –

      Whether to attempt to work around errors encountered during patching.

      New in version 7.0.3.

    Returns:

    The contents of the patched file.

    Return type:

    bytes

    Raises:

    reviewboard.diffutils.errors.PatchError – An error occurred when trying to apply the patch.

    get_original_file_from_repo(filediff, request=None)[source]¶

    Return the pre-patched file for the FileDiff from the repository.

    The parent diff will be applied if it exists.

    New in version 4.0.

    Changed in version 5.0: Removed the old encoding_list parameter.

    Parameters:
    • filediff (reviewboard.diffviewer.models.filediff.FileDiff) – The FileDiff to retrieve the pre-patch file for.

    • request (django.http.HttpRequest, optional) – The HTTP request from the client.

    Returns:

    The pre-patched file.

    Return type:

    bytes

    Raises:
    • UnicodeDecodeError – The source file was not compatible with any of the available encodings.

    • reviewboard.diffutils.errors.PatchError – An error occurred when trying to apply the patch.

    • reviewboard.scmtools.errors.SCMError – An error occurred while computing the pre-patch file.

    get_original_file(filediff, request=None)[source]¶

    Return the pre-patch file of a FileDiff.

    Changed in version 4.0: The encoding_list parameter should no longer be provided by callers. Encoding lists are now calculated automatically. Passing a custom list with override the calculated one.

    Changed in version 5.0: The encoding_list parameter has been removed. Encoding lists are now calculated automatically.

    Parameters:
    • filediff (reviewboard.diffviewer.models.filediff.FileDiff) – The FileDiff to retrieve the pre-patch file for.

    • request (django.http.HttpRequest, optional) – The HTTP request from the client.

    Returns:

    The pre-patch file.

    Return type:

    bytes

    Raises:
    • UnicodeDecodeError – The source file was not compatible with any of the available encodings.

    • reviewboard.diffutils.errors.PatchError – An error occurred when trying to apply the patch.

    • reviewboard.scmtools.errors.SCMError – An error occurred while computing the pre-patch file.

    get_patched_file(source_data, filediff, request=None)[source]¶

    Return the patched version of a file.

    This will normalize the patch, applying any changes needed for the repository, and then patch the provided data with the patch contents.

    Parameters:
    • source_data (bytes) – The file contents to patch.

    • filediff (reviewboard.diffviewer.models.filediff.FileDiff) – The FileDiff representing the patch.

    • request (django.http.HttpClient, optional) – The HTTP request from the client.

    Returns:

    The patched file contents.

    Return type:

    bytes

    get_original_and_patched_files(filediff: FileDiff, request: Optional[HttpRequest] = None, update_mimetypes: bool = True) → tuple[Optional[bytes], Optional[bytes]][source]¶

    Return the original and patched version of a file.

    Parameters:
    • filediff (reviewboard.diffviewer.models.filediff.FileDiff) – The filediff to fetch versions for.

    • request (django.http.HttpRequest, optional) – The request object.

    • update_mimetypes (bool, optional) – Whether to store the detected mimetypes of the old and new versions in the filediff extra_data.

    Returns:

    A 2-tuple with the following items:

    Tuple:
    • 0 (bytes) – The original version of the file.

    • 1 (bytes) – The patched version of the file.

    Return type:

    tuple

    get_revision_str(revision)[source]¶
    get_filenames_match_patterns(patterns, filenames)[source]¶

    Return whether any of the filenames match any of the patterns.

    This is used to compare a list of filenames to a list of patterns. The patterns are case-sensitive.

    Parameters:
    • patterns (list of unicode) – The list of patterns to match against.

    • filename (list of unicode) – The list of filenames.

    Returns:

    True if any filenames match any patterns. False if none match.

    Return type:

    bool

    get_filediff_encodings(filediff)[source]¶

    Return a list of encodings to try for a FileDiff’s source text.

    If the FileDiff already has a known encoding stored, then it will take priority. The provided encoding list, or the repository’s list of configured encodingfs, will be provided as fallbacks.

    Changed in version 5.0: The encoding_list parameter has been removed.

    Parameters:

    filediff (reviewboard.diffviewer.models.filediff.FileDiff) – The FileDiff to return encodings for.

    Returns:

    The list of encodings to try for the source file.

    Return type:

    list of unicode

    get_matched_interdiff_files(tool, filediffs, interfilediffs)[source]¶

    Generate pairs of matched files for display in interdiffs.

    This compares a list of filediffs and a list of interfilediffs, attempting to best match up the files in both for display in the diff viewer.

    This will prioritize matches that share a common source filename, destination filename, and new/deleted state. Failing that, matches that share a common source filename are paired off.

    Any entries in interfilediffs` that don't have any match in ``filediffs are considered new changes in the interdiff, and any entries in filediffs that don’t have entries in interfilediffs are considered reverted changes.

    Parameters:
    • tool (reviewboard.scmtools.core.SCMTool) – The tool used for all these diffs.

    • filediffs (list of reviewboard.diffviewer.models.filediff.FileDiff) – The list of filediffs on the left-hand side of the diff range.

    • interfilediffs (list of reviewboard.diffviewer.models.filediff.FileDiff) – The list of filediffs on the right-hand side of the diff range.

    Yields:

    tuple – A paired off filediff match. This is a tuple containing two entries, each a FileDiff or None.

    get_filediffs_match(filediff1, filediff2)[source]¶

    Return whether two FileDiffs effectively match.

    This is primarily checking that the patched version of two files are going to be basically the same.

    This will first check that we even have both FileDiffs. Assuming we have both, this will check the diff for equality. If not equal, we at least check that both files were deleted (which is equivalent to being equal).

    The patched SHAs are then checked. These would be generated as part of the diff viewing process, so may not be available. We prioritize the SHA256 hashes (introduced in Review Board 4.0), and fall back on SHA1 hashes if not present.

    Parameters:
    • filediff1 (reviewboard.diffviewer.models.filediff.FileDiff) – The first FileDiff to compare.

    • filediff2 (reviewboard.diffviewer.models.filediff.FileDiff) – The second FileDiff to compare.

    Returns:

    True if both FileDiffs effectively match. False if they do not.

    Return type:

    bool

    Raises:

    ValueError – None was provided for both filediff1 and filediff2.

    get_diff_files(diffset: DiffSet, filediff: Optional[FileDiff] = None, interdiffset: Optional[DiffSet] = None, interfilediff: Optional[FileDiff] = None, base_filediff: Optional[FileDiff] = None, request: Optional[HttpRequest] = None, filename_patterns: Optional[list[str]] = None, base_commit: Optional[DiffCommit] = None, tip_commit: Optional[DiffCommit] = None) → list[SerializedDiffFile][source]¶

    Return a list of files that will be displayed in a diff.

    This will go through the given diffset/interdiffset, or a given filediff within that diffset, and generate the list of files that will be displayed. This file list will contain a bunch of metadata on the files, such as the index, original/modified names, revisions, associated filediffs/diffsets, and so on.

    This can be used along with populate_diff_chunks() to build a full list containing all diff chunks used for rendering a side-by-side diff.

    Parameters:
    • diffset (reviewboard.diffviewer.models.diffset.DiffSet) – The diffset containing the files to return.

    • filediff (reviewboard.diffviewer.models.filediff.FileDiff, optional) – A specific file in the diff to return information for.

    • interdiffset (reviewboard.diffviewer.models.diffset.DiffSet, optional) – A second diffset used for an interdiff range.

    • interfilediff (reviewboard.diffviewer.models.filediff.FileDiff, optional) –

      A second specific file in interdiffset used to return information for. This should be provided if filediff and interdiffset are both provided. If it’s None in this case, then the diff will be shown as reverted for this file.

      This may not be provided if base_filediff is provided.

    • base_filediff (reviewbaord.diffviewer.models.filediff.FileDiff, optional) –

      The base FileDiff to use.

      This may only be provided if filediff is provided and interfilediff is not.

    • filename_patterns (list of str, optional) – A list of filenames or patterns used to limit the results. Each of these will be matched against the original and modified file of diffs and interdiffs.

    • base_commit (reviewboard.diffviewer.models.diffcommit.DiffCommit, optional) –

      An optional base commit. No FileDiffs from commits before that commit will be included in the results.

      This argument only applies to DiffSets with DiffCommits.

    • tip_commit (reviewboard.diffviewer.models.diffcommit.DiffSet, optional) –

      An optional tip commit. No FileDiffs from commits after that commit will be included in the results.

      This argument only applies to DiffSets with DiffCommits.

    Returns:

    A list of dictionaries containing information on the files to show in the diff, in the order in which they would be shown.

    Return type:

    list of dict

    populate_diff_chunks(files, *, request=None, diff_settings: DiffSettings)[source]¶

    Populate a list of diff files with chunk data.

    This accepts a list of files (generated by get_diff_files()) and generates diff chunk data for each file in the list. The chunk data is stored in memory in the file state.

    Changed in version 6.0:

    • Made all arguments other than files keyword-only.

    • Made the diff_settings argument mandatory.

    Parameters:
    • files (list of dict) – The list of diff files to generate chunks for.

    • request (django.http.HttpRequest, optional) – The HTTP request from the client.

    • diff_settings (reviewboard.diffviewer.settings.DiffSettings) –

      The settings used to control the display of diffs.

      New in version 5.0.2.

    get_file_from_filediff(context: dict[str, Any], filediff: FileDiff, interfilediff: Optional[FileDiff], *, diff_settings: DiffSettings, base_filediff: Optional[FileDiff] = None, base_commit: Optional[DiffCommit] = None, tip_commit: Optional[DiffCommit] = None) → Optional[dict[str, Any]][source]¶

    Return the files that corresponds to the filediff/interfilediff.

    This is primarily intended for use with templates. It takes a template context for looking up the user and for caching file lists, in order to improve performance and reduce lookup times for files that have already been fetched.

    This function returns either exactly one file or None.

    Changed in version 7.0:

    • Added base_filediff`, ``base_commit and tip_commit arguments.

    Changed in version 6.0:

    • Made diff_settings mandatory.

    Changed in version 5.0.2:

    • Added the optional diff_settings argument.

    Parameters:
    • context (dict) – Template context being used to render the diff.

    • filediff (reviewboard.diffviewer.models.filediff.FileDiff) – The filediff being rendered.

    • interfilediff (reviewboard.diffviewer.models.filediff.FileDiff, optional) – The optional filediff being used to render an interdiff.

    • diff_settings (reviewboard.diffviewer.settings.DiffSettings) –

      The settings used to control the display of diffs.

      New in version 5.0.2.

    • base_filediff (reviewbaord.diffviewer.models.filediff.FileDiff, optional) –

      The base FileDiff to use.

      This may only be provided if filediff is provided and interfilediff is not.

      New in version 7.0.

    • base_commit (reviewboard.diffviewer.models.diffcommit.DiffCommit, optional) –

      An optional base commit. No FileDiffs from commits before that commit will be included in the results.

      This argument only applies to DiffSets with DiffCommits.

      New in version 7.0.

    • tip_commit (reviewboard.diffviewer.models.diffcommit.DiffCommit, optional) –

      An optional tip commit. No FileDiffs from commits after that commit will be included in the results.

      This argument only applies to DiffSets with DiffCommits.

      New in version 7.0.

    Returns:

    The diff file information. If not found, this will return None.

    Return type:

    dict

    get_last_line_number_in_diff(context: dict[str, Any], filediff: FileDiff, interfilediff: Optional[FileDiff], *, diff_settings: DiffSettings, base_filediff: Optional[FileDiff] = None, base_commit: Optional[DiffCommit] = None, tip_commit: Optional[DiffCommit] = None) → int[source]¶

    Return the last virtual line number in the filediff/interfilediff.

    This returns the virtual line number to be used in expandable diff fragments.

    Changed in version 7.0:

    • Added base_filediff`, ``base_commit and tip_commit arguments.

    Changed in version 5.0.2:

    • Added the optional diff_settings argument.

    Parameters:
    • context (dict) – Template context being used to render the diff.

    • filediff (reviewboard.diffviewer.models.filediff.FileDiff) – The filediff being rendered.

    • interfilediff (reviewboard.diffviewer.models.filediff.FileDiff, optional) – The optional filediff being used to render an interdiff.

    • diff_settings (reviewboard.diffviewer.settings.DiffSettings) –

      The settings used to control the display of diffs.

      New in version 5.0.2.

    • base_filediff (reviewbaord.diffviewer.models.filediff.FileDiff, optional) –

      The base FileDiff to use.

      This may only be provided if filediff is provided and interfilediff is not.

      New in version 7.0.

    • base_commit (reviewboard.diffviewer.models.diffcommit.DiffCommit, optional) –

      An optional base commit. No FileDiffs from commits before that commit will be included in the results.

      This argument only applies to DiffSets with DiffCommits.

      New in version 7.0.

    • tip_commit (reviewboard.diffviewer.models.diffcommit.DiffCommit, optional) –

      An optional tip commit. No FileDiffs from commits after that commit will be included in the results.

      This argument only applies to DiffSets with DiffCommits.

      New in version 7.0.

    Returns:

    The last virtual line number.

    Return type:

    int

    get_last_header_before_line(context: dict[str, Any], filediff: FileDiff, interfilediff: Optional[FileDiff], target_line: int, *, diff_settings: DiffSettings, base_filediff: Optional[FileDiff] = None, base_commit: Optional[DiffCommit] = None, tip_commit: Optional[DiffCommit] = None) → dict[source]¶

    Return the last header that occurs before the given line.

    Changed in version 7.0:

    • Added the base_filediff, base_commit, and tip_commit arguments.

    Changed in version 5.0.2:

    • Added the optional diff_settings argument.

    Parameters:
    • context (dict) – Template context being used to render the diff.

    • filediff (reviewboard.diffviewer.models.filediff.FileDiff) – The filediff being rendered.

    • interfilediff (reviewboard.diffviewer.models.filediff.FileDiff) – The optional filediff being used to render an interdiff.

    • target_line (int) – The virtual line number that the header must be before.

    • diff_settings (reviewboard.diffviewer.settings.DiffSettings) –

      The settings used to control the display of diffs.

      New in version 5.0.2.

    • base_filediff (reviewbaord.diffviewer.models.filediff.FileDiff, optional) –

      The base FileDiff to use.

      This may only be provided if filediff is provided and interfilediff is not.

      New in version 7.0.

    • base_commit (reviewboard.diffviewer.models.diffcommit.DiffCommit, optional) –

      An optional base commit. No FileDiffs from commits before that commit will be included in the results.

      This argument only applies to DiffSets with DiffCommits.

      New in version 7.0.

    • tip_commit (reviewboard.diffviewer.models.diffcommit.DiffCommit, optional) –

      An optional tip commit. No FileDiffs from commits after that commit will be included in the results.

      This argument only applies to DiffSets with DiffCommits.

      New in version 7.0.

    Returns:

    Information on any headers found. See DiffSideBySideHeadersInfo for details.

    Return type:

    dict

    get_file_chunks_in_range(context: dict[str, Any], filediff: FileDiff, interfilediff: Optional[FileDiff], first_line: int, num_lines: int, *, diff_settings: DiffSettings, base_filediff: Optional[FileDiff] = None, base_commit: Optional[DiffCommit] = None, tip_commit: Optional[DiffCommit] = None) → Iterator[dict[str, Any]][source]¶

    Generate the chunks within a range of lines in the specified filediff.

    This is primarily intended for use with templates. It takes a template request context for looking up the user and for caching file lists, in order to improve performance and reduce lookup times for files that have already been fetched.

    See get_chunks_in_range() for information on the returned state of the chunks.

    Changed in version 7.0:

    • Added base_filediff, base_commit and tip_commit arguments.

    Changed in version 5.0.2:

    • Added the optional diff_settings argument.

    Parameters:
    • context (dict) – Template context being used to render the diff.

    • filediff (reviewboard.diffviewer.models.filediff.FileDiff) – The filediff being rendered.

    • interfilediff (reviewboard.diffviewer.models.filediff.FileDiff) – The optional filediff being used to render an interdiff.

    • first_line (int) – The first line number in the range.

    • num_lines (int) – The number of lines in the range.

    • diff_settings (reviewboard.diffviewer.settings.DiffSettings) –

      The settings used to control the display of diffs.

      New in version 5.0.2.

    • base_filediff (reviewbaord.diffviewer.models.filediff.FileDiff, optional) –

      The base FileDiff to use.

      This may only be provided if filediff is provided and interfilediff is not.

      New in version 7.0.

    • base_commit (reviewboard.diffviewer.models.diffcommit.DiffCommit, optional) –

      An optional base commit. No FileDiffs from commits before that commit will be included in the results.

      This argument only applies to DiffSets with DiffCommits.

      New in version 7.0.

    • tip_commit (reviewboard.diffviewer.models.diffcommit.DiffCommit, optional) –

      An optional tip commit. No FileDiffs from commits after that commit will be included in the results.

      This argument only applies to DiffSets with DiffCommits.

      New in version 7.0.

    Yields:

    DiffChunk – Each chunk in the range.

    get_chunks_in_range(chunks, first_line, num_lines)[source]¶

    Generate the chunks within a range of lines of a larger list of chunks.

    This takes a list of chunks, computes a subset of those chunks from the line ranges provided, and generates a new set of those chunks.

    Each returned chunk is a dictionary with the following fields:

    Variable

    Description

    change

    The change type (“equal”, “replace”, “insert”, “delete”)

    numlines

    The number of lines in the chunk.

    lines

    The list of lines in the chunk.

    meta

    A dictionary containing metadata on the chunk

    Each line in the list of lines is an array with the following data:

    Index

    Description

    0

    Virtual line number (union of the original and patched files)

    1

    Real line number in the original file

    2

    HTML markup of the original file

    3

    Changed regions of the original line (for “replace” chunks)

    4

    Real line number in the patched file

    5

    HTML markup of the patched file

    6

    Changed regions of the patched line (for “replace” chunks)

    7

    True if line consists of only whitespace changes

    get_line_changed_regions(oldline, newline)[source]¶

    Returns regions of changes between two similar lines.

    get_sorted_filediffs(filediffs: Sequence[_T], key: Optional[Callable[[_T], FileDiff]] = None) → Sequence[_T][source]¶

    Sorts a list of filediffs or filediff-wrapping objects.

    The list of filediffs will be sorted first by their base paths in ascending order.

    Within a base path, they’ll be sorted by base name (minus the extension) in ascending order.

    If two files have the same base path and base name, we’ll sort by the extension in descending order. This will make *.h sort ahead of *.c/*.cpp, for example.

    If the list being passed in is actually not a list of FileDiffs, it must provide a callable key parameter that will return a FileDiff for the given entry in the list. This will only be called once per item.

    Parameters:
    • filediffs (list of object) – The list of FileDiffs (or objects to convert to FileDiffs) to sort.

    • key (callable, optional) – The optional function used to transform sequences of items to FileDiffs.

    Returns:

    The sorted list of filediffs.

    Return type:

    list of reviewboard.diffviewer.models.FileDiff

    get_displayed_diff_line_ranges(chunks, first_vlinenum, last_vlinenum)[source]¶

    Return the displayed line ranges based on virtual line numbers.

    This takes the virtual line numbers (the index in the side-by-side diff lines) and returns the human-readable line numbers, the chunks they’re in, and mapped virtual line numbers.

    A virtual line range may start or end in a chunk not containing displayed line numbers (such as an “original” range starting/ending in an “insert” chunk). The resulting displayed line ranges will exclude these chunks.

    Parameters:
    • chunks (list of dict) – The list of chunks for the diff.

    • first_vlinenum (int) – The first virtual line number. This uses 1-based indexes.

    • last_vlinenum (int) – The last virtual line number. This uses 1-based indexes.

    Returns:

    A tuple of displayed line range information, containing 2 items.

    Each item will either be a dictionary of information, or None if there aren’t any displayed lines to show.

    The dictionary contains the following keys:

    display_range:

    A tuple containing the displayed line range.

    virtual_range:

    A tuple containing the virtual line range that display_range maps to.

    chunk_range:

    A tuple containing the beginning/ending chunks that display_range maps to.

    Return type:

    tuple

    Raises:

    ValueError – The range provided was invalid.

    get_diff_data_chunks_info(diff)[source]¶

    Return information on each chunk in a diff.

    This will scan through a unified diff file, looking for each chunk in the diff and returning information on their ranges and lines of context. This can be used to generate statistics on diffs and help map changed regions in diffs to lines of source files.

    New in version 3.0.18.

    Parameters:

    diff (bytes) – The diff data to scan.

    Returns:

    A list of chunk information dictionaries. Each entry has an orig and modified dictionary containing the following keys:

    chunk_start (int):

    The starting line number of the chunk shown in the diff, including any lines of context. This is 0-based.

    chunk_len (int):

    The length of the chunk shown in the diff, including any lines of context.

    changes_start (int):

    The starting line number of a range of changes shown in a chunk in the diff. This is after any lines of context and is 0-based.

    changes_len (int):

    The length of the changes shown in a chunk in the diff, excluding any lines of context.

    pre_lines_of_context (int):

    The number of lines of context before any changes in a chunk. If the chunk doesn’t have any changes, this will contain all lines of context otherwise shown around changes in the other region in this entry.

    post_lines_of_context (int):

    The number of lines of context after any changes in a chunk. If the chunk doesn’t have any changes, this will be 0.

    Return type:

    list of dict

    check_diff_size(diff_file, parent_diff_file=None)[source]¶

    Check the size of the given diffs against the maximum allowed size.

    If either of the provided diffs are too large, an exception will be raised.

    Parameters:
    • diff_file (django.core.files.uploadedfile.UploadedFile) – The diff file.

    • parent_diff_file (django.core.files.uploadedfile.UploadedFile, optional) – The parent diff file, if any.

    Raises:

    reviewboard.diffviewer.errors.DiffTooBigError – The supplied files are too big.

    get_total_line_counts(files_qs)[source]¶

    Return the total line counts of all given FileDiffs.

    Parameters:

    files_qs (django.db.models.query.QuerySet) – The queryset descripting the FileDiffs.

    Returns:

    A dictionary with the following keys:

    • raw_insert_count

    • raw_delete_count

    • insert_count

    • delete_count

    • replace_count

    • equal_count

    • total_line_count

    Each entry maps to the sum of that line count type for all FileDiffs.

    Return type:

    dict

    Keep up with the latest Review Board releases, security updates, and helpful information.

    About
    News
    Demo
    RBCommons Hosting
    Integrations
    Happy Users
    Support Options
    Documentation
    FAQ
    User Manual
    RBTools
    Administration Guide
    Power Pack
    Release Notes
    Downloads
    Review Board
    RBTools
    Djblets
    Power Pack
    Package Store
    PGP Signatures
    Contributing
    Bug Tracker
    Submit Patches
    Development Setup
    Wiki
    Follow Us
    Mailing Lists
    Reddit
    Twitter
    Mastodon
    Facebook
    YouTube

    Copyright © 2006-2025 Beanbag, Inc. All rights reserved.

    Terms of Service — Privacy Policy — AI Ethics Policy — Branding

    On this page

    • [Top]
    • CHUNK_RANGE_RE
    • SerializedDiffFile
      • SerializedDiffFile.base_filediff
      • SerializedDiffFile.binary
      • SerializedDiffFile.chunks_loaded
      • SerializedDiffFile.copied
      • SerializedDiffFile.deleted
      • SerializedDiffFile.filediff
      • SerializedDiffFile.force_interdiff
      • SerializedDiffFile.force_interdiff_revision
      • SerializedDiffFile.index
      • SerializedDiffFile.interfilediff
      • SerializedDiffFile.is_new_file
      • SerializedDiffFile.is_symlink
      • SerializedDiffFile.modified_filename
      • SerializedDiffFile.modified_revision
      • SerializedDiffFile.moved
      • SerializedDiffFile.moved_or_copied
      • SerializedDiffFile.newfile
      • SerializedDiffFile.orig_filename
      • SerializedDiffFile.orig_revision
      • SerializedDiffFile.public
      • SerializedDiffFile.__annotations__
      • SerializedDiffFile.__closed__
      • SerializedDiffFile.__extra_items__
      • SerializedDiffFile.__mutable_keys__
      • SerializedDiffFile.__optional_keys__
      • SerializedDiffFile.__orig_bases__
      • SerializedDiffFile.__readonly_keys__
      • SerializedDiffFile.__required_keys__
      • SerializedDiffFile.__total__
    • convert_to_unicode()
    • convert_line_endings()
    • split_line_endings()
    • patch()
    • get_original_file_from_repo()
    • get_original_file()
    • get_patched_file()
    • get_original_and_patched_files()
    • get_revision_str()
    • get_filenames_match_patterns()
    • get_filediff_encodings()
    • get_matched_interdiff_files()
    • get_filediffs_match()
    • get_diff_files()
    • populate_diff_chunks()
    • get_file_from_filediff()
    • get_last_line_number_in_diff()
    • get_last_header_before_line()
    • get_file_chunks_in_range()
    • get_chunks_in_range()
    • get_line_changed_regions()
    • get_sorted_filediffs()
    • get_displayed_diff_line_ranges()
    • get_diff_data_chunks_info()
    • check_diff_size()
    • get_total_line_counts()