A Gentle Introduction to CMSC311 labs and CVS Or How I learned to use CVS in CMSC311. William Arbaugh September 2, 2004

Similar documents
Portions adapted from A Visual Guide to Version Control. Introduction to CVS

About CVS. 1 Version Control - what is it? why is it useful?

CVS for Moodle Developers

Introduction to CVS. Sivan Toledo Tel-Aviv University

Task-Oriented Solutions to Over 175 Common Problems. Covers. Eclipse 3.0. Eclipse CookbookTM. Steve Holzner

CSC 112 Lab 1: Introduction to Unix and C++ Fall 2009

Table Of Contents. 1. Zoo Information a. Logging in b. Transferring files 2. Unix Basics 3. Homework Commands

Section 2: Developer tools and you. Alex Mariakakis (staff-wide)

Using Subversion with LeMANS and MONACO

Revision Control. An Introduction Using Git 1/15

A CVS Repository for the RNB Group

Concurrent Versions System (cvs( cvs) Adviser Date August 31, 2004

Revision control. INF5750/ Lecture 2 (Part I)

Submitting your Work using GIT

Chapter 3. Revision Control

Version control. with git and GitHub. Karl Broman. Biostatistics & Medical Informatics, UW Madison

Department of Computer Science College of Engineering Boise State University

CVS Application. William Jiang

When you first log in, you will be placed in your home directory. To see what this directory is named, type:

ENCM 339 Fall 2017: Cygwin Setup Help

Using CVS to Manage Source RTL

Exercise 1: Basic Tools

Exercise Session 2 Systems Programming and Computer Architecture

Pragmatic Version Control

Draft: MLDesigner and LinCVS

Version Control with CVS

CSCI 4152/6509 Natural Language Processing. Lab 1: FCS Computing Environment

Recitation #1 Boot Camp. August 30th, 2016

2 Initialize a git repository on your machine, add a README file, commit and push

Using git to download and update BOUT++

And check out a copy of your group's source tree, where N is your one-digit group number and user is your rss username

Outline The three W s Overview of gits structure Using git Final stuff. Git. A fast distributed revision control system

Introduction. Xv6 memory

A quick (and maybe practical) guide to Git and version control. By Jay Johnson

15213 Recitation Section C

Git. A fast distributed revision control system. Nils Moschüring PhD Student (LMU)

Warmup. A programmer s wife tells him, Would you mind going to the store and picking up a loaf of bread? Also, if they have eggs, get a dozen.

Version Control. CSC207 Fall 2014

CVS How-to. 17th July 2003

Version Control Systems (VCS)

CSE 374 Programming Concepts & Tools. Hal Perkins Winter 2012 Lecture 16 Version control and svn

213/513/613 Linux/Git Bootcamp. Cyrus, Eugene, Minji, Niko

Recitation #1 Unix Boot Camp. August 29th, 2017

CS Fundamentals of Programming II Fall Very Basic UNIX

9 and 11-Jan CSCI 4152/6509 Natural Language Processing Lab 1: FCS Computing Environment, SVN Tutorial. FCS Computing Environment, SVN Tutorial

LAB MANUAL GIT BY PRATIK JAIN. To start with git bash, we need to authenticate ourselves so that for every commit, git can use this information.

Lab 1 Introduction to UNIX and C

Subversion FOUR. 4.1 What is Version Control? 4.2 What is Subversion? Types of Version Control SESSION

What is version control? (discuss) Who has used version control? Favorite VCS? Uses of version control (read)

Implement an ADT while using Subversion

Introduction to Revision Control

Setting up my Dev Environment ECS 030

Linux at the Command Line Don Johnson of BU IS&T

Using RANCID. Contents. 1 Introduction Goals Notes Install rancid Add alias Configure rancid...

Lab #1 Installing a System Due Friday, September 6, 2002

How to version control like a pro: a roadmap to your reproducible & collaborative research

Running Sentaurus on the DOE Network

Linux and Git Boot Camp

15-213, Spring 2008 Lab Assignment L1: Manipulating Bits Assigned: Jan. 15, Due: Wed., Jan. 30, 11:59PM

OPERATING SYSTEMS ASSIGNMENT 4 XV6 file system

CSE 160: Introduction to Parallel Computation

CS 261 Recitation 1 Compiling C on UNIX

SECTION 2: CODE REASONING + PROGRAMMING TOOLS. slides borrowed and adapted from Alex Mariakis and CSE 390a

Revision Control and GIT

Lab 1 Introduction to UNIX and C

TDDC88 Lab 4 Software Configuration Management

Source Code Management

FEEG Applied Programming 3 - Version Control and Git II

CS CS Tutorial 2 2 Winter 2018

WinCvs Version 1.1. Users Guide. Don Harper

Assumptions. GIT Commands. OS Commands

Lab 2 Building on Linux

An Introduction to Subversion

CSE 331 Software Design & Implementation

Overview. during this tutorial we will examine how touse git from the command line. finally we will explore a graphical visualisation of git activity

Software Development I

Unix/Linux Operating System. Introduction to Computational Statistics STAT 598G, Fall 2011

Common CVS Command Summary

Version Control. 1 Version Control Systems. Ken Bloom. Linux User Group of Davis March 1, 2005

CS480. Compilers Eclipse, SVN, Makefile examples

Version control with RCS and CVS An introduction. Markus Bjartveit Krüger

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX

Git. CSCI 5828: Foundations of Software Engineering Lecture 02a 08/27/2015

CS108, Stanford Handout #37. Source Control CVS

Boot your computer into GNU/Linux. Overview. Introduction to git on the command line. Introduction to git on the command line

SmartCVS Tutorial. Starting the putty Client and Setting Your CVS Password

Introduction to Linux. Fundamentals of Computer Science

Common Git Commands. Git Crash Course. Teon Banek April 7, Teon Banek (TakeLab) Common Git Commands TakeLab 1 / 18

What is git? Distributed Version Control System (VCS); Created by Linus Torvalds, to help with Linux development;

CSE 390 Lecture 9. Version control and Subversion (svn)

unix intro Documentation

Storing and Managing Code with CVS

Computer Science 62 Lab 8

EE516: Embedded Software Project 1. Setting Up Environment for Projects

Working with GIT. Florido Paganelli Lund University MNXB Florido Paganelli MNXB Working with git 1/47

Saint Louis University. Intro to Linux and C. CSCI 2400/ ECE 3217: Computer Architecture. Instructors: David Ferry

Spring 2017 Gabriel Kuri

COMP Lecture Notes The Compiler

SECTION 2: HW3 Setup.

Software Development. Hack, hack, hack, hack, hack. Sorta works. Main.c. COMP s1

Transcription:

A Gentle Introduction to CMSC311 labs and CVS Or How I learned to use CVS in CMSC311 William Arbaugh September 2, 2004 This howto assumes that you already have scp and ssh installed on your computer. If you re using UNIX (Linux, FreeBSD, or OSX), then everything is already installed. If you re using Windows, then you ll have to first follow another howto to install scp and ssh. There are several different version of scp available for Windows. Most are GUI based and I can t cover how to use each. Therefore, I m only going to cover a command line version of scp which is the same for UNIX and Windows. There are basically four steps you need to follow to complete a lab successfully: 1. Download the lab tar file from moodle to your local computer, 2. Move the lab tar file to the linux cluster via scp, 3. Edit the appropriate files to complete the lab while using CVS, 4. Move the file to be turned in and upload to moodle. NOTE: I m using the fictitious user account cmsc311999 in section 0101. You MUST use the account you were assigned in class and your appropriate section when following this howto. Also, all commands are shown in italics and begin with Prompt$. Also, this HOWTO only deals with using CVS individually. If you were doing a project as a group using CVS, there are a few subtle differences- mostly copious use of cvs update. Why use CVS on the Linux Cluster? You re probably wondering why you should invest in learning CVS. There are two reasons basically. The first is that CVS is basically programmer s insurance. It creates a versioned back-up of your project so that you can go back in time to a version that was actually working. A important part of this strategy is that CVS repositories are usually on main servers which are backed up to tape on a frequent basis (in the case of the Linux cluster there is a nightly back-up done of your directory). This means that if the dog eats your laptop, you still have a copy of code some place and you don t have to spend the countless hours rewriting an entire assignment. The second reason why you should invest in learning CVS is that you ll get a 5% bonus on your lab if you use it! Finally, once you actually understand the cryptic syntax of CVS- it actually becomes easy and second nature. Then, you have the back-up when you need it. Downloading the lab file from moodle

Downloading the lab tar file from moodle to your local machine is easy. Just click on the appropriate link in the Lab assignment and your browser will download the file to where ever it places your files (usually the desktop). Once you ve downloaded the tar file, you can choose to work on it on your local machine or upload it to the Linux cluster and work on it there. Right now, I m only going to cover uploading the file to the cluster and working with it there. Later, I ll show you how you can still use CVS on the cluster and edit your files on your personal or local computer. Uploading the lab file to the Linux cluster To upload the lab file to the Linux cluster, you have to use scp or secure copy. To do this, you need to know two file name paths. The first is the location of the file you downloaded from moodle (this is the source file) and the second is the path to the directory on the Linux cluster where you want the file to end up (this is the destination directory). The destination directory is your home directory (or a sub-directory within your home directory). Now, you simply use scp on your own local computer as follows: scp Lab1.tar.gz cmsc311999@linuxlab.csic.umd.edu:/fs/class/cmsc311/0101/cmsc311999 Now just ssh into the Linux cluster: Prompt$ ssh lcmsc311999 linuxlab.csic.umd.edu Initializing CVS on the Linux Cluster Now that we ve ssh d into the Linux cluster. The first thing we need to do (if you haven t already) is create the SSH repository. You do this with: Prompt$ cvs d /fs/class/cmsc311/0101/cmsc311999/cvs init The above command creates and initializes the CVS repository under the CVS in your home directory. You can now untar the lab tar file with: Prompt$ tar xvfz Lab1.tar.gz Lab1/ Lab1/bits.c Lab1/bits.h Lab1/btest.c Lab1/btest.h Lab1/datalab.pdf Lab1/datalab.ps Lab1/decl.c

Lab1/dlc Lab1/Makefile Lab1/README Lab1/tests.c which will create a Lab directory. Now, move into that directory: Prompt$ cd Lab1 The first step now is to add the original lab files into the CVS repository. Before I do that, however, I want to set-up an environment variable so I don t have to type the pathname of the CVS repository all of the time. I do that under bash (tcsh and csh are slightly different) with: Prompt$ export CVSROOT=/fs/class/cmsc311/0101/cmsc311999/CVS Now, I can add my lab files to the repository with: Prompt$ cvs import m Original lab files Lab1 cmsc311999 start N Lab1/bits.c N Lab1/bits.h N Lab1/btest.c N Lab1/btest.h N Lab1/datalab.pdf N Lab1/datalab.ps N Lab1/decl.c N Lab1/dlc N Lab1/Makefile N Lab1/README N Lab1/tests.c No conflicts created by this import This import command uses the log message Original lab files and creates a new project with the name Lab1 within the CVS repository. The cmsc311999 is known as the vendor tag (don t worry about it), and start is an initial tag (we ll talk about tags a bit later). I now move up a level in the directory tree and rename the Lab1 directory temporarily to make sure my files were added to the repository correctly. Prompt$ cd.. Prompt$ mv Lab1 Lab1.orig I can now checkout the Lab1 project from the repository.

Prompt$ cvs checkout Lab1 cvs checkout: Updating Lab1 U Lab1/Makefile U Lab1/README U Lab1/bits.c U Lab1/bits.h U Lab1/btest.c U Lab1/btest.h U Lab1/datalab.pdf U Lab1/datalab.ps U Lab1/decl.c U Lab1/dlc U Lab1/tests.c Now, I move back into the new created Lab1 directory and verify that the files are there OK. Prompt$ cd Lab1 If the files are OK, then I can delete the original files I with: Prompt$ rm rf../lab1.orig Adding CVS Keywords to your file OK. Time to start to edit the file you will turn in for grading, bits.c. Go ahead and use your favorite editor (Emacs suggested due to its tight integration with Make and GDB). You want to add the following comment block at the top of the file bits.c. / $Source$ $Revision$ $Date$ $Author$ $Log$ / The keywords (enclosed in dollar signs) will be expanded by CVS automagically each time you check out a file. Now, I can check the modified file back into CVS via process known as committing. Committing changes to CVS

Committing the changes back to the CVS repository is easy. All I have to do is issue the following command: Prompt$ Cvs commit m Added CVS keyword header cvs commit: Examining. Checking in bits.c; /afs/csic.umd.edu/users/waa/cvs/lab1/bits.c,v <-- bits.c new revision: 1.2; previous revision: 1.1 done The -m switch tells cvs to use the string following as the log message. If you don t use the -m switch, cvs will automatically start an editor and ask you to enter a log message. The exact editor that is started is defined by the EDITOR environment variable. If you don t understand the above paragraph, then ALWAYS use the -m switch with an appropriate log message. If we now look at the beginning of bits.c now, we ll see that the keywords were expanded: / $Source: /afs/csic.umd.edu/users/waa/cvs/lab1/bits.c,v $ $Revision: 1.2 $ $Date: 2004/09/03 19:08:08 $ $Author: waa $ $Log: bits.c,v $ Revision 1.2 2004/09/03 19:08:08 waa Added CVS keyword header / Now, I can edit my bits.c file and commit the changes each time I get a new function working. Tags Advanced Features of CVS This lab is pretty easy because all you do is modify one file, bits.c. When you re working with a large number of files, tags become very handy. Each file within CVS has a revision number which increases each time you check in the file. So in a large project, you may have a two files at revision 1.15 and one at 1.3.

Tagging allows you to mark each of these files so you can recreate your project down the road after you ve made more changes to it. In a commercial setting, this is very useful when a software release is provided to a customer. The developers can tag the release for support reasons. For instance two months later (after significant changes to the project), the customer reports a bug. How do you recreate the customer s release and fix the bug? Tags! For you as a student, tags are useful for marking a project at specific milestones so you can revert back to a working version at a known point. This is most helpful when you ve made a huge number of changes to a project that was working, and now it won t compile or has serious bugs. You tag a project this way: Prompt$ cvs q tag Lab1-Function1-working T Makefile T README T bits.c T bits.h T btest.c T btest.h T datalab.pdf T datalab.ps T decl.c T dlc T tests.c If you have previously tagged a project, and you want to revert a single file to the tagged version you can do it this way: Prompt$ cvs update r Lab1-Function1-working bits.c This would only update the bits.c file. If you want to see what the changes are between a current file and the previously tagged version, you can do a diff: Prompt$ cvs diff c r Lab1-Function1-working bits.c Using a remote CVS repository One of the nice features of CVS is that you can utilize a remote repository. That is- you can do development on your home machine (Windows, MacOS, Linux, whatever) and checkin and checkout projects just as if you were on the Linux cluster. Here s how on a UNIX machine, or on Windows using Cygwin. First, you need to set the CVS_RSH environment variable to ssh using bash:

Prompt$ export CVS_RSH=ssh You also need to set the CVSROOT environment variable to the remote repository: Prompt$ export CVSROOT=linuxlab.csic.umd.edu:/fs/class/cmsc311/0101/cmsc311999/CVS Now you can edit and commit, update, checkout etc. all from the comfort of you own machine, and the files will be stored on the repository on the Linux cluster (getting backed up every night). If you decide to go this way, all you need to do then to test your project on the Linux cluster is to log into the cluster via ssh and checkout your project (assuming that you committed it when completed) and test!