CVS: Difference between revisions
(→diff) |
|||
Line 210: | Line 210: | ||
# and the ">" text in green color is from version 1.4 | # and the ">" text in green color is from version 1.4 | ||
</pre> | </pre> | ||
For color information, see [[Linux#diff_.26_colordiff-color_in_terminal|Linux -> diff]] . | |||
== Recursively delete all CVS subdirectories == | == Recursively delete all CVS subdirectories == |
Revision as of 12:15, 15 October 2019
CVS
CVS server
# Original data dir: /home/brb/Downloads/hmv_arc # CVS dir on server (CVSROOT): /home/brb/cvsrep # CVS dir on local: /home/brb/Downloads/localcvs # Project name: mycvs # cvs user name: brb sudo apt-get install cvs mkdir ~/cvsrep export CVSROOT=/home/brb/cvsrep cvs init sudo groupadd mycvsgrp sudo useradd -G mycvsgrp brb # Assume 'brb' is a new user sudo usermod -a -G mycvsgrp brb # assume 'brb' is an existing user groups brb # view groups a user is in use sudo chown -R :mycvsgrp /home/brb/cvsrep # change the group ownership of cvsrep directory to mycvsgrp. cd ~/Downloads/hmv_arc cvs import -m "initial" mycvs brb START # import files to CVS repository # the new subfolder mycvs has owner brb.brb
Note 1. It is OK to use the same CVSROOT for multiple modules/projects since each module/project will be saved under a separate subfolder.
Note 2. The cvs version that I have installed in my ubuntu server is 1.12.13.
$ cvs -v Concurrent Versions System (CVS) 1.12.13-MirDebian-6 (client/server)
Quick test to checkout project to the same machine
cd ~/Downloads mkdir localcvs cd localcvs cvs checkout mycvs
This will create a new subfolder 'mycvs' under ~/Downloads/localcvs.
CVS repository on server has a structure
cvsrep/CVSROOT cvsrep/mycvs
CVS sandbox on local machine has a structure
mycvs/CVS mycvs/[files1] mycvs/[files2]
CVS client (ubuntu)
Check out
cvs -d :ext:brb@DOMAIN:/home/brb/cvsrep checkout mycvs # OR 2 steps export CVSROOT=:ext:brb@DOMAIN:/home/brb/cvsrep cvs checkout mycvs
Commit a new file
cvs add mynewfile cvs commit -m "my log message" mynewfile
Update repository
cvs update -P -d # OR cvs update filename
where -P "prunes" directories that are empty, and -d tells cvs to include any new directories that aren't in your local workspace
Get a list of all tags and branches
# Lists all tags and braches for each and any file together with the revision it belongs to. cvs status -v # http://stackoverflow.com/questions/566093/how-do-i-identify-what-branches-exist-in-cvs cvs log -h | awk -F"[.:]" '/^\t/&&$(NF-1)==0{print $1}' | sort -u
Encoding of a file
$ cvs -d :ext:brb@DOMAIN:/home/brb/cvsrep checkout mycvs $ file -bi mycvs/src/hmvUnicode.rc text/x-c; charset=utf-16le
CVS client (windows)
I use WinCVS for a demonstration
- Remote -> checkout module
- Module name: mycvs
- CVSROOT:
- protocol: ssh
- repository path: /home/brb/cvsrep
- user name:
- host name: taichi.selfip.net
If I use TortoiseCVS (1.12.5 from 1/24/2011), I need to choose ext as protocol instead ssh. Still the checked out file 'hmv_.rc' still contains unreadable Chinese characters. The cvsnt is the latest free version (2.5.05). If I want to use WinCVS + cvsnt from TortoiseCVS, the options in the CVSROOT dialog looks weird and cannot create a connection.
For the unicode encoding. If I commit the file at first from ubuntu os, but check out in Windows. The checked out file has right encoding (using Notepad ++, or from VS2010). However, the file does not have right line ending and it shows Chineses character when I open it in either Notepad++ or VS2010.
To see hidden characters in Linux, try either one of the following 2 methods:
- Open the file in EMACS and do a M-X hexl-mode
- geany editor.
The solution I have found to overcome accessing unicode (utf-16) file on Windows OS is using Cygwin.
- Download setup.exe from http://cygwin.com/install.html
- Root directory = c:\cygwin
- Local package directory = C:\Users\brb\Downloads
- Direct connection
- Download site: ftp://cygwin.mirrors.pair.com (Some mirrors are not updated & contain old version of packages! For example, make sure the cvs version is 1.12.13.)
- Search: cvs. Click plus sign next to "Devel". Click 'Skip' corresponding to cvs package.
- Search: ssh. Click plus sign next to "Net". Click 'skip' correspond to openssh package.
- Click 'Next' button.
- Click 'Finish' button.
- Now open 'Cygwin Terminal' icon on Windows Desktop.
export CVSROOT=:ext:brb@DOMAIN:/home/brb/cvsrep cvs checkout mycvs
The 'mycvs' directory should be under C:\cygwin\home\brb (a.k.a. /home/brb in cygwin) directory. We can open 'hmv_.rc' file in Notepad++ to double check if the file looks normal OR use md5sum to check.
Difference between CRLF (Windows), LF (Linux, Mac) and CR
This is a good summary I found: http://stackoverflow.com/questions/1552749/difference-between-cr-lf-lf-and-cr-line-break-types
- The Carriage Return (CR) character (0x0D, \r) moves the cursor to the beginning of the line without advancing to the next line. This character is used as a new line character in Commodore and Early Macintosh operating systems (OS-9 and earlier).
- The Line Feed (LF) character (0x0A, \n) moves the cursor down to the next line without returning to the beginning of the line. This character is used as a new line character in UNIX based systems (Linux, Mac OSX, etc)
- The End of Line (EOL) character (0x0D0A, \r\n) is actually two ASCII characters and is a combination of the CR and LF characters. It moves the cursor both down to the next line and to the beginning of that line. This character is used as a new line character in most other non-Unix operating systems including Microsoft Windows, Symbian OS and others.
Common CVS commands
- http://ximbiot.com/cvs/manual/
- http://mu2e.fnal.gov/public/hep/computing/cvsCheatSheet.shtml
- http://refcards.com/docs/forda/cvs/cvs-refcard-a4.pdf, http://www.bravegnu.org/cvscheat/cvscheat.pdf
cvs checkout MODULE cvs checkout DIR cvs checkout DIR/SUBDIR cvs co DIR/SUBDIR/FILENAME # check out a specific tag and put it in a specified directory. # the specified directory name will replace the module name in output. mkdir localcvs cvs checkout -r v4_3 -d localcvs MODULE cvs add myfile.c cvs add -kb myfile.bin # If you accidentally add a file, simply skip the commit for that file. cvs update –dA DIR/SUBDIR # -d: Create any directories that exist in the repository if they're missing from the working directory. # -A: Reset any sticky tags, dates, or -k options. Needed after you use "cvs update -D" or "cvs update -r". cvs update –A DIR/SUBDIR/FILENAME cvs commit cvs commit –m "add test suite" DIR/SUBDIR/FILENAME mkdir ~/original touch ~/original/newfile cvs import ~/original VENDORTAG RELEASETAG mkdir ~/localcvs cd ~/localcvs cvs checkout common/too cvs diff -r1.23 -r1.24 SUBDIR/FILENAME # Difference between specified versions 1.23 & 1.24. cvs diff -D "1 hour ago" MODULE cd LOCALCVS; cvs diff cvs checkout -D "1 hour ago" MODULE cvs checkout -D "2013-02-27 01:30" MODULE rm file(s); cvs remove file(s); cvs commit -m "Comment text" file(s) # You must rm the file before issuing the cvs remove command. The remove is not final until the commit has been issued. # cvs does not let you remove directories. However it does let you ignore any directories that are empty. cvs co -P Offline cvs update -PdA # P: Prune empty directories. d: create new directories. A: Reset sticky tags cvs history -c -a -D "1 day ago" -z "-0500" # find all changes submitted to the repository by anyone in the past day. # -z is used to adjust the time zone. cvs history -c -a -D "1 day ago" -f Mu2eG4/src # find all changes submitted to Mu2eG4/src (or any other subdirectory) by anyone in the past day cvs history -c -u USER "1 day ago" -f Mu2eG4/src # find all changes submitted by USER to Mu2eG4/src in the past day cvs log FILENAME
diff
$ cvs history -c -a -f Myfile.Rmd # Suppose the latest version is 1.4 and we want to see the difference of 1.3 and 1.4 $ cvs diff -r1.3 Myfile.Rmd | colordiff # The output shows it does 'diff -r1.3 -r1.4'. # So the "<" text in red color is from version 1.3 # and the ">" text in green color is from version 1.4
For color information, see Linux -> diff .
Recursively delete all CVS subdirectories
$ find . -name 'CVS' -type d -exec rm -rf {} \; find: ./man/CVS: No such file or directory find: ./vignettes/CVS: No such file or directory find: ./R/CVS: No such file or directory find: ./CVS: No such file or directory find: ./inst/CVS: No such file or directory find: ./inst/doc/CVS: No such file or directory find: ./src/CVS: No such file or directory
Subversion
How to Setup Apache Subversion with Let's encrypt SSL on Ubuntu 18.04 (including ufw firewall configuration)