MercurialBridge

From Genunix

Jump to: navigation, search

Teamware-Mercurial Bridge

The SCM Migration Project has a script to bridge the ON Teamware gate to a Mercurial repository. This is not a general Teamware-to-Mercurial converter. The ON gate keeps additional information for each putback, and the bridge relies heavily on that information.

Overview

Each ON putback triggers a call to a helper script, /ws/onnv-gate/public/gate/bin/sync_hg via the Teamware putback notification hook. This script takes one argument, which is either the keyword "undo" or a pointer to the per-putback metadata (the "additional information" mentioned above).

The undo code path is untested. And based on our experience from the last undo/rollback, it probably doesn't work.

For normal putbacks, sync_hg invokes the bridge, giving it pointers to the per-putback metadata, the Teamware gate, the Mercurial open-source repository, and the Mercurial closed-source repository. The bridge parses the metadata and updates the two Mercurial repositories as needed. The sync_hg script then pushes the open-source repository to the Mercurial repository on opensolaris.org.

Operational Notes

The sync_hg script creates a lock file. If it errors out, it leaves the lock file in place so that future putbacks can't make things worse.

We used the following steps to recover the Mercurial repository (gate-hg) when the bridge got messed up from a failed rollback attempt:

  1. Edit sync_hg to disable the bridge. Remove the lock file.
  2. Create a child of gate-hg and the closed-source repo (gate-hg/usr/closed) to do the recovery in. This helps ensure that if you mess something up, you won't have to recreate the master repositories.
  3. Make a private copy of sync_hg.nopush and edit it to refer to the child repositories.
  4. Determine which putbacks are not reflected in the child repositories. Feed these (one at a time) to your modified sync_hg.nopush. (That is, invoke your script with the path to the per-putback metadata directory, for each putback.)
  5. We diffed the child repositories against /ws/onnv-gate, using some hacked-up scripts to handle the fact that /ws/onnv-gate has expanded SCCS keywords, but the Mercurial repositories do not. Contact Kupfer for details.
  6. su to the owner of gate-hg and push the changesets from your child to gate-hg. (And push to the closed-source repo if necessary).
  7. Do "hg update -C" in gate-hg and in the closed-source repo.
  8. Verify that there are no extra files in the working directory for gate-hg, gate-hg/usr/closed, or the repo on opensolaris.org. (Check with the Tonic team if you don't have an admin login on opensolaris.org.)
  9. Lock the Teamware ON gate (the ON gatekeeper does this).
  10. Make sure that no additional putbacks have come in since you ran your modified sync_hg.nopush. If there have, repeat the above steps (run your modified sync_hg.nopush, push to the master repositories, "hg update -C").
  11. Enable the bridge (edit sync_hg).
  12. Unlock the gate (the ON gatekeeper does this).

The next putback will push the queued-up changesets to the repo on opensolaris.org.

Don't forget to delete the child repositories that you created.

Personal tools