nucm-logo

NUCM-2.0 Documentation
Interface: Collection: nc_rename


[Versioning | Collection | Query]

[nc_add | nc_remove | nc_rename | nc_replaceversion | nc_copy]

Signature

int  nc_rename(const char*  target,
               const char*  t_cwd,
               const char*  new_name)

Functionality

Renames the artifact determined by the parameters target and t_cwd in the collection in the workspace to the name given in the parameter new_name. If the artifact has been opened, it is also renamed in the workspace. The collection in which the artifact is renamed has to be initiated.

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
NdbLonely : no collection present in the workspace in which the artifact can be renamed
NdbNotInit: the collection in which to rename the artifact is not initiated
NdbExist : a different artifact with the same name already exists in the workspace

Example

Assuming a repository is filled with projects, and in particular contains a project "my_project" that contains the artifacts ".login" and ".cshrc". Furthermore, a workspace has been created earlier in which "my_project" and its artifacts have been opened:
   /home/bigtime/andre/workspace/my_project/.login
					    .cshrc
To rename ".login" and ".cshrc" to "autoexec.bat" and "config.sys", the following code fragment can be used:
   #include "nc.h"
   
   nc_initiatechange("my_project",
		     "/home/bigtime/andre/workspace");
   nc_rename(".login",
	     "/home/bigtime/andre/workspace/my_project",
	     "autoexec.bat");
   nc_rename(".cshrc",
	     "/home/bigtime/andre/workspace/my_project",
	     "config.sys");
   nc_commitchangeandreplace("my_project",
	                     "/home/bigtime/andre/workspace");
The workspace now looks as follows:
   /home/bigtime/andre/workspace/my_project/autoexec.bat
					    config.sys
It should be noted that ".login" and ".cshrc" did not need to have been opened to be renamed.

[Top | Quick Index] [Concepts | Interface]

SERL <serl.cs.colorado.edu>