+
+ def log_patch(self, patch, message):
+ """Generate a log commit for a patch
+ """
+ top = git.get_commit(patch.get_top())
+ msg = '%s\t%s' % (message, top.get_id_hash())
+
+ old_log = patch.get_log()
+ if old_log:
+ parents = [old_log]
+ else:
+ parents = []
+
+ log = git.commit(message = msg, parents = parents,
+ cache_update = False, tree_id = top.get_tree(),
+ allowempty = True)
+ patch.set_log(log)
+
+ def hide_patch(self, name):
+ """Add the patch to the hidden list.
+ """
+ if not self.patch_exists(name):
+ raise StackException, 'Unknown patch "%s"' % name
+ elif self.patch_hidden(name):
+ raise StackException, 'Patch "%s" already hidden' % name
+
+ append_string(self.__hidden_file, name)
+
+ def unhide_patch(self, name):
+ """Add the patch to the hidden list.
+ """
+ if not self.patch_exists(name):
+ raise StackException, 'Unknown patch "%s"' % name
+ hidden = self.get_hidden()
+ if not name in hidden:
+ raise StackException, 'Patch "%s" not hidden' % name
+
+ hidden.remove(name)
+
+ f = file(self.__hidden_file, 'w+')
+ f.writelines([line + '\n' for line in hidden])
+ f.close()