nucm-logo

NUCM-2.0 Documentation
Interface: Versioning: nc_commitchange


[Access | Versioning | Collection]

[nc_initiatechange | nc_abortchange | nc_commitchange | nc_commitchangeandreplace]

Signature

int  nc_commitchange(const char*  target,
                     const char*  t_cwd,
                     char*  version)

Functionality

Commits change on the artifact determined by the interpretation of the parameters target and t_cwd. A new version of the artifact is created in a logical NUCM repository and the contents of the new version is set to the current contents of the artifact. The previous version of the artifact in the repository remains unchanged. After committing change, the artifact can not be modified anymore. The parameter version is set to the version number of the newly created artifact. It is assumed that the parameter version holds enough space to place the version number in. The resulting value is NULL-terminated.

Return Values

0: everything went ok
-1: an error occurred

NdbErrno Codes

NdbOk :everything went ok
NdbUnknown :the path does not represent a NUCM artifact
NdbNotOpen :the NUCM artifact has not been opened in the workspace
NdbNotInit :the artifact is not initiated
NdbConnect :the server is down or not reachable
NdbComm :a communication error occurred
NdbProtocol:a failure occurred in the NUCM protocol
NdbNotAvail:service is not available

Example

Assuming a repository is filled with projects, and in particular contains a project "my_project" that has members "1", "2", "3", "4", and "5". Furthermore, "my_project" and its member "5" have been opened and initiated in a workspace. The workspace looks as follows:
   /home/bigtime/andre/workspace/my_project/1
					    2
					    3
					    4
					    5
To store the changes made to artifact 5, add an collection 6 to "my_project", and to store the changes made to "my_project", both by creating a new version of the artifact, the following code fragment can be used:
   #include "nc.h"
   
   char  newversion[MAX_VERSION_LENGTH + 1];

   nc_commitchange("my_project/5",
	           "/home/bigtime/andre/workspace",
		   newversion);
   mkdir("/home/bigtime/andre/workspace/my_project/6",
	 0644);
   nc_add("my_project/6",
	  "/home/bigtime/andre/workspace",
	  "/home/bigtime/andre/workspace/my_project",
	  "");
   nc_commitchange("my_project",
	           "/home/bigtime/andre/workspace",
		   newversion);
The workspace now looks as follows:
   /home/bigtime/andre/workspace/my_project/1
					    2
					    3
					    4
					    5
					    6

[Top | Quick Index] [Concepts | Interface]

SERL <serl.cs.colorado.edu>