In this paper we presents a martingale method for analysing queues of M/G/1 type, which have been generalised so that the system passes through a series of phases on which the service behaviour may differ. The analysis uses the process embedded at departures to create a martingale, which makes possible the calculation of the probability generating function of the stationary occupancy distribution. Specific examples are given, for instance, a model of an unreliable queueing system, and an example of a queue-length-threshold overload-control system.