Re: [SCRIPT] cg-rpush & locking
- From
- Thomas Glanzmann <sithglan@stud.uni-erlangen.de>
- Date
- Jun 1, 2005, 06:51 UTC
- Message-ID
- <20050601065123.GA23358@cip.informatik.uni-erlangen.de>
- In-Reply-To
- <Pine.LNX.4.63.0505311914550.6500@localhost.localdomain>
Hello,
> Why do you need a lock at all?
> Just update your HEAD reference last when you push and get it first when > you pull.
consider the following scenario: Two people push at the same time. One HEAD gets actually written, but both think that their changes got upstream. Of course the 'upstream' tree is consitent, but incomplete. That is why we need a lock. And the lock should be obtained before the remote HEAD is retrieved, I think the following scenario is how to handle it:
1. acquire remote lock 2. get remote HEAD 3. if remote HEAD is ahead (not included in our history) abort and free lock. 4. push objects 5. update remote HEAD with local 6. free remote lock.
Thomas