Knowledge Base Administration Guide

Diff'ing Regression Models

Simscope comes with Python plugin scripts which can diff the repository changes between multiple Regressions, for the following repository types:

  • External Web Diff: GitHub, GitLab, Bitbucket, or Azure DevOps (ADO)
  • Git: Self-Hosted
  • Perforce
  • Subversion
  • Mercurial

These scripts can be modified as desired, if you have custom workflow.

Example Regression Diff

This shows diffing two regressions:

Regression Diff


1. External Web Diff (GitHub, Gitlab, Bitbucket, or Azure DevOps)

Note: this plugin can be configured to work with any external web diff: GitHub, Gitlab, or Bitbucket

When using External Web Diff, this will redirect the user automatically to GitHub/Gitlab/Bitbucket and show colorized SHA diffs using the provider's differ.

Example from Github:

Github Diff

Live diff examples:

Install for Simscope

Edit the file simscope-regr-web-diff and change the following lines:

DIFF_URL_TEMPLATE = '' # Choose a DIFF_URL_TEMPLATE from below (depending on your provider)

# GitHub template
# DIFF_URL_TEMPLATE = 'https://github.com/%(repo)s/compare/%(old)s...%(new)s?diff=split'

# Gitlab template
# DIFF_URL_TEMPLATE = 'https://gitlab.com/%(repo)s/-/compare/%(old)s...%(new)s?view=parallel'

# Bitbucket template (note the SHA order is new..old)
# DIFF_URL_TEMPLATE = 'https://bitbucket.org/%(repo)s/compare/%(new)s..%(old)s?#diff'

# Azure DevOps template (note the format for repo is: "ORGANIZATION/PROJECT/_git/REPO"):
# DIFF_URL_TEMPLATE = 'https://dev.azure.com/%(repo)s/branchCompare?baseVersion=GC%(old)s&targetVersion=GC%(new)s&_a=files'

# Map from all Simscope [project] names => Provider [company/repo]
SIMSCOPE_PROJECT_TO_REPO = {
    'simscope_project0': 'mycompany/repo0',
    'simscope_project1': 'mycompany/repo1',

    # Format if using Azure DevOps:
    # 'simscope_project2': 'ORGNAME/PROJECT/_git/REPO',
}

To enable in Simscope, add the following to your simscope.config file:

# NOTE: rename "github" to: "gitlab", "bitbucket", or "azure" if you are using them
[regrplugin "diff-github"]
title = "GitHub Diff"
command = "PATH/simscope-regr-web-diff"

2. Git Diff (self-hosted)

If you have Git self-hosted on Linux (outside of Github/Gitlab/Bitbucket), you can run a command-line diff.

Sample diff of two regressions (using a Git diff python plugin):

Git Diff

Script

The git diff script is released at PATH/bin/regression/simscope-git-regr-diff .

NOTE: you may need to customize:

  • The #! (hash bang) to point to your version of Python.
  • The GIT_DIFF command (ie if you have a specific path to git, or if you want to use special diff/log arguments.

Install for Simscope

Add this to your simscope.config file and restart Simscope:

[regrplugin "diff-git"]
title = "Git Diff"
command = "PATH/simscope-git-regr-diff"

Debug

If you want to debug changes to the script, both STDOUT and STDERR will be rendered to the web browser.

For example, you can use standard Python print("message") to print a message and see it in the browser.


3. Perforce Diff

Sample diff of two regressions:

P4 Diff

Script

The perforce diff script is released at PATH/bin/regression/simscope-perforce-regr-diff .

NOTE: you will need to customize:

1. The `#!` (hash bang) to point to your version of Python.
2. P4PORT
3. P4USER
4. P4CLIENT
5. DEPOT_NAME

Also, the PERFORCE_CMD may need to be prefixed with your `p4` command path.

Install for Simscope

Add this to your simscope.config file and restart Simscope:

[regrplugin "diff-p4"]
title = "Perforce Diff"
command = "PATH/simscope-perforce-regr-diff"

4. Subversion (SVN) Diff

Notes:

  1. The Subversion (svn) diff executes via a server URL, so no workspace on disk is needed.
  2. You need to save your SVN authentication credentials to the Linux user running Simscope (~/.subversion/auth).

Sample diff of two regressions:

SVN Diff

Script

The svn diff script is released at PATH/bin/regression/simscope-svn-regr-diff .

NOTE: you may need to customize:

  • The #! (hash bang) to point to your version of Python.
  • The SVN_DIFF command (ie if you have a specific path to svn, or if you want to use special diff/log arguments.

Install for Simscope

Add this to your simscope.config file and restart Simscope:

[regrplugin "diff-svn"]
title = "SVN Diff"
command = "PATH/simscope-svn-regr-diff"