How to create a new file in a CVS repository


 
Thread Tools Search this Thread
Top Forums Programming How to create a new file in a CVS repository
# 1  
Old 03-12-2011
How to create a new file in a CVS repository

I have a coding project that I'm working on, and I'm tracking revisions using CVS. I'm working on a branch (branch1) at version 1.1.2.1.

Anyway, I created a new C file in the directory for the project, but I can't commit it. The tutorial I read on CVS said that version numbers will be assigned automatically to new files, and they will have the same revision as the latest revision of everything else. Instead, when I check the status of game.c (the new file) I get:

Code:
===================================================================
File: game.c               Status: Unknown

   Working revision:    No entry for game.c
   Repository revision:    No revision control file

I have already tried releasing and checking out the project from the repository. I have already tried committing the changes to game.c. I've already tried creating the repository file manually. No matter what I do, CVS will not let me add a new file to the project. Is there any way to do this?

P.S. Please don't tell me to use a different RCS.

EDIT: I tried
Code:
cvs add game.c

and I got
Code:
cvs add: cannot add file on non-branch tag `1.1.2.1'

The standard way of doing it does not work.

Last edited by Ultrix; 03-12-2011 at 05:40 PM..
# 2  
Old 03-12-2011
Hi.

Use add, then commit ... cheers, drl
# 3  
Old 03-12-2011
Quote:
Originally Posted by drl
Hi.

Use add, then commit ... cheers, drl
As I said, I already tried that and it didn't work. I had to delete the sticky tag, which ended up merging the versions (because it was a branch) and making the repository inaccessable for some reason. I have just deleted my entire project, as well as the CVS repository, and restored the code from my USB backups.

Last edited by Ultrix; 03-12-2011 at 06:22 PM..
# 4  
Old 03-12-2011
Hi.

I think I can understand why cvs might not allow adds to branches. The branches are copies of main with the exception of changes to existing files. Adding a file to a branch might make merging an even more unbearable task then it usually is.

I looked through my copy of Fogel's Open Source Development with CVS and although I found no restrictions on adding files to branches, I didn't see any examples of it either.

You could try to see if any of the forums from a Google of "cvs forum -pharmacy -grocery" are still active, try another linux forum, or wait until an expert appears here.

I'd be interested in a definitive answer, although I've left cvs behind many years ago. (Somewhat ironically, I use rcs for temporary revision control, but I also use bzr for the same task.)

Good luck ... cheers, drl
# 5  
Old 03-12-2011
How did you create the branch you are working on?
# 6  
Old 03-13-2011
Quote:
Originally Posted by fpmurphy
How did you create the branch you are working on?
Code:
cvs tag -b branch1

That's the only way I know how to do it, and it's the way given in the CVS docs in /usr/share/doc/cvs. Anyway, I've decided to try to avoid branches from now on, as merges can be unpredictable.
# 7  
Old 03-14-2011
Hi.

I found:
Quote:
When you add a file it is added only on the branch which you are working on (see section Branching and merging). You can later merge the additions to another branch if you want (see section Merging can add or remove files).
-- CVS--Concurrent Versions System - Adding, removing, and renaming files and directories

That suggests that you can add files to a branch, but in quick skim I saw no examples. If I get some time, I'll experiment ... cheers, drl

Google search "add file to cvs branch" had a number of hits, not all appropriate, of course.

---------- Post updated at 21:53 ---------- Previous update was at 09:53 ----------

Hi.

I installed cvs in a VM and wrote this script:
Code:
#!/usr/bin/env bash

# @(#) run1	Demonstrate creation, staging, branching of cvs repository.

# Utility functions: print-as-echo, print-line-with-visual-space, debug.
pe() { for i;do printf "%s" "$i";done; printf "\n"; }
pl() { pe;pe "-----" ;pe "$*"; }
db() { ( printf " db, ";for i;do printf "%s" "$i";done; printf "\n" ) >&2 ; }
db() { : ; }
C=$HOME/bin/context && [ -f $C ] && . $C cvs

pl " Results:"
./create-repo
./stage-files
./make-branch

exit 0

producing:
Code:
% ./run1

Environment: LC_ALL = C, LANG = C
(Versions displayed with local utility "version")
OS, ker|rel, machine: Linux, 2.6.32-29-generic, i686
Distribution        : Ubuntu 10.04.2 LTS (lucid) 
GNU bash 4.1.5
cvs - ( /usr/bin/cvs Nov 10 2008 )

-----
 Results:

CVSROOT
N myproj/collected.c
N myproj/main.c

No conflicts created by this import

cvs checkout: Updating myproj
U myproj/collected.c
U myproj/main.c

total 12
drwxr-x--- 2 drl drl 4096 Mar 13 21:30 CVS
-rw-r--r-- 1 drl drl   46 Mar 13 21:30 collected.c
-rw-r--r-- 1 drl drl  220 Mar 13 21:30 main.c
cvs tag: Tagging .
T collected.c
T main.c
cvs tag: Tagging .
T collected.c
T main.c
cvs update: Updating .
cvs add: scheduling file `suba.c' for addition on branch `new_stuff_1'
cvs add: use `cvs commit' to add this file permanently
cvs add: scheduling file `subb.c' for addition on branch `new_stuff_1'
cvs add: use `cvs commit' to add this file permanently
cvs commit: Examining .
/home/drl/try/user-problem/1019/repo/myproj/Attic/suba.c,v  <--  suba.c
new revision: 1.1.2.1; previous revision: 1.1
/home/drl/try/user-problem/1019/repo/myproj/Attic/subb.c,v  <--  subb.c
new revision: 1.1.2.1; previous revision: 1.1

As you can see just above, the new files were added to the branch. I recall getting an error message similar to the one you posted, but I could not elicit it just now. I did not try to merge the branch into main.

This is more of an academic question for me. We used cvs at a place I worked and one person in our group was responsible for merging branches back into main for each end-of-development-phase. It was always a struggle, often taking days to get everything right.

I think you are wise to stay away from branches unless you absolutely need to deal with them. If you do need them, then you can experiment until you are comfortable.

Good luck ... cheers, drl
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Red Hat

Error: Cannot retrieve repository metadata (repomd.xml) for repository: InstallMedia.

Most of my commands are returning this error on RHEL 6 64 bit: Also I tried installing many sofwtares, but it fails to correctly work. For example I treid installing dos2unix: # rpm -ivh dos2unix-5.3.3-5.ram0.98.src.rpm 1:dos2unix warning: user mockbuild does not... (0 Replies)
Discussion started by: India_2014
0 Replies

2. Red Hat

How to create EPEL Repository ?

This is not a right place to ask this question but iam little bit confused. Please tell me how to create EPEL repository in RHEL 6.4 (1 Reply)
Discussion started by: pradeep252
1 Replies

3. UNIX for Advanced & Expert Users

Trying to figure out the CVS repository server.

We have an issue where we are able to check out files from unix however not from windows. On Unix I have the cvs host set to /home/group/CVSROOT but when I try and access the folder from windows I get an exception that the server refuses connection. On unix the CVSROOT is a filer and not the... (0 Replies)
Discussion started by: jjohnson
0 Replies

4. Red Hat

CVS repository connecting error in Linux 5.3

Hi Friends, I configured CVS Repository in RHEL 5.3 Server. But connecting the CVS Repository get the error like. # cvs -d:pserver:cvs@localhost:/backup/cvs/cvsrep login Logging in to :pserver:cvs@localhost:2401/backup/cvs/cvsrep CVS password: cvs : connect to :2401 failed: Connection... (0 Replies)
Discussion started by: srinivas814
0 Replies

5. Shell Programming and Scripting

How To Save A File As A .cvs

Hello. I have a file of text with columns: aaaa bbbb ccc dddd aaaa bbbb ccc dddd aaaa bbbb ccc dddd How can this be converted to a .csv file? Thanks (4 Replies)
Discussion started by: jimmyf
4 Replies

6. UNIX for Dummies Questions & Answers

Copy a windows CVS file to the unix server as a svs file

I so desperately need a script to copy a windows csv file to my unix server and i know these should be at dummies but i have no bits. it is life & no job situation help please. thanks (1 Reply)
Discussion started by: zhegal
1 Replies

7. UNIX for Advanced & Expert Users

CVS: move part of repository (branch) to SVN server

Hi all, We have CVS server running for few years with absolutely no problems. Because of conditions not depending on me, I'm forced to move some part of our repository to another server (SVN). I need to move ONLY one branch from CVS server to SVN server. The branch must be moved with all... (7 Replies)
Discussion started by: +Yan
7 Replies

8. Shell Programming and Scripting

Extraction of latest files from cvs repository

Hi everyone.. Anybody having idea to get the latest file from CVS repository through schell scripts. Thanks in advance. Regards shahid Bakshi (4 Replies)
Discussion started by: shahidbakshi
4 Replies

9. Solaris

backup repository in cvs

dears does any one know how can i take backup for reposirory in cvs ?? (9 Replies)
Discussion started by: murad.jaber
9 Replies
Login or Register to Ask a Question

Featured Tech Videos