Skip to content

Latest commit

 

History

History
76 lines (69 loc) · 1.75 KB

README.md

File metadata and controls

76 lines (69 loc) · 1.75 KB

repocmp

Utility to find difference between two branches

Building

$ git clone https://github.com/fl0pp5/basealt-test-task.git
$ cd basealt-test-task
$ go build cmd/repocmp.go

Usage

$ ./repocmp -h
Usage: ./repocmp <option> [args]
Example: ./repocmp -b1 <branch-name> -fb2 <filename> -cache <file-prefix> -pretty
  -b1 value
        first branch name
  -b2 value
        second branch name
  -cache string
        save downloaded branches. Usage: [...] -cache <file-prefix> [...]
  -fb1 value
        first branch filename
  -fb2 value
        second branch filename
  -pretty
        enable formatting
  -split string
        split output by files. Usage: [...] -split <file-prefix> [...]

Examples

Print pretty to stdout

$ ./repocmp -b1 p10 -b2 p9 -pretty
{
    "unique_packages_1": {...}
    "unique_packages_2": {...}
    "newer_packages_from_1": {...}
}

With origin save

$ ./repocmp -b1 p10 -b2 p9 -cache myprefix > diff.json
$ ls
... diff.json  myprefix_branch1_963172800.json myprefix_branch2_963172800.json ...

With json file & save

$ ./repocmp -fb1 myprefix_branch1_963172800.json -b2 p9 -cache p9
{
    "unique_packages_1": {...}
    "unique_packages_2": {...}
    "newer_packages_from_1": {...}
}
$ ls
... p9_branch2_963173340 ...

Split output

$ ./repocmp -b1 p10 -b2 sisyphus -split p10_sisyphus
$ ls
... p10_sisyphus_newer_1668096715.json  p10_sisyphus_unique1_963173748.json  p10_sisyphus_unique2_963173748.json ...

Output schema

type BranchDiff struct {
	UniquePackages1    Branch `json:"unique_packages_1"`
	UniquePackages2    Branch `json:"unique_packages_2"`
	NewerPackagesFrom1 Branch `json:"newer_packages_from_1"`
}