How to switch to an old revision of the entire project? - version-control

For what I know, CVS is not like git and svn that you can switch back to an older version of an entire repo code.
The best I tried is I checkout a date (some days ago), using Eclipse. But it checked out a very old version. I'm sure to have inserted the correct date.

You can return to an old version of the entire repo code by running the following command from the root directory of your repo:
cvs update -r <TAG name>
where TAG name is the name of a TAG which was previously created on the entire repo using:
cvs tag -F <TAG name>
In cvs, a TAG is a list of files and their cvs revision. So using the tag command creates that list, and using the update command (with -r switch) is asking to return to the same file revisions which existed when tag was created.
One more important note, to return to the latest revision (head) of all files in you repo, use:
cvs update -A

Related

Restore a removed branch in CVS

By mistake I removed the branch name of a file using TortoiseCVS.
I think this can be reproduced using the standard cvs client with this command :
cvs tag -d -B <mybranch> <myfile>
How do I restore it ?
I tried the following things :
Add the branch to the last revision
Add the branch to the last tag (in my case this is also the last revision)
In either way, a new branch is started and the revision numbering is changed (6 numbers instead of 4). This is not acceptable.
Suppose the revision numbering of the file is of the form 1.1.2.x
Then use this command (you don't need to do a checkout beforehand)
cvs rtag -r 1.1.2 <mybranch> <module/path/to/my/file>

Creating a new repo from a directory of old repo

I am very new to bazaar and I am exploring the features of it (and of version control system)
I have a bazaar repo, lets call it 'foo'. Under foo repo I have a directory, lets call it 'projects'.
so, I want to create a separate bazaar repo with only projects directory & I want to retain the log too. I mean to say, everything that is related to project folder present in log file, should be available with this new repo.
I tried export command, but I just got the directory without any log.
Any pointers where I should look ?
You can do this using the fastimport plugin:
bzr fast-export /path/to/orig/project | \
bzr fast-import-filter -i project1/ | \
bzr fast-import - /path/to/new/project1
(I broke the line for readability)
The first command dumps the revisions of the branch at the specified path to standard output
The second command filters the revisions, selecting only the ones that affect the project1/ directory. The trailing / is important.
The third command imports the revisions from the standard input to the specified branch. If the branch does not exist, bzr will create a shared repository with a branch named trunk in it.
For more details, see the help pages:
bzr help fast-export
bzr help fast-import-filter
bzr help fast-import
The fastimport plugin is included in the default installation on Windows and Mac OS X. If you have a more exotic setup, I recommend installing it with pip. I don't remember 100% the package name, maybe bzr-fastimport. You will also need the fastimport python library.

Get latest revision number of a file from cvs repository

Is there a way to know the latest revision number of a file in cvs repository without checking out that file.
The exact problem is, suppose I know the name of a file which is in cvs repo. Let's call it file1.text.
So, is there any command or any way by which I can search repo for that file and get the latest revision number of that file?
You can use CVS log and give a revision as "starting point":
$ cvs log -r{REVISION}:: file1.text
The -r{REVISION}:: will only search for revisions after {REVISION} (can be a number or tag).
If you don't have a working copy, you can use rls cvs command. With -l argument, it will print the version of files.
$ cvs rls -l MyModule/path/to/the/file
You can use -r to specify a branch.
Here's the command to use:
cvs history -a -c -l module/file1.text
This will display the version and the date the file was last modified. This doesn't require the module or file checked out.

Replace local file by remote file

How do I replace a local file by its latest version in the repository?
Is there also a way of replacing all local files which are conflicting with the corresponding files from the repository?
Both hg update -C and hg revert will do what you are looking for - replace a locally modified file with the clean version in the repository. Personally I prefer hg revert but hg up -C will also do the job
hg revert
Some further details from the help for hg revert
With no revision specified, revert the specified files or directories to
the contents they had in the parent of the working directory. This
restores the contents of files to an unmodified state and unschedules
adds, removes, copies, and renames. If the working directory has two
parents, you must explicitly specify a revision.
Using the -r/--rev or -d/--date options, revert the given files or
directories to their states as of a specific revision. Because revert does
not change the working directory parents, this will cause these files to
appear modified. This can be helpful to "back out" some or all of an
earlier change. See "hg backout" for a related method.
Modified files are saved with a .orig suffix before reverting. To disable
these backups, use --no-backup.
Hope that helps
Chris
svn update ?
Or delete your folder, and svn checkout...
Or try the option --force.

Delete cvs tag from deleted file (Eclipse CVS)?

I tagged some files in a CVS project. Files were deleted and the project was retagged to the same version, with "move existing tag" option checked.
I expected that the deleted files would no longer be a part of this tag version, but they are. Is there a way to untag files that are no longer in project? Also, is there a way to do this automatically, so that when I choose to delete a file that's tagged, it gets both removed and untagged?
The tag isn't removed. You'll have to cvs tag -d my_tag filename. It is usually easiest to do it before removing the file:
i.e.
cvs tag -d my_tag my_file
rm my_file
cvs rm my_file
cvs ci -m "my file has been removed" myfile