def initialise(cls, repository, name=None, switch_to=False): """Initialise a Git branch to handle patch series. @param repository: The L{Repository} where the L{Stack} will be created @param name: The name of the L{Stack} """ if not name: name = repository.current_branch_name # make sure that the corresponding Git branch exists branch = Branch(repository, name) dir = os.path.join(repository.directory, cls._repo_subdir, name) if os.path.exists(dir): raise StackException('%s: branch already initialized' % name) if switch_to: branch.switch_to() # create the stack directory and files utils.create_dirs(dir) compat_dir = os.path.join(dir, 'patches') utils.create_dirs(compat_dir) PatchOrder.create(dir) config.set(stackupgrade.format_version_key(name), str(stackupgrade.FORMAT_VERSION)) return repository.get_stack(name)
def initialise(cls, repository, name=None, msg='initialise', switch_to=False): """Initialise a Git branch to handle patch series. @param repository: The L{Repository} where the L{Stack} will be created @param name: The name of the L{Stack} """ if not name: name = repository.current_branch_name # make sure that the corresponding Git branch exists branch = Branch(repository, name) stack_state_ref = _stack_state_ref(name) if repository.refs.exists(stack_state_ref): raise StackException('%s: stack already initialized' % name) dir = os.path.join(repository.directory, cls._repo_subdir, name) if os.path.exists(dir): raise StackException('%s: branch already initialized' % name) if switch_to: branch.switch_to() # create the stack directory and files utils.create_dirs(dir) compat_dir = os.path.join(dir, 'patches') utils.create_dirs(compat_dir) PatchOrder.create(dir) config.set( stackupgrade.format_version_key(name), str(stackupgrade.FORMAT_VERSION) ) state_commit = log.StackState( repository, prev=None, head=branch.head, applied=[], unapplied=[], hidden=[], patches={}, message=msg, ).commit_state() repository.refs.set(stack_state_ref, state_commit, msg) return repository.get_stack(name)
def initialise(cls, repository, name = None): """Initialise a Git branch to handle patch series. @param repository: The L{Repository} where the L{Stack} will be created @param name: The name of the L{Stack} """ if not name: name = repository.current_branch_name # make sure that the corresponding Git branch exists git.Branch(repository, name) dir = os.path.join(repository.directory, cls.__repo_subdir, name) compat_dir = os.path.join(dir, 'patches') if os.path.exists(dir): raise StackException('%s: branch already initialized' % name) # create the stack directory and files utils.create_dirs(dir) utils.create_dirs(compat_dir) PatchOrder.create(dir) config.set(stackupgrade.format_version_key(name), text(stackupgrade.FORMAT_VERSION)) return repository.get_stack(name)