Exemple #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)
Exemple #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)
Exemple #3
0
    def rename(self, newname):
        olddir = self._dir()
        old_top_ref = self.__top_ref
        old_log_ref = self.__log_ref
        self.__name = newname
        self._set_dir(os.path.join(self.__series_dir, self.__name))
        self.__init_refs()

        git.rename_ref(old_top_ref, self.__top_ref)
        if git.ref_exists(old_log_ref):
            git.rename_ref(old_log_ref, self.__log_ref)
        os.rename(olddir, self._dir())
Exemple #4
0
    def rename(self, newname):
        olddir = self._dir()
        old_top_ref = self.__top_ref
        old_log_ref = self.__log_ref
        self.__name = newname
        self._set_dir(os.path.join(self.__series_dir, self.__name))
        self.__init_refs()

        git.rename_ref(old_top_ref, self.__top_ref)
        if git.ref_exists(old_log_ref):
            git.rename_ref(old_log_ref, self.__log_ref)
        os.rename(olddir, self._dir())