+ # Save this update so that we can run it a little later.
+ self.__conflicting_push = update
+ self.__halt("%d merge conflict(s)" % len(self.__conflicts))
+ else:
+ # Update immediately.
+ update()
+
+ def reorder_patches(self, applied, unapplied, hidden, iw = None):
+ """Push and pop patches to attain the given ordering."""
+ common = len(list(it.takewhile(lambda (a, b): a == b,
+ zip(self.applied, applied))))
+ to_pop = set(self.applied[common:])
+ self.pop_patches(lambda pn: pn in to_pop)
+ for pn in applied[common:]:
+ self.push_patch(pn, iw)
+ assert self.applied == applied
+ assert set(self.unapplied + self.hidden) == set(unapplied + hidden)
+ self.unapplied = unapplied
+ self.hidden = hidden