예제 #1
0
파일: stack.py 프로젝트: hborchardt/stgit
 def write(name, val, multiline=False):
     fn = os.path.join(self._compat_dir, name)
     fn = fsencode_utf8(fn)
     if val:
         utils.write_string(fn, val, multiline)
     elif os.path.isfile(fn):
         os.remove(fn)
예제 #2
0
파일: stack.py 프로젝트: snits/stgit
    def delete_patch(self, name, keep_log = False):
        """Deletes a patch
        """
        self.__patch_name_valid(name)
        patch = self.get_patch(name)

        if self.__patch_is_current(patch):
            self.pop_patch(name)
        elif self.patch_applied(name):
            raise StackException('Cannot remove an applied patch, "%s", '
                                 'which is not current' % name)
        elif name not in self.get_unapplied():
            raise StackException('Unknown patch "%s"' % name)

        # save the commit id to a trash file
        write_string(os.path.join(self.__trash_dir, name), patch.get_top())

        patch.delete(keep_log = keep_log)

        unapplied = self.get_unapplied()
        unapplied.remove(name)
        write_strings(self.__unapplied_file, unapplied)
예제 #3
0
    def delete_patch(self, name, keep_log=False):
        """Deletes a patch
        """
        self.__patch_name_valid(name)
        patch = self.get_patch(name)

        if self.__patch_is_current(patch):
            self.pop_patch(name)
        elif self.patch_applied(name):
            raise StackException('Cannot remove an applied patch, "%s", '
                                 'which is not current' % name)
        elif name not in self.get_unapplied():
            raise StackException('Unknown patch "%s"' % name)

        # save the commit id to a trash file
        write_string(os.path.join(self.__trash_dir, name), patch.get_top())

        patch.delete(keep_log=keep_log)

        unapplied = self.get_unapplied()
        unapplied.remove(name)
        write_strings(self.__unapplied_file, unapplied)
예제 #4
0
파일: stack.py 프로젝트: snits/stgit
 def _set_field(self, name, value, multiline = False):
     fname = os.path.join(self.__dir, name)
     if value and value != '':
         write_string(fname, value, multiline)
     elif os.path.isfile(fname):
         os.remove(fname)
예제 #5
0
 def _set_field(self, name, value, multiline=False):
     fname = os.path.join(self.__dir, name)
     if value and value != '':
         write_string(fname, value, multiline)
     elif os.path.isfile(fname):
         os.remove(fname)
예제 #6
0
파일: stack.py 프로젝트: snits/stgit
 def write(name, val, multiline = False):
     fn = os.path.join(self.__compat_dir, name)
     if val:
         utils.write_string(fn, val, multiline)
     elif os.path.isfile(fn):
         os.remove(fn)