Jump to content


Refresh existing workspaces to respect updated typemap

typemap workspace

  • Please log in to reply
4 replies to this topic

#1 Deltafuge

Deltafuge

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 13 September 2018 - 01:04 PM

Hey,

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?

Cheers.

#2 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 588 posts

Posted 13 September 2018 - 06:25 PM

The typemap applies to newly mapped files, but doesn't override the types of any existing files (the typemap is meant to be a default, not an absolute, so it only kicks in for default filetype detection done by "p4 add").

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).

#3 Deltafuge

Deltafuge

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 13 September 2018 - 08:34 PM

Thanks for your reply!

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?

#4 p4rfong

p4rfong

    Advanced Member

  • Staff Moderators
  • 267 posts

Posted 13 September 2018 - 08:48 PM

No, you will have to create a command trigger where a script would run every time "p4 typemap" is executed.
https://www.perforce...commands|_____0

#5 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 588 posts

Posted 13 September 2018 - 09:02 PM

View PostDeltafuge, on 13 September 2018 - 08:34 PM, said:

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?

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.





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