<commit_before>package repo

import (
	"github.com/OpenBazaar/openbazaar-go/repo/migrations"
	"io/ioutil"
	"os"
	"path"
	"strconv"
)

type Migration interface {
	Up(repoPath string, dbPassword string, testnet bool) error
	Down(repoPath string, dbPassword string, testnet bool) error
}

var Migrations = []Migration{
	migrations.Migration000{},
	migrations.Migration001{},
	migrations.Migration002{},
	migrations.Migration003{},
	migrations.Migration004{},
	migrations.Migration005{},
	migrations.Migration006{},
	migrations.Migration007{},
	migrations.Migration008{},
	migrations.Migration009{},
	migrations.Migration010{},
}

// MigrateUp looks at the currently active migration version
// and will migrate all the way up (applying all up migrations).
func MigrateUp(repoPath, dbPassword string, testnet bool) error {
	version, err := ioutil.ReadFile(path.Join(repoPath, "repover"))
	if err != nil && !os.IsNotExist(err) {
		return err
	} else if err != nil && os.IsNotExist(err) {
		version = []byte("0")
	}
	v, err := strconv.Atoi(string(version))
	if err != nil {
		return err
	}
	x := v
	for _, m := range Migrations[v:] {
		log.Noticef("Migrating repo to version %d\n", x+1)
		err := m.Up(repoPath, dbPassword, testnet)
		if err != nil {
			log.Error(err)
			return err
		}
		x++
	}
	return nil
}
<commit_msg>Format repover string in migration<commit_after>package repo

import (
	"github.com/OpenBazaar/openbazaar-go/repo/migrations"
	"io/ioutil"
	"os"
	"path"
	"strconv"
	"strings"
)

type Migration interface {
	Up(repoPath string, dbPassword string, testnet bool) error
	Down(repoPath string, dbPassword string, testnet bool) error
}

var Migrations = []Migration{
	migrations.Migration000{},
	migrations.Migration001{},
	migrations.Migration002{},
	migrations.Migration003{},
	migrations.Migration004{},
	migrations.Migration005{},
	migrations.Migration006{},
	migrations.Migration007{},
	migrations.Migration008{},
	migrations.Migration009{},
	migrations.Migration010{},
}

// MigrateUp looks at the currently active migration version
// and will migrate all the way up (applying all up migrations).
func MigrateUp(repoPath, dbPassword string, testnet bool) error {
	version, err := ioutil.ReadFile(path.Join(repoPath, "repover"))
	if err != nil && !os.IsNotExist(err) {
		return err
	} else if err != nil && os.IsNotExist(err) {
		version = []byte("0")
	}
	if strings.Contains(string(version), "\n") {
		version = []byte(strings.Replace(string(version), "\n", "", -1))
	}
	v, err := strconv.Atoi(string(version))
	if err != nil {
		return err
	}
	x := v
	for _, m := range Migrations[v:] {
		log.Noticef("Migrating repo to version %d\n", x+1)
		err := m.Up(repoPath, dbPassword, testnet)
		if err != nil {
			log.Error(err)
			return err
		}
		x++
	}
	return nil
}

{'fraction_non_alphanumeric': 0.14038876889848811, 'fraction_numerical': 0.025557955363570913, 'mean_word_length': 4.591549295774648, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1256825', 'n_tokens_mistral': 1046, 'n_tokens_neox': 1014, 'n_words': 242}