API changes from 6.x-1.x to 6.x-2.x

Last updated on
30 April 2025

TODO: List all changes in detail

Overview

The main design change is that Version Control API is now using OOP, to reflect his nature. Now each entity is a class: account, repository, backend, label, tag, branch, item and operation, all in the form Versioncontrol<name>, like VersioncontrolRepository(following dbtng way of naming classes).

You can also consult a doxygen output of the documentation. For explicit detail about the changes, you can git log before-oop..oop on the github repo, where it was originally developed.

List of function/method equivalents

In general we use to have function like versioncontrol_<entity>_<name> and now we have Versioncontrol_<entity>::<name>. Usually the entities passed on the old functions are already part of the object calling, so usually no more needed.

versioncontrol_account_username_suggestion($repository, $user)
VersioncontrolAccount::usernameSuggestion($user)

versioncontrol_get_repository()
VersioncontrolRepository::getRepository()

versioncontrol_get_repositories()
VersioncontrolRepository::getRepositories()

[versioncontrol_backend]_get_selected_label_from_operation()
Operation::getSelectedLabel()

[versioncontrol_backend]_get_selected_label_from_other_item()
Item::getSelectedLabelFromItem()

Removed functions

versioncontrol_get_backend($repository) is no more needed, as we now can do $repository->backend

The way to interact

Backends

In summary, we now need a VersioncontrolBackend child which have details about the backend implementation.
All optional points of interaction are implemented through interfaces.

All the usual _versioncontrol_call_backend($vcs, <entityname>, array(<action>, <entity>)) is now implemented as a protected method on the enity class, so now we call $this->_<action> from the right class. This is mainly on CRUD for all entities.

Also the versioncontrol_backend_implements() function called usually before a _versioncontrol_call_backend() is now implemented through interfaces.

Other details

  • author and commmiter instead of only username: change in versioncontrol_operations table, replacing username field with author and adding commiter field
  • labels and operations used to use VERSIONCONTROL_OPERATION_* constants, now there are VERSIONCONTROL_LABEL_{TAG,BRANCH} for labels

Help improve this page

Page status: Not set

You can: