SWTBot/Applying Patches

From Eclipsepedia

Jump to: navigation, search


SWTBot
Website
Update Sites
Community
Mailing List
Forums/Newsgroups
IRC
Contribute
Open Bugzilla tickets
Open Gerrit reviews
Browse Source
Continuous Integration


Contents

NOTICE FOR EDITORS

This page is intentionally verbose, lengthy and detail oriented. It is not intended for advanced developers, but for QAs to be able to apply a patch available on bugzilla or elsewhere to try out things and provide feedback.

Edit this page only if you know what the previous statements mean.

Introduction

This document describes the process of applying a patch to SWTBot, in order to add or change existing behavior, fix bugs etc.

What is a patch

A patch is generated using a diff program. Patches can be generated using the command line diff, or using eclipse. Eclipse has a built in diff program.

A patch is a text file that describes which particular lines were added or deleted from source files. A change to a particular line is a deletion and an addition. Here is how a patch looks in the raw format. What it actually means describes is a change that looks like this.

So what changed in that patch ?

  • In the findMenus() method the boolean was changed from true to false.
  • In the #doubleClick() method the click() was replaced with a lot of other methods, and a notifyTree(SWT.DefaultSelection) was added a few lines down from there.

So how do I apply the patch

While the patch file format is generally almost the same for most patches on the eclipse bugzilla, there are a few variations, based on where the diff is applied.

  • Patches for the entire workspace 'workspace patch'
  • Patches for a particular project/file
  • Patches using git.

Workspace patch

A workspace patch will have some metadata in it:

### Eclipse Workspace Patch 1.0
#P <project root>
...
#P <another project>

Git patch

Git patches come in two forms, with metadata and without metadata. You need not care what type of patch it is.

The important thing is that there is a line that looks like:

diff --git a/path/to/a/file.text b/path/to/a/file.txt