Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

The SVN performs modifications


May 25, 2021 SVN


Table of contents


The SVN performs modifications

Jerry checked out the latest version from the repository and started working on the project. He created an array file under the trunk .c directory.

[jerry@CentOS ~]$ cd project_repo/trunk/

[jerry@CentOS trunk]$ cat array.c

The above command will produce the following results:

#include <stdio.h>
#define MAX 16

int main(void) {
   int i, n, arr[MAX];
   printf("Enter the total number of elements: ");
   scanf("%d", &n);

   printf("Enter the elements\n");

   for (i = 0; i < n; ++i) scanf("%d", &arr[i]);
   printf("Array has following elements\n");
   for (i = 0; i < n; ++i) printf("|%d| ", arr[i]);

   printf("\n");
   return 0;
}

He wants to test his code before submitting.

[jerry@CentOS trunk]$ make array
cc     array.c   -o array

[jerry@CentOS trunk]$ ./array 
Enter the total number of elements: 5
Enter the elements
1
2
3
4
5
Array has following elements
|1| |2| |3| |4| |5| 

He compiled and tested the code, everything was fine, and now it's time to commit the changes.

[jerry@CentOS trunk]$ svn status
?       array.c
?       array

SVN displays "?" in front of the file name because it does not know how to handle the files.

Jerry needs to add the file to the list of pending changes before submitting.

[jerry@CentOS trunk]$ svn add array.c 
A         array.c

Now let's examine it with the status command. The SVN displays an A .c the array file, which means that the file has been successfully added to the list to be changed.

[jerry@CentOS trunk]$ svn status
?       array
A       array.c

In order to .c array data into the repository, submit using commit -m plus comment information. If you ignore the -m option, SVN opens a text editor that can enter multiple lines to let you enter submission information.

[jerry@CentOS trunk]$ svn commit -m "Initial commit"
Adding         trunk/array.c
Transmitting file data .
Committed revision 2.

The array .c successfully added to the repository, and the revision number has been added by 1.