Script for automated pull+merge

Greg Ward greg at gerg.ca
Fri Apr 9 10:16:50 CDT 2010


Hi all --

I'm about to sit down and start writing a script to do automated
pull+merge from "higher" to "lower" repositories.  We have a
multi-level workflow where developers regularly push to "team" repos,
and then above the team repos is a "master" repo used for production
builds.  In order for teams to see each other's work, we need to pull
from "master" down to each team repo regularly.  Right now that's done
manually, and we need to automate it.

So... before I get started, I thought I should ask if anyone else has
already written a production-quality, well-tested script for
unattended pull+merge.  Google did not turn up anything.  I think the
algorithm is along these lines:

  let R1 = "upper" (source) repo
  let R2 = "lower" (target) repo
  check that no branches in R1 have multiple heads
  check that no branches in R2 have multiple heads

  pull from R1 to R2
  if any branches in R2 have multiple heads:
      get a working copy of R2 (clone? share? not sure yet)
      for each branch with multiple heads:
          update to branch head with lower revnum
          merge with internal:fail
          if merge failed:
              abort: need file-level merges, so this has to be done by a human
          commit
      push to the real R2 (assuming we cloned rather than shared)

Thanks --

Greg


More information about the Mercurial mailing list