Jump to content


How to remove files from depot without clobbering local versions with same name?


  • Please log in to reply
5 replies to this topic

#1 benchang

benchang

    Member

  • Members
  • PipPip
  • 10 posts

Posted 31 July 2019 - 03:22 AM

I have files that every user must have locally, but should not be under version control and should never be in the depot.  It's a Unity3D project; the problem is with the Library/ directory.

Someone accidentally submitted a changelist that included their Library/.  I'd like to remove it from the depot, as nobody can sync now without clobbering their own Library/ and breaking the project.  But the p4 operation to delete it wants to delete the copy in my workspace as well.  That's not what I want - the whole goal is to retain the local workspace copy.  Is there any way of doing this other than just letting it delete the Library and then allow Unity's asset processor to chunk through the Assets directory again and regenerate it?  Or, can I roll back the state of the depot to before the changelist was submitted?

Brief context: the Unity game engine has an asset processor that imports and converts models, images, audio, scripts, etc into efficient internal format. It stores these as cryptic hashed blobs in a special directory called "Library" inside your project folder. It's non-portable and the project breaks if you copy it to another machine. Maybe it's serialized application state so very specific, I don't know exactly, but the main thing is that best practice is to never have it under version control.

#2 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 927 posts

Posted 31 July 2019 - 06:19 AM

Obliterate these files, and then block access to them via the protection table so that nobody can re-add them.

When the files are obliterated, it's like they were never added to the depot at all; any workspaces that already include these files will "forget" that the files were in the depot and will treat them as unadded files.  Obliterate is a dangerous command since it removes history and is not reversible, but in this case it's exactly what you want.

Files that should never be added to the depot should not have "write" permission in the protection table.  You probably want to add a line to the protection table like:

	write user * * -//depot/project/Library/...

to make sure that nobody can submit anything to that path.

If you're using streams, another way to do this is to exclude it from the mainline stream:

Paths:
	share ...
	exclude Library/...


#3 benchang

benchang

    Member

  • Members
  • PipPip
  • 10 posts

Posted 02 August 2019 - 04:34 AM

Excellent, thanks.  That's a great name for a command.

Is there any way for a regular user to achieve this, like undoing their submitted changelist?  (I don't have admin privileges, and we don't have an admin with much time to help with this so I'm trying to find ways of doing things as regular users as much as possible).

Along those lines, is there a way to set up excluding files without being admin, like a .gitignore?

#4 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 927 posts

Posted 02 August 2019 - 05:26 AM

Undoing a change (i.e. as a normal user, not an admin using obliterate) is itself a change, and will get synced down to other clients, so everyone who's synced those files will have them deleted (and then have to rebuild them, which hopefully isn't the end of the world).

The best way to exclude files from being added is to exclude them from your stream or client view.  (If you're using streams, your client is automaticallyderived from a stream that you share with other users; if you're not using streams, everyone sets up their own client manually).

In streams, excluding a path looks something like:

Paths:
		share ...
		exclude Library/...

In a classic client view, it looks more like:


View:
	  //project/... //my_client/...
	  -//project/mainline/Library/... //my_client/mainline/Library/...		


#5 benchang

benchang

    Member

  • Members
  • PipPip
  • 10 posts

Posted 04 August 2019 - 01:54 PM

Oh!  of course.  I keep forgetting what the View does.  In classic client view, can you use wildcards to exclude a directories matched by name but in any location, or exclude files by type in any location..?

-//depot/*/Library/...	  //my_client/*/Library/...

-//depot/*.sln	 //my_client/*.sln

Yes, in my case, it's ok for everyone's local versions of these to be deleted and then they have to rebuild them, so the Undo method will be all right. The rebuild is automatic in Unity, and happens anyway when you do something like switch target platforms.  It's just annoying because it can take a long time on large projects.

#6 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 927 posts

Posted 04 August 2019 - 03:57 PM

View Postbenchang, on 04 August 2019 - 01:54 PM, said:

Oh!  of course.  I keep forgetting what the View does.  In classic client view, can you use wildcards to exclude a directories matched by name but in any location, or exclude files by type in any location..?

-//depot/*/Library/...	 //my_client/*/Library/...

-//depot/*.sln	 //my_client/*.sln

Yup!  Note that * matches only a single directory (i.e. a string that does not include a slash); if you want to match at arbitrary levels of depth you can do:

//depot/... //my_client/...
-//depot/.../Library/...	 //my_client/.../Library/...
-//depot/....sln	 //my_client/....sln





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users