<commit_before>package main

import (
	"errors"
	"log"

	"github.com/fd0/khepri"
)

func commandRestore(repo *khepri.Repository, args []string) error {
	if len(args) != 2 {
		return errors.New("usage: restore ID dir")
	}

	id, err := khepri.ParseID(args[0])
	if err != nil {
		errx(1, "invalid id %q: %v", args[0], err)
	}

	target := args[1]

	sn, err := khepri.LoadSnapshot(repo, id)
	if err != nil {
		log.Fatalf("error loading snapshot %s", id)
	}

	err = sn.RestoreAt(target)
	if err != nil {
		log.Fatalf("error restoring snapshot %s", id)
	}

	log.Printf("%q restored to %q\n", id, target)

	return nil
}<commit_msg>Add error to messages<commit_after>package main

import (
	"errors"
	"log"

	"github.com/fd0/khepri"
)

func commandRestore(repo *khepri.Repository, args []string) error {
	if len(args) != 2 {
		return errors.New("usage: restore ID dir")
	}

	id, err := khepri.ParseID(args[0])
	if err != nil {
		errx(1, "invalid id %q: %v", args[0], err)
	}

	target := args[1]

	sn, err := khepri.LoadSnapshot(repo, id)
	if err != nil {
		log.Fatalf("error loading snapshot %s: %v", id, err)
	}

	err = sn.RestoreAt(target)
	if err != nil {
		log.Fatalf("error restoring snapshot %s: %v", id, err)
	}

	log.Printf("%q restored to %q\n", id, target)

	return nil
}
{'fraction_non_alphanumeric': 0.17138364779874213, 'fraction_numerical': 0.009433962264150943, 'mean_word_length': 3.75, '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': '3068436', 'n_tokens_mistral': 538, 'n_tokens_neox': 508, 'n_words': 137}