Core includes a semaphore table as of...I dunno, some recent version of D6. We need to use it whenever we run manual log fetches, or any other extended operation.

I noticed this because versioncontrol_git has a nasty, hacky one-off way of doing this...

Comments

tizzo’s picture

The question is whether this should be handled by vcsapi or left to the backend. The semaphore api is pretty easy to use and all we really need to do is call lock_acquire('versioncontrol_[name of repository]') and lock_release('versioncontrol_[name of repository]') so it could go in either place.

Where does everyone think it makes the most sense?

marvil07’s picture

Project: Version Control API -- Git backend » Version Control API
Component: Code » API module
tizzo’s picture

Assigned: Unassigned » tizzo

Sam and I discussed this in IRC today. The current plan is to add wrapper methods to the VersionControlRepository object that acquire and clear locks using the semaphore api. That way we don't have to rely on magic naming and reimplementing things the same way in different backends.

Planning to hit this up in the next 24 hours.

tizzo’s picture

Here's a first crack...

tizzo’s picture

Status: Active » Needs work
marvil07’s picture

+++ includes/VersioncontrolRepository.php	22 Oct 2010 21:03:45 -0000
+++ includes/VersioncontrolRepository.php	22 Oct 2010 21:03:45 -0000
@@ -758,4 +758,25 @@ class VersioncontrolRepositoryUrlHandler

Please note that there are two classes on that file, and you want to move the code to VersioncontrolRepository instead of using VersioncontrolRepositoryUrlHandler

Powered by Dreditor.

tizzo’s picture

Sorry about that, sloppy patch.

This is set and I have tested it. I think it's working. Now we just need to use it elsewhere.

tizzo’s picture

Status: Needs work » Needs review
marvil07’s picture

Priority: Normal » Major
Status: Needs review » Needs work
Issue tags: +git phase 2, +git sprint 4
StatusFileSize
new1.68 KB

As we have used locked _only_ from backends, not at versioncontrol module, we do not really have a use case here. But we do have it at backends, maybe the better is to move the "automatic retrieval" to the versioncontrol module, and let backends use it, and we can handle then the locks here.

Tagging and changing the priority since this is now mainly broken for backends(git) that are assuming a VersioncontrolRepository->locked data member exists.

For now, a minor update:

+++ includes/VersioncontrolRepository.php	2 Nov 2010 04:24:46 -0000
@@ -505,6 +505,27 @@ abstract class VersioncontrolRepository 
+    lock_release('versioncontrol_' . $this->name . '_lock', $time);

lock_release() do not receive a second parameter.

And update a comment ;-)
Powered by Dreditor.

marvil07’s picture

Something almost-related: #484376: Use the batch API for the Fetch Now link (if we decide to move "automatic retrieval" to the main versioncontrol module)

sdboyer’s picture

Conceptually, I like the idea of having a VersioncontrolRepository::fetchUpdate() or something - a single method that all backends need to implement which trips off the manual retrieval process. If we do that, then we might use the parent implementation to handle the lock acquiring...maybe.

tizzo’s picture

Status: Needs work » Postponed

This needs more thought and restructuring.

marvil07’s picture

Status: Postponed » Needs review
StatusFileSize
new1.91 KB

re-add lock as column for repo table instead of using data field.

marvil07’s picture

missing data member, now is there

marvil07’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)
Issue tags: -git phase 2, -git sprint 4

Automatically closed -- issue fixed for 2 weeks with no activity.