/*
 *	aegis - project change supervisor
 *	This file is in the Public Domain, 1999 Peter Miller.
 *
 * The fhist program was written by David I. Bell and is admirably
 * suited to providing a history mechanism with out the "cruft" that
 * SCCS and RCS impose.  The fhist program also comes with two other
 * utilities, fcomp and fmerge, which use the same minimal difference
 * algorithm.
 *
 * Please note that the [# edit #] feature needs to be avoided, or the
 * -Fored_Update (-fu) flag needs to be used in addition to the
 * -Conditional_Update (-cu) flag, otherwise updates will complain that
 * "Input file XXX contains edit A instead of B for module YYY"
 *
 * The history_create_command and the history_put_command are
 * intentionally identical.  This minimizes problems when using
 * branches.
 *
 * The ${quote ...} construct is used to quote filenames which contain
 * shell special characters.  A minimum of quoting is performed, so if
 * the filenames do not contain shell special characters, no quotes will
 * be used.
 */

/*
 * This command is used to create a new project history.  The command is
 * always executed as the project owner.  Note he the source is left in
 * the baseline.  The following substitutions are available:
 *
 * ${Input}
 *	absolute path of the source file
 * ${History}
 *	absolute path of the history file
 *
 * The history_create_command and the history_put_command are
 * intentionally identical.  This minimizes problems when using
 * branches.
 */
history_create_command =
	"fhist ${quote ${basename $history}} -create -cu -i ${quote $input} "
	"-p ${quote ${dirname $history}} -r";

/*
 * This command is used to get a specific edit back from history.  The
 * command may be executed by developers.  The following substitutions
 * are available:
 *
 * ${History}
 *	absolute path of the history file
 * ${Edit}
 *	edit number, as given by history_query_command
 * ${Output}
 *	absolute path of the destination file
 *
 * Note that the destination filename will never look anything like the
 * history source filename, so the -p is essential.
 */
history_get_command =
	"fhist ${quote ${basename $history}} -e ${quote $e} "
	"-o ${quote $output} -p ${quote ${dirname $history}}";

/*
 * This command is used to add a new "top-most" entry to the history
 * file.  This command is always executed as the project owner.  Note
 * that the source file is left in the baseline.  The following
 * substitutions are available:
 *
 * ${Input}
 *	absolute path of source file
 * ${History}
 *	absolute path of history file
 *
 * The history_create_command and the history_put_command are
 * intentionally identical.  This minimizes problems when using
 * branches.
 */
history_put_command =
	"fhist ${quote ${basename $history}} -create -cu -i ${quote $input} "
	"-p ${quote ${dirname $history}} -r";

/*
 * This command is used to query what the history mechanism calls the
 * "top-most" edit of a history file.  The result may be any arbitrary
 * string, it need not be anything like a number, just so long as it
 * uniquely identifies the edit for use by the history_get_command at a
 * later date.  The edit number is to be printed on the standard output.
 * This command may be executed by developers.  The following
 * substitutions are available:
 *
 * ${History}
 *	absolute path of the history file
 */
history_query_command =
	"fhist ${quote ${basename $history}} -l 0 "
	"-p ${quote ${dirname $history}} -q";

/*
 * Compare two files using fcomp.  The -w option produces an output of
 * the entire file, with insertions an deletions marked by "change bars"
 * in the left margin.  This is superior to context difference, as it
 * shows the entire file as context.  The -s option could be added to
 * compare runs of white space as equal.
 *
 * This command is used by aed(1) to produce a difference listing when
 * file in the development directory was originally copied from the
 * current version in the baseline.
 *
 * All of the command substitutions described in aesub(5) are available.
 * In addition, the following substitutions are also available:
 *
 * ${ORiginal}
 *	The absolute path name of a file containing the version
 *	originally copied.  Usually in the baseline.
 * ${Input}
 *	The absolute path name of the edited version of the file.
 *	Usually in the development directory.
 * ${Output}
 *	The absolute path name of the file in which to write the
 *	difference listing.  Usually in the development directory.
 *
 * An exit status of 0 means successful, even of the files differ (and
 * they usually do).  An exit status which is non-zero means something
 * is wrong.
 *
 * The non-zero exit status may be used to overload this command with
 * extra tests, such as line length limits.  The difference files must
 * be produced in addition to these extra tests.
 */
diff_command =
	"fcomp -w ${quote $original} ${quote $input} -o ${quote $output}";

/*
 * Compare three files using fmerge.  Conflicts are marked in the
 * output.
 *
 * This command is used by aed(1) to produce a difference listing when a
 * file in the development directory is out of date compared to the
 * current version in the baseline.
 *
 * All of the command substitutions described in aesub(5) are available.
 * In addition, the following substitutions are also available:
 *
 * ${ORiginal}
 *	The absolute path name of a file containing the common ancestor
 *	version of ${MostRecent} and {$Input}.  Usually the version
 *	originally copied into the change.  Usually in a temporary file.
 * ${Most_Recent}
 *	The absolute path name of a file containing the most recent
 *	version.  Usually in the baseline.
 * ${Input}
 *	The absolute path name of the edited version of the file.
 *	Usually in the development directory.
 * ${Output}
 *	The absolute path name of the file in which to write the
 *	difference listing.  Usually in the development directory.
 *
 * An exit status of 0 means successful, even of the files differ (and
 * they usually do).  An exit status which is non-zero means something
 * is wrong.
 */
merge_command =
	"fmerge ${quote $original} ${quote $MostRecent} ${quote $input} "
	"-o ${quote $output} -c /dev/null";
