On Wed, 2009-03-11 at 10:07 -0400, Chris Lumens wrote: > > + log.debug("action '%s' (%s)" % (a, id(a))) > > + destroys = self.findActions(path=a.device.path, > > + type="destroy", > > + object="device") > > + > > + creates = self.findActions(path=a.device.path, > > + type="create", > > + object="device") > > + > > + # If the device is not preexisting, we remove all actions up > > + # to and including the last destroy action. > > + # If the device is preexisting, we remove all actions from > > + # after the first destroy action up to and including the last > > + # destroy action. > > + loops = [] > > + first_destroy_idx = None > > + first_create_idx = None > > + stop_action = None > > + start = None > > + if len(destroys) > 1: > > + # there are multiple destroy actions for this device > > + loops = destroys > > + first_destroy_idx = self._actions.index(loops[0]) > > + start = self._actions.index(a) + 1 > > + stop_action = destroys[-1] > > + > > + if creates: > > + first_create_idx = self._actions.index(creates[0]) > > + if not loops or first_destroy_idx > first_create_idx: > > + # this device is not preexisting > > + start = first_create_idx > > + stop_action = destroys[-1] > > + > > + if start is None: > > continue > > I see this block four times in the patch, though twice it's > destroys/creates, and twice it's creates/destroys. Any chance that > could be functionalized? Yes, there is some duplication. There are subtle differences between the create and destroy versions, but it could be made into a pair of functions for create and destroy. Dave > > - Chris > > _______________________________________________ > Anaconda-devel-list mailing list > Anaconda-devel-list@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/anaconda-devel-list _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list