Posted 13 September 2018 - 01:04 PM
I have a number of users with existing workspaces, I have recently updated the typemap (p4 typemap) to include new file type mappings, the problem is that existing workspaces from before the change do not seem to respect the new typemap, my question is what options do I have in terms of getting this update applied to the users workspaces?
I feel like the following options are potentially available.
- Some magical function that will apply this to the existing workspace (that'd be great).
- Getting users to create a new workspace every time we have to update the typemap
-- This sucks because it could involve length reconciles or some other command.
What's the best option here? I don't see why the users work space should override this anyway?
Posted 13 September 2018 - 06:25 PM
If you want to change the filetype of existing files, the best way is to submit a new revision so that the change is versioned:
p4 edit -t NEWTYPE //depot/some/path/....type p4 revert -a p4 submit
All workspaces will pick up the change the next time they sync.
You can also use the "p4 retype" command if you want to avoid creating new revisions, but then a bunch of caveats apply (existing workspaces won't pick up the change unless they force-sync, for example).
Posted 13 September 2018 - 08:34 PM
OK, this is not ideal and I would have hoped that this would just be picked up upon the next checkout of any file with that extension, if I manually change the type mapping for all relevant files will P4 be smart enough to not download the whole file again and only update the workspace mapping to match?
Posted 13 September 2018 - 09:02 PM
I don't think so (unless the behavior has changed, syncing identical files is only optimized for the case where the client mapping has changed). But as a general rule you do want to refresh the client file if the type changes. Like I said "retype" won't cause a resync, so maybe that's what you want -- it depends entirely on what the old and new types were. For example, if you changed keyword expansion behavior, you absolutely want everything to resync. If you added the exclusive open flag, not so much.
For the command trigger thing Randall suggested above, the command(s) you'd want to trigger on to get the behavior you describe (change the type on the next open) would be ones that open files (primarily "p4 edit"), so you could rewrite the command arguments to include "-t TYPE". IMO you're much better off just doing it all in one shot, either via "p4 edit" or "p4 retype", than having a trigger that will need to be maintained forever.
Posted 02 April 2020 - 09:50 AM
Hey, jumping in as I've just made the same issue for myself. I need to update my typemap but already did the initial push to the server. Not confident enough to use the obliterate command...
For a fresh server where no one else is logged in yet, how to I run the retype command on all files once I've changed the typemap?
Posted 02 April 2020 - 03:33 PM
See "p4 help retype" for info on how "p4 retype" works.
Or just do the "p4 edit -t" thing I described earlier. If nobody else is working on these files, the fact that they all got a new revision isn't going to be in any way disruptive.
Posted 03 April 2020 - 10:05 AM
Thanks very much for the reply!
I tried fruitlessly, but unfortunately I couldn't get it to work... I resorted to spending a few hours going into each file and changing the type to what matches in the typefile I was asked to use.
I would still be interested to know what commands I should have used so I can add it to my personal perforce documentation which I'm hoping to share with the UE4 community (a lot of us are having a really hard time trying to get this off the ground)
Posted 03 April 2020 - 02:09 PM
I'm pretty sure either "retype" or "edit" is the correct command to use. What exactly did you try, and what didn't work?
Posted 03 April 2020 - 04:12 PM
p4 retype help worked, but almost every combination I put in thereafter seemed to give me a failure message of some description. I tried it with the whole depot, file area, an individual file. I can't remember exactly what the errors said, should have screenied it but it was late and I was loosing motivation :/
Posted 03 April 2020 - 04:54 PM
Having the error message and knowing what commands you used would make it possible to debug. Any time you're trying to get remote help from someone (whether it's professional tech support or some rando on the Internet) it's very important to keep track of what you did and what happened so you can relay it to the other person!
Here's what it looks like when it's working -- in my example I want to change everything in my current directory (all the files currently have the type "text") to the type "text+k":
C:\Perforce\test\main>p4 files ... //stream/main/main/bar#1 - add change 149 (text) //stream/main/main/baz#1 - add change 149 (text) //stream/main/main/foo#1 - add change 149 (text) C:\Perforce\test\main>p4 retype -t text+k ... //stream/main/main/bar#1 - text now text+k //stream/main/main/baz#1 - text now text+k //stream/main/main/foo#1 - text now text+k C:\Perforce\test\main>p4 files ... //stream/main/main/bar#1 - add change 149 (text+k) //stream/main/main/baz#1 - add change 149 (text+k) //stream/main/main/foo#1 - add change 149 (text+k)
Note that I'm just running the "p4 files" commands to show what files are there and what their current types are.
If I wanted to change their type via "p4 edit" (let's say this time I want to make the files that start with "b" the "binary" filetype), here's how that looks:
C:\Perforce\test\main>p4 edit -t binary b... //stream/main/main/bar#1 - opened for edit //stream/main/main/baz#1 - opened for edit C:\Perforce\test\main>p4 submit -d "Changing the B files to binary" Submitting change 150. Locking 2 files ... edit //stream/main/main/bar#2 edit //stream/main/main/baz#2 Change 150 submitted. C:\Perforce\test\main>p4 files ... //stream/main/main/bar#2 - edit change 150 (binary) //stream/main/main/baz#2 - edit change 150 (binary) //stream/main/main/foo#1 - add change 149 (text+k)
For what it's worth, I typically recommend using the "p4 edit" method unless you have a very compelling reason to use "retype" instead, because I think it's generally preferable to have all of your changes be versioned rather than to have them apply retroactively.
Posted 05 April 2020 - 08:10 PM
I will give it another go as I need to edit the typemap with another change! Thanks again for your help
Do you know if there's any way to use retype on specific file formats in specific areas of the depot? Or is retype only to be used generally or on certain files
Posted 05 April 2020 - 09:35 PM
Sounds like you didn't have a client spec set up. Any time you're operating on local files (so like when you're opening them for edit, or even when you're referring to files by a local relative path), the client spec defines how your local files correspond to the depot files. If you got the error I'm thinking of, it actually tells you exactly how to fix it!
C:\Perforce\test>p4 files ... Client 'subressors-computer' unknown - use 'client' command to create it.
If I already had a client spec set up on this computer, I could switch to it by running "p4 set P4CLIENT=that-client-name", but the error message is telling me that I can create a new client spec with the "client" command. Thanks for that tip, error message! Let me try that...
This brings up my text editor with my new client spec:
Client: subressors-computer Owner: subressor Description: Created by subressor Root: c:\Perforce\test Options: noallwrite noclobber nocompress unlocked nomodtime normdir SubmitOptions: submitunchanged LineEnd: local View: //depot/... //subressors-computer/...
The important parts of the client spec are the "Root" (which says where the client spec lives -- it defaults to my current directory) and the "View" (which says how the depot relates to the client root -- by default the entire depot is mapped, or all depots if you have more than one).
If I save this file and exit the editor, it saves the client spec:
C:\Perforce\test>p4 client Client subressors-computer saved.
Now I can run commands on files in my local directory! The client spec says that whenever I'm in C:\Perforce\test using this client spec on this computer, it's the same as being in //depot on the server.
C:\Perforce\test>p4 files ... //depot/foo/bleh#1 - branch change 147 (text) //depot/main/bleh#1 - branch change 148 (text)
I would recommend using the "p4 edit" method; "p4 retype" is not something that's meant for general or routine use.
Any command that operates on files can take a wildcard pattern -- in my previous post you saw how I used the pattern "b..." to say "open all files whose paths relative to this directory start with b for edit with the type of binary". You could also do "....txt" to say "all files under this directory that end in .txt", or "//depot/foo/....jpg" to say "all files that are in the //depot/foo directory whose names end in .jpg", or any combination you can imagine.
Also tagged with one or more of these keywords: typemap, workspace
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users