Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

How to use CVS on Linux for SF

Developers
JiaLu
2008-12-02
2013-02-25
  • JiaLu
    JiaLu
    2008-12-02

    Hi all,
    I will write some basic usages of CVS on SF.
    The example project called "kika", well donot care about it and just use "kevora" instead of "kika".
    ------------------------
    1, First time access CVS tree via SSH (Developers Only)
    Execute commands below and replace developername to your SF login name:
    [root@FC5 SourceForge]# export CVS_RSH=ssh 
    [root@FC5 SourceForge]# cvs -z3 -d:ext:developername@kika.cvs.sourceforge.net:/cvsroot/kika co -P kika-algha
    jialu@kika.cvs.sourceforge.net's password: 
    Then input your password, it will checkout repo at first time.

    NOTE: To do operations below, you MUST enter the directory you just created.
    In my PC, I do 
    [root@FC5 ~]# cd /data/Develop/SourceForge/kika

    2, How to do Update.
    When you want to edit a file, you MUST do update first to synchronous local file with repo.
    [root@FC5 ~]# cd /data/Develop/SourceForge/kika
    [root@FC5 kika]# cvs update
    jialu@kika.cvs.sourceforge.net's password: 
    cvs update: Updating .

    3, How to Commit.
    After editing some files, you may want to put them to the server, what is called commit.
    [root@FC5 ~]# cd /data/Develop/SourceForge/kika
    [root@FC5 kika]# cvs commit -m "doing a test"
    cvs commit: Examining .
    jialu@kika.cvs.sourceforge.net's password: 
    Checking in testfile.txt;
    /cvsroot/kika/kika/testfile.txt,v <-- testfile.txt
    new revision: 1.2; previous revision: 1.1
    done

    NOTE: [-m "comment"] means the comments you want to add and the others will see what you done. (Recommanded)

    4, How to Create a file or directory.
    If you want to create a file or dir, you can do:
    [root@FC5 kika]# touch testfile.txt
    [root@FC5 kika]# echo "test by Jia Lu" >> testfile.txt 
    [root@FC5 kika]# cvs add testfile.txt 
    jialu@kika.cvs.sourceforge.net's password: 
    cvs add: scheduling file `testfile.txt' for addition
    cvs add: use 'cvs commit' to add this file permanently
    [root@FC5 kika]# cvs commit -m "Add a testfile"
    cvs commit: Examining .
    jialu@kika.cvs.sourceforge.net's password: 
    RCS file: /cvsroot/kika/kika/testfile.txt,v
    done
    Checking in testfile.txt;
    /cvsroot/kika/kika/testfile.txt,v <-- testfile.txt
    initial revision: 1.1
    done

    NOTE: Donot forget to use [cvs add filename] before commit.

    5, How to see the difference bewteen local files to repo.
    Before you do update, you can confirm or see the diff with repo.
    [root@FC5 kika]# cvs diff
    jialu@kika.cvs.sourceforge.net's password: 
    cvs diff: Diffing .
    Index: testfile.txt
    ===================================================================
    RCS file: /cvsroot/kika/kika/testfile.txt,v
    retrieving revision 1.2
    diff -r1.2 testfile.txt
    2d1
    < test2

    We see there is a difference in file testfile.txt, then we'd better update local files before editing.

    [root@FC5 kika]# cvs update
    jialu@kika.cvs.sourceforge.net's password: 
    cvs update: Updating .
    M testfile.txt

    We see file testfile.txt Med(Modified).

    6, How to delete a file from repo
    If you want to remove a file from repo, you will do 3 steps.
    a, delete from local
    b, remove from repo
    c, commit all
    [root@FC5 kika]# rm del.txt 
    rm: remove regular empty file `del.txt'? y
    [root@FC5 kika]# cvs remove del.txt 
    jialu@kika.cvs.sourceforge.net's password: 
    cvs remove: scheduling `del.txt' for removal
    cvs remove: use 'cvs commit' to remove this file permanently
    [root@FC5 kika]# cvs commit -m "test del"
    cvs commit: Examining .
    jialu@kika.cvs.sourceforge.net's password: 
    Removing del.txt;
    /cvsroot/kika/kika/del.txt,v <-- del.txt
    new revision: delete; previous revision: 1.1
    done

    7, To see repo status.
    If you want to see repo status, you can use "csv status".
    [root@FC5 kika]# cvs status
    jialu@kika.cvs.sourceforge.net's password: 
    cvs status: Examining .
    ===================================================================
    File: a.png Status: Up-to-date

    Working revision: 1.1.1.1
    Repository revision: 1.1.1.1 /cvsroot/kika/kika/a.png,v
    Sticky Tag: (none)
    Sticky Date: (none)
    Sticky Options: (none)

    ===================================================================

    Ending.
    I just wrote some basic usage of CVS. If you want to know more,you can google CVS.
    Done. :)