I am looking for a very simple solution that would involve task streams obtaining a file lock that propagates up to it's parents recursively until it hit mainline. Just for extra clarity here is an example with an extra sub task.
Mainline MainTask SubTask
- SubTask requests to checkout a file.
- It asks MainTask for the file
- MainTask doesn't have it locked so it asks Mainline for the file.
- Mainline doesn't have it locked either, so it locks the file and gives the lock to MainTask.
- MainTask locks the file and gives it to the original requester SubTask.
SubTask commits the file to itself for history. SubTask STILL OWNS THE LOCK! The lock is only released back to MainTask after SubTask copies up to MainTask. Likewise for MainTask to Mainline.
If anyone else requests the file, they will get blocked, usually because Mainline blocks them for having it locked. Let's go a bit deeper
Mainline Task1 Task2 Task1a Task2a Task2b // - Owns FIle lock
- Task1 and Task1a can't checkout the file cause the recursive lock check hits Mainline who has it locked
- Task2a can't checkout the file because Task2 has it locked.
If Task2b merges and copies up to Task2, then Task2a can now checkout the file. To do so they will be required to merge down the latest version from Task2, and no one on Task2 has it checked out.
So in summery, a stream may only give a lock to a child stream if it owns the lock of the file, and the lock isn't currently checkout. Task1 streams got blocked by Mainline because it doesn't own the lock, Task2 does.
Really need this, like years ago.