self.create_empty_field('bottom')
self.create_empty_field('top')
- def delete(self):
+ def delete(self, keep_log = False):
if os.path.isdir(self._dir()):
for f in os.listdir(self._dir()):
os.remove(os.path.join(self._dir(), f))
git.delete_ref(self.__top_ref)
except git.GitException, e:
out.warn(str(e))
- if git.ref_exists(self.__log_ref):
+ if not keep_log and git.ref_exists(self.__log_ref):
git.delete_ref(self.__log_ref)
def get_name(self):
raise StackException('Series directory %s is not empty'
% self._dir())
- try:
- git.delete_branch(self.get_name())
- except GitException:
- out.warn('Could not delete branch "%s"' % self.get_name())
+ try:
+ git.delete_branch(self.get_name())
+ except GitException:
+ out.warn('Could not delete branch "%s"' % self.get_name())
config.remove_section('branch.%s' % self.get_name())
config.remove_section('branch.%s.stgit' % self.get_name())
author_name = None, author_email = None,
author_date = None,
committer_name = None, committer_email = None,
- backup = False, sign_str = None, log = 'refresh',
+ backup = True, sign_str = None, log = 'refresh',
notes = None, bottom = None):
"""Generates a new commit for the topmost patch
"""
author_name = patch.get_authname()
if not author_email:
author_email = patch.get_authemail()
- if not author_date:
- author_date = patch.get_authdate()
if not committer_name:
committer_name = patch.get_commname()
if not committer_email:
return patch
- def delete_patch(self, name):
+ def delete_patch(self, name, keep_log = False):
"""Deletes a patch
"""
self.__patch_name_valid(name)
# save the commit id to a trash file
write_string(os.path.join(self.__trash_dir, name), patch.get_top())
- patch.delete()
+ patch.delete(keep_log = keep_log)
unapplied = self.get_unapplied()
unapplied.remove(name)