nucm-logo

NUCM-2.0 Documentation
Interface: Versioning: nc_initiatechange


[Access | Versioning | Collection]

[nc_initiatechange | nc_abortchange | nc_commitchange | nc_commitchangeandreplace]

Signature

int  nc_initiatechange(const char*  target,
                       const char*  t_cwd)

Functionality

Initiates change on the artifact determined by the interpretation of the parameters target and t_cwd. Only artifacts in a workspace can be initiated. Once the artifact is initiated, it can be modified. However, it can not be initiated again until either nc_commitchange, nc_commitchange, or nc_commitchangeandreplace has been called for the artifact. It is possible for a single artifact to be initiated multiple times as long as each initiation takes place in a different workspace.

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
NdbInitiated:the artifact is already initiated in the workspace

Example

Assuming our repository is filled with projects, and in particular contains a project "my_project" that has the members "1", "2", "3", "4", and "5". Assuming furthermore a workspace exist with no contents at this point:
   /home/bigtime/andre/workspace
This project and its members can be opened and initiated in the workspace as follows:
   #include "nc.h"

   t_memberlist*  memberlist;
   t_memberlist*  member;

   nc_open("//serl.cs.colorado.edu:1234/nucm_root/my_project",
	   "",
	   "/home/bigtime/andre/workspace",
	   "");
   nc_initiatechange("my_project",
	             "/home/bigtime/andre/workspace");
   nc_list("my_project",
	   "/home/bigtime/andre/workspace",
	   &memberlist);
   member = memberlist;
   while (member != NULL) {
      nc_open(member->name,
	      "/home/bigtime/andre/workspace/my_project",
	      "/home/bigtime/andre/workspace/my_project",
	      "");
      nc_initiatechange(member->name,
	                "/home/bigtime/andre/workspace/my_project");
      member = member->next;
   }
Execution of the above code fragment results in the following workspace contents:
   /home/bigtime/andre/workspace/my_project/1
					    2
					    3
					    4
					    5
The artifacts "1", "2", "3", "4", and "5" can at this point all be changed. In addition, "my_project" can be manipulated using the collection interface functions.

[Top | Quick Index] [Concepts | Interface]

SERL <serl.cs.colorado.edu>