Helix core get a folder version (with content) - perforce

in Helix Core one can easy find a file version.
Is there a way to get a folder version, taking into account all the folder content (if any file inside changed, folder verion should change too)?

A "folder version" is a changelist associated with a folder. Do:
p4 changes //depot/folder/...
Those numbers are the "versions" of the folder. You can do:
p4 sync //depot/folder/...#N
to sync to any one of them.

Files are versioned, but folders are not.

Related

Cannot mark for Add files in perforce

I wrote 2 python scripts which I want to add to changelist in perforce. So in my workspace (in perforce gui) I created a folder /pythonP and using my unix file manager I copied paste my 2 python scripts in /pythonP, which is in my workspace (not in depot because I just created and didn't submit anything) So in perforce I can see in my workspace my 2 python scripts, but when I try to put them in a changelist (drag and drop or right-click:add to mark) I get no error messages but the files just don't appear in the changelist. I right-clicked on the changelist and the 'Files' section is empty. Any suggestions?!
The "File(s) not in client view" error indicates that the folder the files you're trying to add are in, is not part of your mapped workspace. Either you don't have anything mapped in your workspace view, or the place your files are, is not the place Perforce is controlling.
One thing you can do is to right-click on the depot directory in the depot view, and select "show in explorer". The folder that opens is where Perforce expects your files to be.
I should explain: A Perforce repository is not like an FTP site, where you copy files from the local place to the remote place. To add a file to Perforce, you put it where you want it to be in your local copy of the depot, and then tell Perforce to start tracking it (with p4 add). The addition does not move or copy the file. (Of course, the file content does get copied to the Perforce server... but logically, you're putting the file in your workspace, not having Perforce do that for you.)
Try updating your workspace. I had this problem when someone else had added a file, my workspace was out of date, and I was trying to add a file with the same name in the same location.
I had same problem right now and I not found solution. It was depot folder where project files shold be. After added to workspace 'depot' folder and move project files inside, add and submiting works.

Perforce: move directory with keeping history

Colleagues,
I have two different directories:
- path/animals/dir1
- path/cars/dir2
I want to move dir1 into path/cars/ with keeping all history of this folder.
I tried several ways: merge, copy and rename/move using P4V,
but all of them leads to erasing history in moved directory.
If there is a way how can I do it?
Thanks in advance!
We have used p4 move extensively in recent versions of P4 to do these kinds of directory moves.
In my experience, if you branch/delete (or more recently move) the files, you'll have the history of the original location intact (with delete/move records), but if you look on a revision graph in P4V, you should see all of the older revisions in the previous locations before they were moved (deleted).
If you use p4 sync with a particular date or changelist, you should also get the original directory back with the versions of the files at that time (and the newly moved versions should be removed after the sync, assuming both directories were in the area that you were syncing).
I have experienced problems (this probably will change in 2013.2, as I've read that Perforce is changing the default integration engine) with integration across move/delete and move/add transactions which require the use "generation 3" integration option, but once that's specified (which you can do by adding a -3 to the command line p4 integrate command, everything works better for me across those moves.
The history of the moved directory has not been erased. I'm guessing you think this is the case because the files are longer visible in P4V. By default, P4V does not display deleted files in the depot tree. Since you moved the files to a new location, they were deleted from their old location and are now no longer displayed. You need to turn on the option to "Show Deleted Depot Files". If you click on the yellow funnel icon to the right of the Depot/Workspace tabs you'll see that option. Check it and P4V will then display the deleted files in their original location.
While moving folder to another destination all history still present but only for appropriate files, not for a directories.
Here is a proof:
http://comments.gmane.org/gmane.comp.version-control.perforce/19820

How to exclude a folder and not its children from SVN Update in Tortoise SVN

I am working on a shared project which is put in SVN. The directory structure of the project is as follows:
ParentDir
- Child_Dir_1
+ GrandChild_Dir_1
+ GrandChild_Dir_2
- Child_Dir_2
Child_Dir_1 contains configuration files (Eclipse's .LAUNCH files), and people put all sorts of file in this folder.
So each time I update my source code (by right clicking on ParentDir and picking Update), I got a lot of configurations that I don't really need, and I have to delete them manually.
I still need to have the children of Child_Dir_1 (which are GrandChild_Dir_1 and GrandChild_Dir_2) to be updated.
I have tried to go to set the "ignore" property of the of Child_Dir_1 to exclude *.LAUNCH files, but each time I update the source code, the ones that I manually deleted are restored to Child_Dir_1.
Since you are using TortoiseSVN:
Go into Child_Dir_1, select GrandChild_Dir_1 and GrandChild_Dir_2 and right click, TortoiseSVN -> Update.
That will update only those two folders.
Ignore is so that you can "ignore" ( from commit, status etc.) untracked files, files that are not checked in.
It could be that manojlds' answer is the solution for you, but I have doubts. The problem here is that those files are really part of the project. They are kind of unavoidable, and must be in sync with the rest of working copy.
Option 1 (best): Remove all configuration files form repository, or better yet have in repository only configuration template files (with, say, $ as first character in file names). Each user could copy those template files to true configuration files and change them accordingly. Configuration files should not ever be committed. Only template files should, but updating template files will not mess with current configuration files of any user.
Option 2 (second best): Ignore those configuration files. Use your own files for your own configuration, with names that don't clash with existing. You may even add your files to SVN, but you may just as well not add them. Does not matter, as long as you don't need your configuration on another machine.
Option 3: Use ignore-on-commit group. Use those configuration files that already exist. Change them to your likings, but don't ever commit them. To ensure that you don't commit them by accident flag them as non-committable (go to commit window, select all non-committable files, right click > Move to changelist > ignore-on-commit). The problem with this is your files are not protected from other users' updates, but may actually be a good thing.
Option 4: Chop the folder out (a horrible hack). Remove Child_Dir_1 from working copy (Right click on it > Update to revision > set Working depth to Exclude). Save the folder elsewhere first, because it will disappear. After that create it again, inside it checkout all subfolders (GrandChild_Dir_1 and GrandChild_Dir_2), and copy your configuration files. Now you have complete control over folder's contents, but update and commit become more complicated.
Edit: There is option 5 in theory, but I doubt it can be implemented successfully. You can try: Use NTFS hard links. Copy the whole tree with all files as hard links to existing files, except .svn folders and their contents. Original directory is used for SVN operations update, commit, add and delete, and new directory is used for editing files. From new directory delete all the files you don't need, and insert all the files you do need that are not the part of SVN. The problem here is minor extra work when deleting files from and adding them to SVN.

How do I download files from perforce to a location other than a workspace?

I want to get files from Perforce without putting them into a workspace.
E.g.
I have made changes in 2 files.
file1.cs
file2.cs
Now I want to build the project using updated file1.cs, so I want to get latest files except for file1.cs.
I thought I will get another local copy of project and build it.
I'm not sure what you really want to do, but you can get the contents of a file from the depot without using a workspace definition by using "p4 print". Example:
>p4 print -o fileName.cs //depot/path/to/fileName.cs
As far as I am aware you cannot sync files from a Perforce depot without using a workspace since this is the way it tracks what version of files you have in your workspace and also where to put them on your local machine (as well as a few other things).
I'm not sure I entirely understand your problem but if what you need to do is get another copy of the file1.cs you have in the depot without removing the changes you have to it you can simply copy the changes to another location or shelve them and re-sync the file. The more complete and less dangerous solution is to create another workspace pointing to a different physical location on your machine but the same depot location.
This explains how to create a workspace if you need it:
http://www.perforce.com/perforce/doc.062/manuals/boilerplates/quickstart.html
Make sure the 'Root' path is different to that of your current workspace, you can check what your current workspaces root is by going to the workspace tab in P4V and viewing it.
Once you have created the new workspace create a new connection and select it then sync the file(s) you need.
So I want to get latest files except file1.cs
You shouldn't do that; you should update all files and resolve any conflicts with file1.cs
Consider the situation where someone else has made changes to file56.cs that relies on changes also made to file1.cs. If you take their changelist but overwrite (or do not take) their file1.cs, then your build will break.
Shelve file1.cs so you can safely revert your local change:
p4 shelve file1.cs
p4 revert file1.cs
Now you can do your build with whatever version of file1.cs you want (you can sync back to an older version or whatever).
When you're ready to return to your change:
p4 unshelve -s CHANGE
If you're in the UI you can use File->Export To... which will copy the selected file to any folder you want.
I found the workaround but not the solution.
I get another local copy of project then build the project and submit the change.
I found an easy way of doing this with git:
$ git p4 clone //depot/your/folder

In perforce, how do I remove pending changes for NEW/ADDED files not submitted?

I am trying to remove a pending changelist in perforce. All the files (20 old) are new but have not be committed/submitted yet. So in p4Win, they show a RED + cross. I am failing to remove these files from the change list. How do I go about getting rid of these files?
Thanks for the answers to right-click and revert. I have tried that but it fails with the example error strings below.
Operation: user-revert
Librarian digest source/.../foo.c failed.
RCS checkout 1.715484 failed!
RCS no such revision 1.715484!
//source/.../foo.c#1 - was add, reverted
I've also tried the p4 revert command but it fails with same error(s).
Fixed with "revert -k" by perforce support group. They suspect it may be due to overlay values in the client workspace but have not been very specific.
How are you trying to remove the files?
It's been a while since I used Perforce in anger but I seem to remember that you just had to right click and revert the file.
I've just tried this and it worked OK for me (the programmer's lament!). It uses the following p4 command:
p4 revert //depot/test.txt
Where test.txt is the name of the test file.
Update
Does the new file still exist locally on your hard drive?
Does the path where the file would be in the depot still exist? ie. what's in the "..." of your path.
Revert files, right-click on file in change list and select revert, this will remove added files.
Maybe try Perforce support at this stage.
To remove all added files in current and sub directories:
p4 revert ...
In my case this happened because the RCS files (the actual files with ,v extension in the depot that contain all the revision information) were literally missing the information for the revision in question. I was able to restore the files from backup.
I had the same problem, I had added the .exe files but wanted to exclude them afterwards. The perforce documentation helped:
http://www.perforce.com/perforce/doc.current/manuals/p4eclipse/topics/adding.html
Excluding Files from Source Control
Important: you cannot exclude files after you have placed them under
Perforce control. If you have files opened in a changelist and you
want to exclude them from Perforce control, revert them from the
changelist before excluding them.
Worked like a charm.

Resources