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.
Related
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.)
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.
I am looking for a perforce command to get the list of the files that have been modified locally and "not" checked-in to the repository.
I understand that I "should" get the list of modified files in Pending changelist, but there are scenarios when I don't get to see a modified file in that list. And then on "manually" checking out a file and doing a diff i realize the difference.
Is there any command that could check all the files in a given folder and provide me a list of files that are not same as there state in the repository?
I tried "p4 sync", but that did not work.
Thanks for your interest.
Try
p4 diff -f -sa
(see manual for further details)
I use "p4 revert -n ./..."
where
-n
List the files that would be reverted without actually performing the revert.
This lets you make sure the revert does what you think it does before actually reverting the files.
In the recent versions of Perforce, try "p4 reconcile -e"
see: http://www.perforce.com/perforce/r12.1/manuals/cmdref/reconcile.html
It certainly takes its time though (not very fast).
I think, the modified files are submitted locallay (Otherwise, p4 opened ./... will help to find)
If files are already submitted to local perforce and still want to know which all are modified..
p4 changes -m 5 ./... (Should give changes lists)
p4 integrate -n ./... //server/code/base/... (This should list the files to be integrated to mainline.
I have a directory outside the repository. I put generated sources in there. These generated sources take FOREVER to create. Rather than have everyone on the team generate these sources, I would like to use our build machine to generate the sources, and check them in to perforce. How do I do this and ensure that the source controlled directory only has only the most recent files and not any that were generated previously but not in the most recent build?
I was thinking of doing a p4 edit on all the files in the generated directory (for existing files), then doing a p4 add using wildcards to get any files that are new, but I do not know how to handle files that were previously generated, but not generated in the most recent build (should be deleted).
Start as you suggested - p4 edit and p4 add to capture all changes, then call
p4 revert -a
Which will revert any file in the depot that is open for edit but is actually unchanged or missing.
I found this on the perforce blog and it is exactly what I was looking for. Automating folder replacement using P4Java and Apache Ant
One idea is to, before the build, removing everything in this area manually (not through Perforce, but through the OS). After doing the build, do a "Reconcile Offline Work". This will reconcile in Perforce what you have in this area by adding new files, deleting ones that are not there anymore, and editing those that have changed.
You can reconcile offline work through P4V, as seen here. In your workspace browser, right-click the folder and choose "Reconcile Offline Work".
Or, you can do it through the command line if you prefer a more automated solution, as seen here. (Note: this link also talks about reconciling through p4v, but this is superseded by the previous link)
p4 diff -se //myclient/... | p4 -x - edit
to checkout changed files.
p4 diff -sd //myclient/... | p4 -x - delete
to delete files.
find . -type f -print | p4 -x - add
find . -type l -print | p4 -x - add
to add files and symlinks in Unix, or
dir /s /b /a-d | p4 -x - add
to add files in Windows.
For Binary files in Perforce you can set a FileType flag that only stores 1 (or a set number ) of revisions for the file in the repository. This way you will have history of the file but your other users will only have access to the binary for the latest version of the file and also your server will only store one copy which is much more storage efficient if you dont need to store multiple copies.
To make the change.
Add the files you are interested in to the repository.
Check out the file.
Right click in P4V and select Change Filetype
On the dialog pops up select +S "Server limits the number of revisions stored" at the bottom of the screen, which will restrict the number of files stored.
Hope this helps.
How do you get a copy of an earlier revision of a file in Mercurial without making that the new default working copy of the file in your workspace?
I've found the hg revert command and I think it does what I want but I'm not sure.
I need to get a copy of an earlier revision of my code to work with for a few minutes. But I don't want to disturb the current version which is working fine.
So I was going to do this:
hg revert -r 10 myfile.pls
Is there a way to output it to a different directory so my current working version of the file is not disturbed? Something like:
hg revert -r 10 myfile.pls > c:\temp\dump\myfile_revision10.pls
The cat command can be used to retrieve any revision of a file:
$ hg cat -r 10 myfile.pls
You can redirect the output to another file with
$ hg cat -r 10 myfile.pls > old.pls
or by using the --output flag. If you need to do this for several files, then take a look at the archive command, which can do this for an entire project, e.g.,
$ hg archive -r 10 ../revision-10
This creates the folder revision-10 which contains a snapshot of your repository as it looked in revision 10.
However, most of the time you should just use the update command to checkout an earlier revision. Update is the command you use to bring the working copy up to date after pulling in new changes, but the command can also be used to make your working copy outdated if needed. So
$ hg update -r 10 # go back
(look at your files, test, etc...)
$ hg update # go back to the tip
The command you use is this:
hg cat -r 10 myfile.pls > C:\temp\dump\myfile_revision10.pls
Knowing a bit of Unix helps with Mercurial commands. Perhaps cat should have a built in alias print or something similar.