Version 6 (modified by anonymous, 5 years ago)

--

This is the developer wiki of Patchwork

Patchwork

Module design

Separation of GUI & program logic

One of the fundamental goals of Patchwork was to separate the logic of the repository communication from the GUI components. In this connection it is possible to develop the GUI independently from the interface and additionally the Patchwork GUI components could be used to manage other open source code management systems. In the moment the separation can only be used in a limited way (look at "known problems" section).

Patchwork source

In the following you can find the description which modules are included, where they are stored in the Patchwork source and which functions they execute:

Root

Patchwork.hs

This is a standalone application with its own main function. Dependant on the parameters of the commando shell (changes, push, pull) a main GUI will be created. If there is no parameter provided then a GUI window will be displayed where you can select from these options. In the current release there exists the following parameters for command shell:
help: Displays an overview of all provided parameters. This would also be called if the parameter can not be identified.
changes: Prints an overview of the repository patch history.
pull: Copies patches from another repository to a repository in which you are.
push: Copies patches from a repository in which you are to another repository.

Patchwork.DIL

This directory contains the DarcsInterfaceLayer (DIL). DIL builds the interface to darcs. Parts of the implementation were extracted or refactored from darcs. So the code is used redundant in the darcs code and in the Patchwork code. For the moment there were no other possibilities, because the darcs API is not totally opened and is also not primarily thought to be an API (see "known problems and possible future work"). DIL is divided into the following modules:

Data.hs

This module contains the types and access functions. As types there are PatchInfo and PatchInfoWithDeps.
PatchInfo: Patch data structure for the GUI
PatchInfoWithDeps: Patch with lists of dependencies

DarcsAPI.hs

This module provides functions to work with the repositories for example getting placed patches. Also it provides functions to convert darcs patches to GUI data structures.

Patchwork.GUI

Here you will find Grapefruit based darcs frontends. Following modules are available:

PatchView.hs

Circuit with a SetView, which shows the patch infos. This is not a discrete command of Patchwork and it will be used by other GUI-commands (changes, push, pull) to show patch infos.

Changes.hs

Shows a list of patches from the local repositories in a PatchView. This view is accessible under the command line via 'darcs changes'.

PushPull.hs

Provides the functions 'darcs push' and 'darcs pull' . The circuit is for both commands the same. Dependent on the mode (push or pull) only the input and output is different. There are two PatchViews included (local and remote repository). In the push mode the patches are in the 'local repository'-PatchView and in the pull mode they are in the 'remote repository'-PatchView. Using the arrow buttons („<<<“. „>>>“) to select and deselect patches. With the command buttons ('Push','Pull') the action can be executed.

Main.hs

This module is the main window from which all commands can be reached. This GUI window is called every time if no command parameter was passed.

Known problems and possible future work

Currently there exists a bug in push/pull functionality. The selection and takeover from patches works only correct for the first selection, for example in the case when you use the push mode from the local repository to remote repository. This malfunction is a known bug in Grapefruit and his developer works currently with all his passion to solve this problem. Is this problem solved a bug fix will be provided.
For developing Patchwork in a useful and fast way the communication between us and the darcs developers must be forced. The goal of the darcs developers should be to develop a better (native) API for eliminating the code redundancy (see Patchwork.DIL).
It seems wise for us to integrate Patchwork GUI directly into darcs. Currently the functionality was copied, splatted up and the input and output was processed directly in th GUI. The file PushPull.hs provides useful information and steps how to integrate Patchwork GUI into darcs.
The analysis of the darcs source code was difficult because many signifiers were not chosen meaningful enough and they were not defined well (for example us, us'). Also a rich use of comments in the code would be useful to us in the beginning. In this connection all these reasons are responsible for analyzing the code in a non easy way and new developers could be scared to start with it.
For shifting the code we use tabulators, which is known as a standard for formatting code. In contrast the darcs code is formatted with whitespaces which made it not so easy to adapt it.