I would like to revision control some python files using RCS. After checking ci the scripts, a header is added to the script. I get a syntax error because that. How to comment the header with # after ci?
For e.g. - This is what my script looks like after ci
head 1.1;
access;
symbols;
locks; strict;
comment @# @;
1.1
date 2020.02.07.18.34.54; author chiraga; state Exp;
branches;
next ;
desc
@le
@
1.1
log
@Initial revision
@
text
@#!/pkg/qct/software/python/3.5.0/bin/python
First of all, RCS is a perfectly good option if you have single files you want to control. It is less complex than git and has a more understandable method of naming 'revisions' - it is much easier to understand versions 1.1 and 1.2 compared to the git commit SHA-1 checksums. In my lab, we continue to use it for text/troff/groff files, shell scripts, perl scripts, Makefiles, and rmarkdown files where they are standalone - although we use git for most complex projects. We have shell and perl script that are more than 30 years old that RCS still works on. RCS is NOT great for files that form part of a system, package, project etc. Use git for that.
To answer your question you need to understand how RCS works.
1 - after you did the initial check-in of your script you would have had 1 or 2 files:
filename.py,v(the RCS 'database' of your file) and possiblyfilename.py(your original code).If you did the check-in with
ci -l filename.pythat would have given you both files, but if you just ranci filename.pyRCS would have checked your python script into the RCS file (with the trailing,v) and removed your original.2 - To get your usable python script out you need to check it out. If you want to check it out to work on it, then run:
The
-lmeans 'lock the file out exclusively to me' - which is what you want when you are editing it.At this stage you should be able to edit and run the script
filename.py- NOTE that you will not and should not be trying to run thefilename.py,vfile - that is the database where your changes are recorded.After each significant edit you will need to check the changes in - if it is you solely working on the file then
ci -l filename.pyis the easiest as it checks in your changes and keeps the source file available to you for you to edit.Once you have a final tested script you would usually check in the last set of changes and then copy the source file to wherever you are deploying it - perhaps
/usr/local/bin.I would advise you to place a
string somewhere in the comments section of the file so you can tell which version you have deployed. After you check in the file this will look something like this:
and will change each time.
Lots of RCS tutorials around but a quick version is here.