Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the Right Way to Make Minor Local Edits on Files in Perforce through Eclipse?

I'm working at a company that uses Perforce, and find it really annoying that when I edit something locally for a purely local purpose (maybe I want to change a path to point to something local for testing, etc...), that change is automatically added to my pending changelist and winds up cluttering it up. Intuitively, this seems strange, and in practice it's pretty annoying. It also makes it look to others like I'm editing the file and plan to upload it back to the depot, when this isn't at all my intent. All of that said, is there a simple way to differentiate between edits I plan on submitting, and edits I only want to exist locally? I'm using the eclipse plugin for Perforce, so bonus points if someone can give me a way to easily do it there. I know this is probably a stupid question, but I'm gonna need to find the answer at some point, so it might as well be now.

like image 525
Eli Avatar asked Oct 26 '25 06:10

Eli


1 Answers

Why don't you create a separate changelist into which you put files that you don't intend to check in? It is still going to show up as being under edit to others, but why does that matter? Having these files tracked as changes in a CL gives you an easy way to revert back to Perforce copy when you need to as well as merge with any incoming changes.

Andy already mentioned "make writable" trick. To revert back from that position, you can run the check consistency action. It will find files that were modified, but not checked out. This is also a good way to work offline. Make it writable and then run check consistency when back online.

Another alternative is to copy file contents to clipboard, tell perforce to remove the local copy of that one file and then create a new file in its place with contents from the clipboard. From Perforce perspective the file at that point hasn't been synched to your workspace. When you go to sync, you will get a notice of collisions with existing local files that you would have to resolve by forcing the sync or deleting the local files.

Another alternative if you edit a certain specific file frequently is to use your client spec to map it out completely. Perforce will not try to sync it from depot and you can maintain a local equivalent however you want.

On a somewhat related note... If you find yourself doing this a lot, consider that perhaps what's in Perforce isn't as general as it should be. Maybe a property or an environment variable could be added so that you can override some setting without editing the file.

like image 71
Konstantin Komissarchik Avatar answered Oct 28 '25 22:10

Konstantin Komissarchik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!