Chapter 16. Version Control


The generic form of version control commands is:

	:command file ...

Or:

	:command {attr = val} ... file ...

The commands use the "commit" attribute to define the kind of version control
system and its location.  For example:

	{commit = cvs://:ext:$CVSUSER_AAP@cvs.a-a-p.sf.net:/cvsroot/a-a-p}

These commands can be used:

:commit		Update the repository for each file that was changed.
		This is also done for a file that didn't change, it's up to
		the version control software to check for an unchanged file
		(it might have been changed in the repository).
		Do checkin/checkout when checkin is required.
		Don't change locking of the file.
		Uses "logentry" attribute when a log entry is to be done.
		Otherwise a standard message is used.
		Adds new files when needed.
		Creates directories when needed (CVS: only one level).

:checkout	Like fetch and additionally lock for editing when possible.

:checkin	Like commit, but unlock file.

:unlock		Remove lock on file, don't change file in repository or
		locally.

:add		Add file to repository.  File must exist locally.  Implies a
		"commit" of the file.

:remove		Remove file from repository.  File may exist locally.  Implies
		a "commit" of the file.

:tag		Add a tag to the current version.  Uses the "tag" attribute.

Additionally, there is the generic command:

	:verscont action {attr = val} ... file ...

This calls the Version control module as specified in the "commit" attribute
for "action" with the supplied arguments.  What happens is specific for the
VCS.

These commands work on all the files mentioned that have the "commit"
attribute:

:checkoutall
:checkoutall {attr = val}
		Checkout all files in the recipe (and child recipes) that have
		the "commit" attribute.  Locks the files.

:commitall
:commitall {attr = val}
		Commit all the files in the recipe (and child recipes) that
		have the "commit" attribute.  Files missing in the VCS will be
		added.  No files will be removed.

:checkinall
:checkinall {attr = val}
		Just like :commitall and also remove any locks.

:unlockall
:unlockall {attr = val}
		Unlock all files in the recipe (and child recipes) that have
		the "commit" attribute.

:addall [options] [directory] ...
:addall [options] {attr = val} ... [directory] ...
		Inspect directories and add items that do not exist in the VCS
		but are mentioned in the recipe(s) with a "commit" attribute.

		OPTIONS:
		{l} {local}	don't do current directory recursively
		{r} {recursive} do handle arguments recursively

		When no directory argument is given, the current directory is
		used.  It is inspected recursively, unless the "{local}"
		option was given.
		When directory arguments are given, each directory is
		inspected.  Recursively when the "{recursive}" option was
		given.
		When no "commit" attribute is specified here, it will be
		obtained from any node.

:removeall [options] [directory] ...
:removeall [options] {attr = val} ... [directory] ...
		Inspect directories and remove items that do exist in the VCS
		but are not mentioned or do not have a "commit" attribute.
		Careful: Only use this command when it is certain that all
		files that should be in the VCS are explicitly mentioned and
		do have a "commit" attribute!

		OPTIONS:
		{l} {local}	don't do current directory recursively
		{r} {recursive} do handle arguments recursively

		When no directory argument is given, the current directory is
		used.  It is inspected recursively, unless the "{local}"
		option was given.
		When directory arguments are given, each directory is
		inspected.  Recursively when the "{recursive}" option was
		given.
		When no "commit" attribute is specified here, it will be
		obtained from any node.

:reviseall
:reviseall {attr = val}
		Just like:
			:checkinall {attr = val}
			:removeall {attr = val} .

:tagall {tag = name}
		Add a tag to all items with a "commit" and "tag" attribute.
		The tag should be simple name without special characters (no
		dot or dash).

Related to these commands are targets that are handled automatically when not
defined explicitly.  When defining a target for these, it would be highly
unexpected if it works differently.

aap commit	Normally uses the files you currently have to update the
		version control system.  This can be used after you are done
		making a change.  Default is using ":commitall".

aap checkout	Update all files from the VCS that have a "commit" attribute.
		When the VCS supports locking all files will be locked.
		Without locking this does the same as "aap fetch".

aap checkin	Do ":checkin" for all files that have been checked out of the
		VCS.  For a VCS that doesn't do file locking this is the same
		as "aap commit".

aap unlock	Unlock all files that are locked in the VCS.  Doesn't change
		any files in the VCS or locally.

aap add		Do ":add" for all files that appear in the recipe with a
		"commit" attribute that do not appear in the VCS.

aap remove	Do ":removeall": remove all files that appear in the VCS but
		do not exist in the recipe with a "commit" attribute or do not
		exist in the local directory.  This works in the current
		directory and recursively enters all subdirectories.
		Careful: files with a search path may be accidentally removed!

aap tag		Do ":tagall": tag all files with a "commit" and "tag"
		attribute.  The tag name should be defined properly in the
		recipe, although "aap tag TAG=name" can be used if the recipe
		contains something like:
			:attr {tag = $TAG} $FILES

aap revise	Same as "aap checkin" followed by "aap remove": checkin all
		changed files, unlock all files and remove files that don't
		have the "commit" attribute.

For the above the "-l" or "--local" command line option can be used to
restrict the operation to the directory of the recipe and not recurse into
subdirectories.


When it's desired to commit one directory at a time the following construct
can be used:

	SOURCE = `glob("*.c")`
	INCLUDE = `glob("include/*.h")`
	commit-src {virtual}:
		:commit $SOURCE
		:removeall .
	commit-include {virtual}:
		:commit $INCLUDE
		:removeall include

Note that this is not possible when the sources and include files are in one
directory, ":removeall" only works per directory.