Miscellaneous
Revision Control
While Git is fast becoming the de-facto standard revision control tool in many software domains, it is likely that some Origen application developers may still want to use something else. Origen provides a revision control system abstraction to help Origen users switch between apps that use different systems, and to help Origen and its plugins work within different revision control environments.
Currently the following systems are supported by the abstract API:
If you would like to see another system supported and you are willing to help us develop and pilot the driver for it, then please get in touch via the community channels.
The programmable API exposes a common set of methods to the application developer that will work regardless of the underlying system that is being used.
An revision control driver is created by instantiating a new revision controller instance, this requires a reference to the remote repository, and the path to the local root directory (which doesn’t have to exist yet):
rc = Origen::RevisionControl.new remote: "ssh://git@github.com:myaccount/myproj.git", local: "my/path"
rc.git? # => true
rc = Origen::RevisionControl.new remote: "sync://sync-15000:15000/myaccount/myproj", local: "my/path"
rc.dssc? # => true
rc = Origen::RevisionControl.new remote: "p4://server:port//myaccount/myproj", local: "my/path"
rc.p4? # => true
In the case of an Origen application, a short cut is available (assuming the application has
set config.rc_url
in config/application.rb
):
rc = Origen.app.rc
rc.git? # => true
This revision controller object provides the Revision Control API described here.
Here are some examples:
rc.local_modifications
# => ["lib/my_app/model1.rb", "lib/my_app/model2.rb", "lib/my_app/model3.rb", "lib/my_app/model4.rb"]
# Check in a single file
rc.checkin "lib/my_app/model2.rb"
rc.local_modifications # => ["lib/my_app/model1.rb", "lib/my_app/model3.rb", "lib/my_app/model4.rb"]
# Checkout latest version of a single file, forcing overwrite of local mods
rc.checkout "lib/my_app/model4.rb", force: true
rc.local_modifications # => ["lib/my_app/model1.rb", "lib/my_app/model3.rb"]
# Check in everything
rc.checkin comment: "Added a cool feature"
rc.local_modifications # => []
The origen rc
command uses this API to provide a universal command line
interface for working with revision control systems, thereby providing the following benefits to the user:
- Intimate knowledge of how the underlying revision control system works is not required, the command maintainers will ensure that you are using it in an efficient and correct way.
- The workflow remains the same regardless of what underlying revision control tool is used.
Here are some examples:
origen rc co # Checkout the latest version of the application, local edits will be merged
origen rc co -v v1.2.3 # As above but a specific version
origen rc co -f # As above but force overwrite of local edits
origen rc co file.txt # As above but on a specific file or directory, -v and -f will work to
origen rc ci # Check in the application
origen rc ci --unman # As above but also include files that are currently unmanaged
origen rc ci file.txt # Check in a specific file
origen rc new file.txt # Create the given file and check in an initial version of it
origen rc unman # Show unmanaged files
origen rc mods # Show modified files in local workspace
origen rc tag # Tag and release the application
See origen rc -h
for an up to date list of supported commands.
** Note on Perforce **
The Perforce revision control implementation currently only supports the ‘print’ command, which just downloads a file to a local path. This was developed to support Origen remotes using Perforce. None of the standard commands listed above are implemnted currently.