4

With a fairly basic subrepo structure like this:

parent
parent/subrepo1
parent/subrepo2

Race conditions tend to occur when multiple users push changes at the same time. Simple example:

User 1 & 2 begin pushing.
User 1 skips parent/subrepo1, no changes.
User 2 pushes to parent/subrepo1, with changes.
User 1 pushes to parent/subrepo2, with changes.
User 2 tries to push to parent/subrepo2, but cannot because it will create multiple heads.
User 1 finishes pushing parent.

The result of this is that User 1 managed to push everything successfully, but User 2 partially pushed and then failed. This left a head on parent/subrepo1 which doesn't have a corresponding commit in parent, which will cause problems for the next person to push parent/subrepo1 unless User 2 discovers their error, pulls parent, merges, commits, and then attempts to push (but there's no guarantee another user won't attempt to push at the same time again!).

My question: Is there a way within Mercurial to force users to wait while a push operation is underway on a Mercurial repository with other subrepos (to effectively implement a mutex) OR is there a way to undo a failed push on the target's changed subrepos when a user fails to push.

Salami
  • 1,048
  • 1
  • 10
  • 17

0 Answers0