Jump to content

How to implement automatic workspace Check-out for all branches?

Recommended Posts



I'm wondering if it's possible to tell Plastic to automatically check-out files placed in the lock.conf file for the entire workspace? And force update on it?


The goal is the ensure that only the latest version of the file can worked on (I know, blasphemy! in the world of branched version control) at any given time on a workspace. 


In other words:

- Once changed, a file is automatically exclusively checkout for all users

- Even after "Checking-in", it is still locked for everyone who is not on the same branch

- Only the latest, on the same branch, checked-in version of the file can ever be modified


I guess it's a bit exotic but it would essentially remove all merging conflicts with not merge-able files. 


Thank you!

Link to comment
Share on other sites



What you can do is to tell the Plastic SCM server to only allow to checkout a file if the revision the the HEAD one. That will present merge operation since a client working with an outdated revision will get an error if he try to check it out, then he will need to update to get the latest and finally check it out if nobody has it locked.


To configure it you need to add a keyword ("requirehead") to each rule in the lock.conf file.

rep: myrep lockserver:localhost:8084 requirehead
During check-out on the client side, if the rule says "requirehead", then you check whether the head of the branch is the working changeset. If not, it cancels the exclusive checkout and tells you that you need to update the branch. This goes for both the CLI and the GUI.


Hope it helps!

Link to comment
Share on other sites

Thank you for answering.


Unfortunately this doesn't work on multiple branches. 


I already had "requirehead" in my lock.conf. So, I tried to checkout a file that wasn't the revision head of a file, the revision head was on another branch, child of it. The checkout worked. So when my actual revision from the other branch would had merged, it would had created a conflict. 


Consider the following branches: 


1-1 (branch from 1)

1-2 (another branch from 1)


You can checkout and check-in the file on branch 1-1 and you can also do it on branch 1-2, as long as both checkouts are in their own branch head changeset and not at the same time.


So when branches 1-1 and 1-2 merges back into the root branch 1, you get a conflict. 


The only solution is to have an automatic check-out that would only be checked-in at merge. 


Is that possible?

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
  • 1 month later...


This topic is now archived and is closed to further replies.

  • Create New...