Skip to content
This repository was archived by the owner on Aug 24, 2024. It is now read-only.

Commit 19464cc

Browse files
committed
Vendor latest git-bug version
This adds the latest version of the necessary parts of git-bug (entity, identity, repository, util, bug) to the repo so they can be accessed later to read and write bugs.
0 parents  commit 19464cc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+7235
-0
lines changed

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Packages Needed:
2+
- Identity
3+
- Repository
4+
- Entity
5+
- Util
6+
7+
Methodology:
8+
This tool is designed to import a repository using an outdated version of git-bug and update it to be compatible with a
9+
newer version. This allows for breaking changes to git-bug without completely crashing the repositories of the user.
10+
11+
This tool will contain all versions of git-bug with breaking changes. It will make any necessary edits to the objects to
12+
convert them between the two versions. If the repository needs to jump between multiple versions, it will then complete
13+
the steps necessary to jump to the next version and so on until the target version is reached.
14+
15+
Sections:
16+
- Identity
17+
- OperationPack
18+
- Config
19+
20+
Todo for migration tool:
21+
- Remove legacy author and create new identity out of it -- forwards compatible
22+
- https://github.com/MichaelMure/git-bug-migration/migration1/pull/411: identity.Version need to store one time + Lamport time for each
23+
other Entity (Bug, config, PR ...) instead of a single one for Bug at the moment.
24+
- At the moment bridge credentials are stored in the global git config. In the future it could be stored in a real
25+
credential store. Migrating that would be nice.
26+
- AvatarURL in the identities reference an external images. Eventually storing all that in git itself would be nice.
27+
Migration would be downloading all that for offline use and rewriting those references.
28+
29+
Todo for git-bug:
30+
- Bump the OperationPack format version to 2 so that the legacy code can be removed. We don't need it to still be able
31+
to read the data, but when we remove the legacy code we need to be able to detect that we can't read that anymore.

go.mod

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module github.com/MichaelMure/git-bug-migration
2+
3+
go 1.14
4+
5+
require (
6+
github.com/blang/semver v3.5.1+incompatible
7+
github.com/dustin/go-humanize v1.0.0
8+
github.com/fatih/color v1.9.0
9+
github.com/pkg/errors v0.9.1
10+
github.com/stretchr/testify v1.6.1
11+
golang.org/x/text v0.3.3
12+
)

go.sum

Lines changed: 231 additions & 0 deletions
Large diffs are not rendered by default.

main.go

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"os"
6+
7+
"github.com/MichaelMure/git-bug-migration/migration1/bug"
8+
"github.com/MichaelMure/git-bug-migration/migration1/repository"
9+
)
10+
11+
const rootCommandName = "git-bug-migration"
12+
13+
var repo repository.ClockedRepo
14+
15+
func main() {
16+
cwd, err := os.Getwd()
17+
if err != nil {
18+
panic(fmt.Errorf("unable to get the current working directory: %q", err))
19+
}
20+
21+
repo, err = repository.NewGitRepo(cwd, []repository.ClockLoader{bug.ClockLoader})
22+
if err == repository.ErrNotARepo {
23+
panic(fmt.Errorf("%s must be run from within a git repo", rootCommandName))
24+
}
25+
26+
if err != nil {
27+
panic(err)
28+
}
29+
30+
for streamedBug := range bug.ReadAllLocalBugs(repo) {
31+
if streamedBug.Err != nil {
32+
fmt.Print(fmt.Errorf("Got error when reading bug: %q", err))
33+
continue
34+
}
35+
36+
//switch streamedBug.Bug
37+
fmt.Print(streamedBug.Bug.FirstOp().GetAuthor())
38+
}
39+
}

0 commit comments

Comments
 (0)