views:

433

answers:

6

Can perforce be adjusted so I don't need to "open files for edit"? Someone told me that this was a "feature", and that s/he guessed it could be turned off.

A: 

One approach you can use is edit the readonly files on your synch'd branch. When you're ready to submit use the 'check consistency' File | More option to create a changelist on the basis of the modified files. There's probably a command-line way of doing this but I don't know what it is.

tonylo
A: 

@David G: The real reason why I want to get rid of it is because it is an extra hassle.

Erik Itland
I guess I view it as extra discipline, though I understand your point.
David G
Perforce keeps the unopened files as readonly, so I'm not sure how marking them for edit is any more hassle than changing the permissions (or forcing a write). You might also benefit from finding a way to integrate Perforce file actions into your editor, which is how I usually handle it.
Caleb Huitt - cjhuitt
+1  A: 

According to the Wikipedia page on Perforce, they expect you to "open files for edit" so the server can maintain a list of files that are expected to get changed. If you want to edit files without doing this, you have to manually change your local copy from read-only to read-write.

Neall
+1  A: 

Although that's not a direct answer to your request, I though I could share a little trick.

In my editor (SciTE), I can define keyboard shortcuts, with a macro expanding to the path of the currently edited file, running an application. If your favorite editor can do that, you can adapt this trick.

command.name.0.*=P4 edit
command.0.*=p4 edit -c default $(FileNameExt)
command.save.before.0.*=2

You can change the "default" to your current changelist number, too.

Of course, if your editor/IDE has Perforce support, so much the better...

PhiLho
A: 
MP24
A: 

I will resist trying to reason with you as to why you wish to do this. Probably teh simples way to do this is the following.

Check out the entire directory tree you are interested in eg

//depot/Projects/MyProj/...

All you files are now writeable and in editing (or checked out) mode. When you choose to submit your changes, simply do one of two things. Either right click the pending changelist and select Revert unchanged files to get rid of unchanged files before submitting or when submitting select the 'Dont Submit Unchanged Files' options under On Submit. This has the effect of only submitting the files you have changed.

If you also check the box beside 'Check out submitted files after Submit' it will even reopen those files so that you can continue working until the next time you wish to submit.

This is essentially what you are looking for.

Toby Allen
Although if you do this, you will risk annoying everyone else on your team, as every file will be marked as "open for edit by another user".
Simon Nickerson
the whole point of a non locking source control system is that it doesn't matter if a file is "open for edit by another user"
Toby Allen