From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Avoid top/bottom backup files identical to current ones. Simply remove
them.
Also, change restore_old_boundaries() to handle gracefully the new
situation rather than print an exception.
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
print 'Undoing the "%s" push...' % patch,
sys.stdout.flush()
resolved_all()
print 'Undoing the "%s" push...' % patch,
sys.stdout.flush()
resolved_all()
- crt_series.undo_push()
- print 'done'
+ if crt_series.undo_push():
+ print 'done'
+ else:
+ print 'done (patch unchanged)'
def set_bottom(self, string, backup = False):
if backup:
def set_bottom(self, string, backup = False):
if backup:
- self.__set_field('bottom.old', self.__get_field('bottom'))
+ curr = self.__get_field('bottom')
+ if curr != string:
+ self.__set_field('bottom.old', curr)
+ else:
+ self.__set_field('bottom.old', None)
self.__set_field('bottom', string)
def get_top(self):
self.__set_field('bottom', string)
def get_top(self):
def set_top(self, string, backup = False):
if backup:
def set_top(self, string, backup = False):
if backup:
- self.__set_field('top.old', self.__get_field('top'))
+ curr = self.__get_field('top')
+ if curr != string:
+ self.__set_field('top.old', curr)
+ else:
+ self.__set_field('top.old', None)
self.__set_field('top', string)
def restore_old_boundaries(self):
self.__set_field('top', string)
def restore_old_boundaries(self):
if top and bottom:
self.__set_field('bottom', bottom)
self.__set_field('top', top)
if top and bottom:
self.__set_field('bottom', bottom)
self.__set_field('top', top)
- raise StackException, 'No patch undo information'
def get_description(self):
return self.__get_field('description', True)
def get_description(self):
return self.__get_field('description', True)
patch = Patch(name, self.__patch_dir)
git.reset()
self.pop_patch(name)
patch = Patch(name, self.__patch_dir)
git.reset()
self.pop_patch(name)
- patch.restore_old_boundaries()
+ return patch.restore_old_boundaries()
def pop_patch(self, name):
"""Pops the top patch from the stack
def pop_patch(self, name):
"""Pops the top patch from the stack