CVS change revision of file to a newer one - version-control

simple question. I got a file xy.c that has a repository revision 1.1. Its on a branch. In head there is a newer version with version 1.4 . Now i want the file xy.c point to version 1.4.
I already tried cvs update -A xy.c
and it updates the file and cvs status show revision 1.4 but i cant commit that file and when I check it out its still revision 1.1 .
What am I doing wrong?

I think you need to somewhat bypass CVS and send the file to stdout (-p) and then back into the file.
cvs update -r 1.4 -p xy.c > xy.c
I know that sounds crazy or like overkill, but some seemingly-simple things are difficult in CVS.
(Note that if this file has+needs an execute bit set this will be lost and you'll need to chmod +x xy.c. Probably not necessary if .c is indeed the extension, but if it's something else you might need it.)

Related

How do I check the previous version of a file after I have changed its version in cvs?

I did a cvs update -r "1.5" on file abc.html. The abc.html has versions until 1.10. The previous version it was in was v1.8.
Let's say I had no idea it was in v1.8 after I changed its version to v1.5. How do I use cvs to find out that the previous version of the file used was v1.8?
Or in other words, how do I use cvs to track all previous change in file version?
It's very hard to know what you mean from the wording of your question, but I think this is it... You had a workspace that was a bit old. abc.html was at version 1.8. Then you did cvs update -r 1.5 abc.html and now you want to undo that operation and get back to the version that corresponds to the date of checkout of the rest of the files in your repository. The short answer is that you cannot. CVS tracks changes on a per-file basis, not a per-directory one. Unless you know the timestamp of when you checked out the whole repository, or you have a tag that was applied to the whole repository that you were checked out to, what you want can't really be done.
Other possible things you might have meant:
The previous version to 1.x is 1.(x-1).
How many versions are there? cvs log <filename>.
What version does the current workspace have checked out? cvs status abc.html.
note: You probably do not want to do cvs update -r 1.5 abc.html as that will put a "sticky tag" on the file and it will be forever stuck at 1.5 even as you update the rest of your repository to the latest versions. For examining old versions of individual files, if cvs diff -r 1.5 abc.html is not enough, I would recommend using -p to send the output to stdout. e.g. cvs update -p -r 1.5 abc.hmtl > abc.html. Or you can even redirect it to /tmp/abc.html.

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.

How to get revision number from Mercurial repository and paste it to NetBeans resource bundle?

I have a java project in NetBeans and im using Mercurial for version controlling.
I want to see my project version number in about box and i want it to be updated according to Mercurial revision number.
Any ideas how to do it? :)
Following 'Version numbering for auto builds with Mercurial', you can record in a VERSION.TXT file (that you about dialog would display) the result of:
hg log -r . --template '{latesttag}-{latesttagdistance}-{node|short}'
Lazy Badger comments:
log will be a lot better (and correct) with:
hg log -r tip --template "{latesttag}.{latesttagdistance}"
You have more options in "How good is my method of embedding version numbers into my application using Mercurial hooks?"
version_gen.sh with:
hg parent --template "r{node|short}_{date|shortdate}" > version.num
In the makefile, make sure version_gen.sh is run before version.num is used to set the version parameter.
If Windows, MercurialRev ("SubWCRev for Mercurial") may be useful also
Replaces revision information in a tagged text file.
MercurialRev <SourceFile> <DestinationFile> <RepositoryPath>
Tags:
<$HG:REV_NUM$>
<$HG:REV_LMOD_N$>
<$HG:REV_LMOD_P$>
<$HG:REV_ID$>
<$HG:BRANCH$>
<$HG:TAG$>

Perforce command line head revision file

What is the command line syntax to check whether this workspace currently has the latest revision of a certain file?
The command:
p4 sync -n
will preview the sync operation. This will tell you which files would be updated were you to use the actual command.
The command:
p4 have [file]
will tell you the version of the file you currently have. This coupled with:
p4 fstat -T "headRev" [file]
which tells you the head revision number, will tell you whether you have the latest version or not.
It's worth noting that all Perforce commands have a preview option that tell you what they would do. This allows you to verify you've got the correct command without fear of corrupting your workspace or depot.

How can I get a complete version from TortoiseHg

I am using TortoiseHg as my source control for developing a CMS project written in .NET/C#. I don't know how can I get a whole complete version from my source repository. Is it possible? a version for a specified date.
Thank you.
The command hg update will update your working directory to any prior version of your choice.
The command hg archive will provide you with a zipfile or tarball representing any point in history.
For both commands you can specify your exact revision using the -r argument.