Beispiel #1
0
    def rename(self, to_name):
        """Renames a series
        """
        to_stack = Series(to_name)

        if to_stack.is_initialised():
            raise StackException('"%s" already exists' % to_stack.get_name())

        patches = self.get_applied() + self.get_unapplied()

        git.rename_branch(self.get_name(), to_name)

        for patch in patches:
            git.rename_ref('refs/patches/%s/%s' % (self.get_name(), patch),
                           'refs/patches/%s/%s' % (to_name, patch))
            git.rename_ref('refs/patches/%s/%s.log' % (self.get_name(), patch),
                           'refs/patches/%s/%s.log' % (to_name, patch))
        if os.path.isdir(self._dir()):
            rename(os.path.join(self._basedir(), 'patches'),
                   self.get_name(), to_stack.get_name())

        # Rename the config section
        for k in ['branch.%s', 'branch.%s.stgit']:
            config.rename_section(k % self.get_name(), k % to_name)

        self.__init__(to_name)
Beispiel #2
0
    def rename(self, to_name):
        """Renames a series
        """
        to_stack = Series(to_name)

        if to_stack.is_initialised():
            raise StackException('"%s" already exists' % to_stack.get_name())

        patches = self.get_applied() + self.get_unapplied()

        git.rename_branch(self.get_name(), to_name)

        for patch in patches:
            git.rename_ref('refs/patches/%s/%s' % (self.get_name(), patch),
                           'refs/patches/%s/%s' % (to_name, patch))
            git.rename_ref('refs/patches/%s/%s.log' % (self.get_name(), patch),
                           'refs/patches/%s/%s.log' % (to_name, patch))
        if os.path.isdir(self._dir()):
            rename(os.path.join(self._basedir(), 'patches'),
                   self.get_name(), to_stack.get_name())

        # Rename the config section
        for k in ['branch.%s', 'branch.%s.stgit']:
            config.rename_section(k % self.get_name(), k % to_name)

        self.__init__(to_name)
Beispiel #3
0
    def rename(self, to_name):
        """Renames a series
        """
        to_stack = Series(to_name)

        if to_stack.is_initialised():
            raise StackException, '"%s" already exists' % to_stack.get_name()

        git.rename_branch(self.get_name(), to_name)

        if os.path.isdir(self._dir()):
            rename(os.path.join(self._basedir(), 'patches'), self.get_name(),
                   to_stack.get_name())
        if os.path.exists(self.__refs_dir):
            rename(os.path.join(self._basedir(), 'refs', 'patches'),
                   self.get_name(), to_stack.get_name())

        # Rename the config section
        config.rename_section("branch.%s" % self.get_name(),
                              "branch.%s" % to_name)

        self.__init__(to_name)