diff --git a/.gitignore b/.gitignore index 3072fad..ee2a7eb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ .* !/.*ignore -/build/ +/target/ diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..58090ae --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,267 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "autocfg" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bstr" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" +dependencies = [ + "lazy_static", + "memchr", + "regex-automata", + "serde", +] + +[[package]] +name = "clap" +version = "3.0.0-beta.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "feff3878564edb93745d58cf63e17b63f24142506e7a20c87a5521ed7bfb1d63" +dependencies = [ + "bitflags", + "clap_derive", + "indexmap", + "lazy_static", + "os_str_bytes", + "textwrap", +] + +[[package]] +name = "clap_derive" +version = "3.0.0-beta.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b15c6b4f786ffb6192ffe65a36855bc1fc2444bcd0945ae16748dcd6ed7d0d3" +dependencies = [ + "heck", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "const_format" +version = "0.2.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22bc6cd49b0ec407b680c3e380182b6ac63b73991cb7602de350352fc309b614" +dependencies = [ + "const_format_proc_macros", +] + +[[package]] +name = "const_format_proc_macros" +version = "0.2.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef196d5d972878a48da7decb7686eded338b4858fbabeed513d63a7c98b2b82d" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "csv" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" +dependencies = [ + "bstr", + "csv-core", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "csv-core" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" +dependencies = [ + "memchr", +] + +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" + +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "indexmap" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" +dependencies = [ + "autocfg", + "hashbrown", +] + +[[package]] +name = "itoa" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "memchr" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" + +[[package]] +name = "os_str_bytes" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "addaa943333a514159c80c97ff4a93306530d965d27e139188283cd13e06a799" +dependencies = [ + "memchr", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43" +dependencies = [ + "unicode-xid", +] + +[[package]] +name = "quote" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" + +[[package]] +name = "ryu" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" + +[[package]] +name = "serde" +version = "1.0.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "stc" +version = "0.0.8" +dependencies = [ + "clap", + "const_format", + "csv", + "serde", +] + +[[package]] +name = "syn" +version = "1.0.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "textwrap" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80" + +[[package]] +name = "unicode-segmentation" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" + +[[package]] +name = "unicode-xid" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" + +[[package]] +name = "version_check" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..39c3a57 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "stc" +description = "[WIP] Easy stacking of dev branches in git repositories." +version = "0.0.8" +authors = ["Folke Behrens "] +edition = "2021" +repository = "https://github.com/cloneable/stc/" +license = "Apache-2.0" + +[dependencies] +const_format = "0.2.22" +serde = {version = "1.0.130", features = ["derive"]} +csv = "1.1.6" + +[dependencies.clap] +version = "3.0.0-beta.5" +default-features = false +features = ["std", "derive"] + +[profile.release] +lto = true +opt-level = 3 +codegen-units = 1 +panic = "abort" diff --git a/README.md b/README.md index 367841a..f61fb63 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# Stacker +# stc Easy git rebasing of stacked feature branches ## Audience -Stacker is recommended for a workflow where +stc is recommended for a workflow where * individual contributors work in the same repository, * commits are made to dev branches that are forked from the main or a topic branch, @@ -12,7 +12,7 @@ Stacker is recommended for a workflow where * contributors are expected to provide a clean commit history (without merges) for review. -Stacker helps with managing entire *stacks* of these dev branches, i.e. when +stc helps with managing entire *stacks* of these dev branches, i.e. when they are branched off of and depend on each other, allowing for a more rapid development. While one branch is undergoing review another branch can be stacked onto it and worked in. @@ -21,7 +21,7 @@ onto it and worked in. 1. Create a new branch. - `stacker start my-new-feature` + `stc start my-new-feature` 2. Do some work. @@ -30,15 +30,15 @@ onto it and worked in. 3. Meanwhile the base branch has merges from other contributors. Fetch everything. - `stacker sync` + `stc sync` 4. Rebase the branch, so it forks off at the head of the base branch. - `stacker rebase` + `stc rebase` 5. Publish the branch by pushing it the first time. - `stacker push` + `stc push` 6. Oh, there's a bad commit. @@ -47,83 +47,95 @@ onto it and worked in. 7. Now the local branch and the remote branch divert. Push again to (forcefully) set remote branch to what local branch points at. - `stacker push` + `stc push` ## Installation -Requires Go toolchain 1.17 or later. +Requires Rust toolchain to be installed. ```sh -go install github.com/cloneable/stacker@latest +cargo install stc ``` -Make sure `stacker` is in your $PATH. - ```sh -export PATH=$(go env GOPATH)/bin:$PATH +cargo install --git https://github.com/cloneable/stc ``` ## Usage -* `stacker init` checks and creates any stacker-related refs. -* `stacker clean` removes any stacker-related refs and settings. -* `stacker start ` starts new branch, marks it for remote tracking and - switches to it. -* `stacker push` pushes the current branch to remote and marks them for - tracking. -* `stacker rebase` rebases the current branch. -* `stacker sync` shortcut for `git fetch --all --prune`. +``` +stc 0.0.8 + +[WIP] Easy stacking of dev branches in git repositories. + +USAGE: + stc + +OPTIONS: + -h, --help Print help information + -V, --version Print version information + +SUBCOMMANDS: + clean Cleans any stc related refs and settings from repo. + fix Adds, updates and deletes tracking refs if needed. + help Print this message or the help of the given subcommand(s) + init Initializes the repo and tries to set stc refs for any non-default branches. + push Sets remote branch head to what local branch head points to. + rebase Rebases current branch on top of its base branch. + start Starts a new branch off of current branch. + sync Fetches all branches and tags and prunes deleted ones. +``` ## Under the Hood ### Tracking Refs -Stacker uses custom refs to track branches: +Stc uses custom refs to track branches: -* `refs/stacker/base/` +* `refs/stc/base/` A symref to the parent branch in the stack. Created when a branch is created. Only updated when a branch is moved within the stack. Deleted when either branch is deleted. -* `refs/stacker/start/` +* `refs/stc/start/` The commit where the branch starts. Created when a branch is created. Updated after a rebase. Deleted when the branch is deleted. -* `refs/stacker/remote/` +* `refs/stc/remote/` The commit where the remote branch head is expected to be. Created when a branch is pushed for the first time. Updated after a push. Deleted when the branch is deleted. -Stacker does not update/delete any refs outside `refs/stacker/`. +Stc does not update/delete any refs outside `refs/stc/`. ### Config -Stacker puts a few settings into `$REPO/.git/config`: +Stc puts a few settings into `$REPO/.git/config`: -* `log.excludeDecoration = refs/stacker/` +* `log.excludeDecoration = refs/stc/` To hide the trackings refs in `git log` output. -* `transfer.hideRefs = refs/stacker/` +* `transfer.hideRefs = refs/stc/` Probably over-paranoid. Just so there's no possibility these refs leave the local repo. -* `stacker.*` +* `stc.*` - Any stacker specific settings. + Any stc specific settings. -Stacker will only touch the repo's config. It's safe to make these settings in +Stc will only touch the repo's config. It's safe to make these settings in `--global` or `--system`. ### Git Commands -Stacker mainly uses two commands to manage branches: +Stc mainly uses two commands to manage branches: -* `git rebase --committer-date-is-author-date --onto refs/stacker/base/ refs/stacker/start/ ` +* `git rebase --committer-date-is-author-date --onto refs/stc/base/ refs/stc/start/ ` Rebases a branch onto its base branch starting at start marker. If there are conflict, rebasing will stop. Fix conflicts and use `--continue` or @@ -133,7 +145,7 @@ Stacker mainly uses two commands to manage branches: Pushes a branch to remote, potentially replacing the commit chain, so the remote branch looks exactly like the local branch. `` is - what `refs/stacker/remote/` points to. + what `refs/stc/remote/` points to. -In addition, Stacker uses a few more commands to help keeping track of things, +In addition, stc uses a few more commands to help keeping track of things, like `for-each-ref`, `update-ref`, `symbolic-ref`, `check-ref-format`. diff --git a/go.mod b/go.mod deleted file mode 100644 index d743bb8..0000000 --- a/go.mod +++ /dev/null @@ -1,10 +0,0 @@ -module github.com/cloneable/stacker - -go 1.17 - -require github.com/spf13/cobra v1.2.1 - -require ( - github.com/inconshreveable/mousetrap v1.0.0 // indirect - github.com/spf13/pflag v1.0.5 // indirect -) diff --git a/go.sum b/go.sum deleted file mode 100644 index 9290f91..0000000 --- a/go.sum +++ /dev/null @@ -1,566 +0,0 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= -cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= -cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= -cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= -cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= -github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= -github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= -github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= -github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= -github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= -github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= -github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v1.2.1 h1:+KmjbUw1hriSNMF55oPrkZcb27aECyrj8V2ytv7kWDw= -github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= -github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= -go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= -go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= -go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= -go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= -golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= -golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= -golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= -google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= -google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= -google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= -google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= -google.golang.org/api v0.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= -google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= -google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/internal/command/clean.go b/internal/command/clean.go deleted file mode 100644 index b03bd03..0000000 --- a/internal/command/clean.go +++ /dev/null @@ -1,19 +0,0 @@ -package command - -import ( - "github.com/spf13/cobra" -) - -func init() { - cleanCmd := &cobra.Command{ - Use: "clean", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - return stacker.Clean(cmd.Context()) - }, - DisableFlagsInUseLine: true, - - Short: "Cleans any stacker related refs and settings from repo.", - } - rootCmd.AddCommand(cleanCmd) -} diff --git a/internal/command/fix.go b/internal/command/fix.go deleted file mode 100644 index 3ce4482..0000000 --- a/internal/command/fix.go +++ /dev/null @@ -1,19 +0,0 @@ -package command - -import "github.com/spf13/cobra" - -func init() { - fixCmd := &cobra.Command{ - Use: "fix [ ]", - // TODO: re-enable validation, add completion - Args: cobra.RangeArgs(0, 2), // validBranchNames(stacker, 0, 2), - //ValidArgsFunction: nil, - RunE: func(cmd *cobra.Command, args []string) error { - return stacker.Fix(cmd.Context(), args...) - }, - DisableFlagsInUseLine: true, - - Short: "Adds, updates and deletes tracking refs if needed", - } - rootCmd.AddCommand(fixCmd) -} diff --git a/internal/command/init.go b/internal/command/init.go deleted file mode 100644 index 2f511ac..0000000 --- a/internal/command/init.go +++ /dev/null @@ -1,20 +0,0 @@ -package command - -import ( - "github.com/spf13/cobra" -) - -func init() { - initCmd := &cobra.Command{ - Use: "init", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - return stacker.Init(cmd.Context()) - }, - PersistentPreRunE: overrideRepoValidation, - DisableFlagsInUseLine: true, - - Short: "Initializes the repo and tries to set stacker refs for any non-default branches.", - } - rootCmd.AddCommand(initCmd) -} diff --git a/internal/command/push.go b/internal/command/push.go deleted file mode 100644 index cfba65f..0000000 --- a/internal/command/push.go +++ /dev/null @@ -1,17 +0,0 @@ -package command - -import ( - "github.com/spf13/cobra" -) - -func init() { - pushCmd := &cobra.Command{ - Use: "push", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - return stacker.Push(cmd.Context()) - }, - DisableFlagsInUseLine: true, - } - rootCmd.AddCommand(pushCmd) -} diff --git a/internal/command/rebase.go b/internal/command/rebase.go deleted file mode 100644 index 3d8000d..0000000 --- a/internal/command/rebase.go +++ /dev/null @@ -1,17 +0,0 @@ -package command - -import ( - "github.com/spf13/cobra" -) - -func init() { - rebaseCmd := &cobra.Command{ - Use: "rebase", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - return stacker.Rebase(cmd.Context()) - }, - DisableFlagsInUseLine: true, - } - rootCmd.AddCommand(rebaseCmd) -} diff --git a/internal/command/root.go b/internal/command/root.go deleted file mode 100644 index 9c98fcb..0000000 --- a/internal/command/root.go +++ /dev/null @@ -1,56 +0,0 @@ -package command - -import ( - "context" - "errors" - "os" - - stackerpkg "github.com/cloneable/stacker/internal/stacker" - "github.com/spf13/cobra" -) - -func overrideRepoValidation(*cobra.Command, []string) error { return nil } - -func validBranchNames(s *stackerpkg.Stacker, min, max int) cobra.PositionalArgs { - return func(cmd *cobra.Command, args []string) error { - if len(args) < min || len(args) > max { - return errors.New("invalid number of branch names") - } - if !s.ValidBranchNames(args...) { - return errors.New("invalid branch name") - } - return nil - } -} - -// TODO: fine a better way to init Stacker -func must(v string, err error) string { - if err != nil { - panic(err) - } - return v -} - -var ( - workdir = must(os.Getwd()) - stacker = stackerpkg.New(workdir) - - printCommandsFlag bool - - rootCmd = &cobra.Command{ - Use: "stacker ", - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - // TODO: do refs integrity checks - return nil - }, - DisableFlagsInUseLine: true, - } -) - -func init() { - rootCmd.PersistentFlags().BoolVarP(&printCommandsFlag, "print-commands", "x", false, "Print commands that are executed") -} - -func Execute(ctx context.Context) error { - return rootCmd.ExecuteContext(ctx) -} diff --git a/internal/command/start.go b/internal/command/start.go deleted file mode 100644 index ec082bf..0000000 --- a/internal/command/start.go +++ /dev/null @@ -1,19 +0,0 @@ -package command - -import ( - "github.com/spf13/cobra" -) - -func init() { - startCmd := &cobra.Command{ - Use: "start ", - Args: validBranchNames(stacker, 1, 1), - RunE: func(cmd *cobra.Command, args []string) error { - return stacker.Start(cmd.Context(), args[0]) - }, - DisableFlagsInUseLine: true, - - Short: "Starts a new branch off of current branch.", - } - rootCmd.AddCommand(startCmd) -} diff --git a/internal/command/sync.go b/internal/command/sync.go deleted file mode 100644 index 8b3f573..0000000 --- a/internal/command/sync.go +++ /dev/null @@ -1,17 +0,0 @@ -package command - -import ( - "github.com/spf13/cobra" -) - -func init() { - syncCmd := &cobra.Command{ - Use: "sync", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - return stacker.Sync(cmd.Context()) - }, - DisableFlagsInUseLine: true, - } - rootCmd.AddCommand(syncCmd) -} diff --git a/internal/git/git.go b/internal/git/git.go deleted file mode 100644 index 5c90878..0000000 --- a/internal/git/git.go +++ /dev/null @@ -1,209 +0,0 @@ -package git - -import ( - "bufio" - "bytes" - "encoding/json" - "fmt" - "regexp" - "strings" -) - -type Result struct { - Args []string - Stdout bytes.Buffer - Stderr bytes.Buffer - ExitCode int -} - -type Git interface { - Exec(args ...string) (Result, error) - DumpOutput() -} - -func SnapshotRepository(g Git) (Repository, error) { - res, err := g.Exec( - "for-each-ref", - "--format", - formatFields.formatFlagValue(), - ) - if err != nil { - return Repository{}, fmt.Errorf("cannot list refs: %w", err) - } - refs := make(map[RefName]Ref) - var hasHead bool - var head BranchName - scan := bufio.NewScanner(&res.Stdout) - for scan.Scan() { - var f fields - if err := json.Unmarshal(scan.Bytes(), &f); err != nil { - return Repository{}, fmt.Errorf("cannot read JSON output: %w", err) - } - if err := f.validate(); err != nil { - return Repository{}, fmt.Errorf("fields validation failed: %w", err) - } - r := f.ref() - if r.head { - if hasHead { - return Repository{}, fmt.Errorf("found a second HEAD: %v and %v", head, r.name) - } - if !strings.HasPrefix(r.name.String(), branchRefPrefix) { - return Repository{}, fmt.Errorf("found a non-branch HEAD: %v", r.name) - } - hasHead = true - head = BranchName(strings.TrimPrefix(r.name.String(), branchRefPrefix)) - } - refs[r.name] = r - } - return Repository{ - refs: refs, - head: head, - hasHead: hasHead, - }, nil -} - -type forEachRefField struct { - jsonValue string - re *regexp.Regexp -} - -type forEachRefSpec map[string]forEachRefField - -func (s forEachRefSpec) formatFlagValue() string { - if len(s) == 0 { - return "" - } - var buf strings.Builder - first := true - buf.WriteByte('{') - for name, spec := range s { - if first { - first = false - } else { - buf.WriteByte(',') - } - buf.WriteByte('"') - buf.WriteString(name) - buf.WriteByte('"') - buf.WriteByte(':') - buf.WriteString(spec.jsonValue) - } - buf.WriteByte('}') - return buf.String() -} - -type fields struct { - Head bool `json:"head"` - ObjectName string `json:"objectname"` - RefName string `json:"refname"` - ObjectType RefType `json:"objecttype"` - Track string `json:"track"` - Remote string `json:"remote"` - RemoteRef string `json:"remoteref"` - SymRef string `json:"symref"` - Upstream string `json:"upstream"` -} - -func (f fields) String() string { - var buf strings.Builder - enc := json.NewEncoder(&buf) - enc.SetEscapeHTML(false) - enc.SetIndent("", "") - if err := enc.Encode(f); err != nil { - panic(err) - } - return buf.String() -} - -var formatFields = forEachRefSpec{ - "head": { - `%(if)%(HEAD)%(then)true%(else)false%(end)`, - regexp.MustCompile("^(?:true|false)?$"), - }, - "objectname": { - `"%(objectname)"`, - regexp.MustCompile("^[a-fA-F0-9]{40}$"), - }, - "refname": { - `"%(refname)"`, - regexp.MustCompile("^refs/.+$"), - }, - "objecttype": { - `"%(objecttype)"`, - regexp.MustCompile("^(?:commit|blob|tree|tag)$"), - }, - "track": { - `"%(upstream:trackshort)"`, - regexp.MustCompile("^(?:=|>|<|<>)?$"), - }, - "remote": { - `"%(upstream:remotename)"`, - regexp.MustCompile("^[^/]*$"), - }, - "remoteref": { - `"%(upstream:remoteref)"`, - regexp.MustCompile("^(?:|refs/.+)$"), - }, - "symref": { - `"%(symref)"`, - regexp.MustCompile("^(?:|refs/.+)$"), - }, - "upstream": { - `"%(upstream)"`, - regexp.MustCompile("^(?:|refs/remotes/.+)$"), - }, -} - -func (f fields) ref() Ref { - return Ref{ - name: RefName(f.RefName), - typ: f.ObjectType, - objectName: ObjectName(f.ObjectName), - head: f.Head, - symRefTarget: RefName(f.SymRef), - remote: RemoteName(f.Remote), - remoteRef: RefName(f.RemoteRef), - upstreamRef: RefName(f.Upstream), - } -} - -func (s forEachRefSpec) validate(name, value string) error { - if !s[name].re.MatchString(value) { - return fmt.Errorf("%s does not match pattern %v: %q", name, s[name].re.String(), value) - } - return nil -} - -func (f fields) validate() error { - // if err := formatFields.validate("head", f.Head); err != nil { - // return err - // } - if err := formatFields.validate("objectname", f.ObjectName); err != nil { - return err - } - if err := formatFields.validate("objectname", f.ObjectName); err != nil { - return err - } - if err := formatFields.validate("refname", f.RefName); err != nil { - return err - } - // if err := formatFields.validate("objecttype", f.ObjectType); err != nil { - // return err - // } - if err := formatFields.validate("track", f.Track); err != nil { - return err - } - if err := formatFields.validate("remote", f.Remote); err != nil { - return err - } - if err := formatFields.validate("remoteref", f.RemoteRef); err != nil { - return err - } - if err := formatFields.validate("symref", f.SymRef); err != nil { - return err - } - if err := formatFields.validate("upstream", f.Upstream); err != nil { - return err - } - return nil -} diff --git a/internal/git/git_test.go b/internal/git/git_test.go deleted file mode 100644 index ff240c3..0000000 --- a/internal/git/git_test.go +++ /dev/null @@ -1,103 +0,0 @@ -package git - -import ( - "bytes" - "fmt" - "testing" -) - -type fakeGit struct { - exitCode int - stdout string - stderr string - err error -} - -func (g *fakeGit) Exec(args ...string) (Result, error) { - return Result{ - Args: args, - ExitCode: g.exitCode, - Stdout: *bytes.NewBufferString(g.stdout), - Stderr: *bytes.NewBufferString(g.stderr), - }, g.err -} - -func (g *fakeGit) DumpOutput() {} - -func TestSnapshotRepository(t *testing.T) { - t.Parallel() - - g := &fakeGit{ - stdout: fields{ - Head: true, - ObjectName: "dabfcd577644ee74ad10e150720c29130e8dc5ea", - RefName: "refs/heads/main", - ObjectType: TypeCommit, - Track: "=", - Remote: "origin", - RemoteRef: "refs/heads/main", - SymRef: "", - Upstream: "refs/remotes/origin/main", - }.String(), - } - repo, err := SnapshotRepository(g) - if err != nil { - t.Fatal(err) - } - assertRepository(t, repo, Repository{ - refs: map[RefName]Ref{ - "refs/heads/main": { - name: "refs/heads/main", - typ: TypeCommit, - objectName: "dabfcd577644ee74ad10e150720c29130e8dc5ea", - head: true, - symRefTarget: "", - remote: "origin", - remoteRef: "refs/heads/main", - upstreamRef: "refs/remotes/origin/main", - }, - }, - }) -} - -func assertRepository(t *testing.T, actual, expected Repository) { - t.Helper() - if got, want := len(actual.refs), len(expected.refs); got != want { - t.Errorf(`len(refs) = %d, want %d`, got, want) - return - } - for name := range expected.refs { - t.Run(fmt.Sprintf("ref: %q", name), func(t *testing.T) { - t.Helper() - assertRef(t, actual.refs[name], expected.refs[name]) - }) - } -} - -func assertRef(t *testing.T, actual, expected Ref) { - t.Helper() - if got, want := actual.name, expected.name; got != want { - t.Errorf(`name = %q, want %q`, got, want) - } - if got, want := actual.typ, expected.typ; got != want { - t.Errorf(`typ = %v, want %v`, got, want) - } - if got, want := actual.objectName, expected.objectName; got != want { - t.Errorf(`objectName = %q, want %q`, got, want) - } - if got, want := actual.head, expected.head; got != want { - t.Errorf(`head = %t, want %t`, got, want) - } - if got, want := actual.symRefTarget, expected.symRefTarget; got != want { - t.Errorf(`symRefTarget = %q, want %q`, got, want) - } - if got, want := actual.remote, expected.remote; got != want { - t.Errorf(`remote = %q, want %q`, got, want) - } - if got, want := actual.remoteRef, expected.remoteRef; got != want { - t.Errorf(`remoteRef = %q, want %q`, got, want) - } - if got, want := actual.upstreamRef, expected.upstreamRef; got != want { - t.Errorf(`upstreamRef = %q, want %q`, got, want) - } -} diff --git a/internal/git/repo.go b/internal/git/repo.go deleted file mode 100644 index b427b3e..0000000 --- a/internal/git/repo.go +++ /dev/null @@ -1,150 +0,0 @@ -package git - -import ( - "encoding" - "fmt" - "sort" - "strings" -) - -const ( - StackerRefPrefix = "refs/stacker/" - StackerBaseRefPrefix = StackerRefPrefix + "base/" - StackerStartRefPrefix = StackerRefPrefix + "start/" - StackerRemoteRefPrefix = StackerRefPrefix + "remote/" - - branchRefPrefix = "refs/heads/" - tagRefPrefix = "refs/tags/" -) - -type Repository struct { - refs map[RefName]Ref - head BranchName - hasHead bool -} - -func (r Repository) Head() (BranchName, bool) { return r.head, r.head != "" } -func (r Repository) AllRefs() []Ref { - refs := make([]Ref, 0, len(r.refs)) - for _, ref := range r.refs { - refs = append(refs, ref) - } - sort.Slice(refs, func(i, j int) bool { return refs[i].name < refs[j].name }) - return refs -} -func (r Repository) LookupRef(name RefName) (ref Ref, ok bool) { ref, ok = r.refs[name]; return } -func (r Repository) LookupBranch(name string) (BranchName, bool) { - n := BranchName(name) - _, ok := r.refs[n.RefName()] - if !ok { - return "", false - } - return n, true -} - -type RefType int - -const ( - _ RefType = iota - - TypeCommit - TypeTree - TypeBlob - TypeTag -) - -var _ (encoding.TextUnmarshaler) = (*RefType)(nil) -var _ (encoding.TextMarshaler) = (*RefType)(nil) - -func (t *RefType) UnmarshalText(text []byte) error { - switch string(text) { - case "commit": - *t = TypeCommit - case "tree": - *t = TypeTree - case "blob": - *t = TypeBlob - case "tag": - *t = TypeTag - default: - return fmt.Errorf("unknown ref type: %s", text) - } - return nil -} - -func (t RefType) MarshalText() ([]byte, error) { - switch t { - case TypeCommit: - return []byte("commit"), nil - case TypeTree: - return []byte("tree"), nil - case TypeBlob: - return []byte("blob"), nil - case TypeTag: - return []byte("tag"), nil - default: - return nil, fmt.Errorf("unknown ref type: %d", t) - } -} - -type RefName string - -func ParseRefName(name string) (RefName, error) { - if !strings.HasPrefix(name, "refs/") { - return "", fmt.Errorf("invalid ref name: %q", name) - } - return RefName(name), nil -} - -func (n RefName) String() string { assert(n != ""); return string(n) } -func (n RefName) BranchName() BranchName { - assert(n != "") - if idx := strings.LastIndexByte(string(n), '/'); idx >= 0 { - return BranchName(n[idx+1:]) - } - return BranchName(n) -} - -type ObjectName string - -const NonExistantObject ObjectName = "0000000000000000000000000000000000000000" - -func (n ObjectName) String() string { assert(n != ""); return string(n) } - -type Ref struct { - name RefName - typ RefType - objectName ObjectName - head bool - symRefTarget RefName - remote RemoteName - remoteRef RefName - upstreamRef RefName -} - -func (r Ref) Name() RefName { return r.name } -func (r Ref) ObjectName() ObjectName { return r.objectName } -func (r Ref) SymRefTarget() RefName { return r.symRefTarget } -func (r Ref) Remote() RemoteName { return r.remote } -func (r Ref) RemoteRefName() RefName { return r.remoteRef } -func (r Ref) UpstreamRef() RefName { return r.upstreamRef } -func (r Ref) Stacker() bool { return strings.HasPrefix(string(r.name), StackerRefPrefix) } - -type BranchName string - -func (n BranchName) String() string { assert(n != ""); return string(n) } - -func (n BranchName) RefName() RefName { return RefName(branchRefPrefix + n) } -func (n BranchName) StackerBaseRefName() RefName { return RefName(StackerBaseRefPrefix + n) } -func (n BranchName) StackerStartRefName() RefName { return RefName(StackerStartRefPrefix + n) } -func (n BranchName) StackerRemoteRefName() RefName { return RefName(StackerRemoteRefPrefix + n) } - -type RemoteName string - -func (n RemoteName) String() string { assert(n != ""); return string(n) } - -func assert(cond bool) { - if !cond { - panic("bad assumption") - } -} diff --git a/internal/git/repo_test.go b/internal/git/repo_test.go deleted file mode 100644 index d60033a..0000000 --- a/internal/git/repo_test.go +++ /dev/null @@ -1,9 +0,0 @@ -package git - -import "testing" - -func TestRefNameBranchName(t *testing.T) { - if got, want := RefName("refs/foo/bar/moo").BranchName(), BranchName("moo"); got != want { - t.Errorf(`RefName("refs/foo/bar/moo").BranchName() = %q, want %q`, got, want) - } -} diff --git a/internal/git/runner.go b/internal/git/runner.go deleted file mode 100644 index 0b8daf7..0000000 --- a/internal/git/runner.go +++ /dev/null @@ -1,120 +0,0 @@ -package git - -import ( - "fmt" - "io" - "os" - "os/exec" - "strings" - "sync" -) - -type Runner struct { - WorkDir string - Env []string - PrintCommands bool - output output -} - -var _ Git = (*Runner)(nil) - -func (r *Runner) Exec(args ...string) (Result, error) { - c := exec.Command("git", args...) - res := Result{ - Args: c.Args, - } - c.Env = r.Env - c.Dir = r.WorkDir - c.Stdin = nil - c.Stdout = teeWriter{&res.Stdout, r.output.stdout()} - c.Stderr = teeWriter{&res.Stderr, r.output.stderr()} - - quotedArgs := make([]string, 0, len(args)) - for _, arg := range c.Args { - quotedArgs = append(quotedArgs, shellQuote(arg)) - } - cmdLine := strings.Join(quotedArgs, " ") - - fmt.Fprintf(r.output.stderr(), "\n### %s\n", cmdLine) - - err := c.Run() - if exitErr, ok := err.(*exec.ExitError); ok { - res.ExitCode = exitErr.ExitCode() - } - - if err == nil { - fmt.Fprintf(os.Stderr, "[OK] %s\n", cmdLine) - fmt.Fprintf(r.output.stderr(), "### [OK]\n") - } else { - fmt.Fprintf(os.Stderr, "[err %d] %s: %v\n", res.ExitCode, cmdLine, err) - fmt.Fprintf(r.output.stderr(), "### [err %d]: %v\n", res.ExitCode, err) - } - - return res, err -} - -func (r *Runner) DumpOutput() { r.output.dump() } - -type teeWriter struct { - a, b io.Writer -} - -func (w teeWriter) Write(p []byte) (n int, err error) { - aN, aErr := w.a.Write(p) - if aErr != nil { - return aN, aErr - } - bN, bErr := w.b.Write(p) - if bErr != nil { - return bN, bErr - } - return bN, nil -} - -type output struct { - mu sync.Mutex - writes []write -} - -func (o *output) appendWrite(tag int, buf []byte) (n int, err error) { - o.mu.Lock() - defer o.mu.Unlock() - data := make([]byte, len(buf)) - copy(data, buf) - o.writes = append(o.writes, write{tag: tag, data: data}) - return len(data), nil -} - -type write struct { - tag int - data []byte -} - -func (o *output) stdout() io.Writer { - return writerFunc(func(p []byte) (n int, err error) { - return o.appendWrite(1, p) - }) -} - -func (o *output) stderr() io.Writer { - return writerFunc(func(p []byte) (n int, err error) { - return o.appendWrite(2, p) - }) -} - -func (o *output) dump() { - o.mu.Lock() - defer o.mu.Unlock() - for _, w := range o.writes { - switch w.tag { - case 1: - os.Stdout.Write(w.data) - case 2: - os.Stderr.Write(w.data) - } - } -} - -type writerFunc func(p []byte) (n int, err error) - -func (f writerFunc) Write(p []byte) (n int, err error) { return f(p) } diff --git a/internal/git/shell.go b/internal/git/shell.go deleted file mode 100644 index 967b27f..0000000 --- a/internal/git/shell.go +++ /dev/null @@ -1,66 +0,0 @@ -package git - -import ( - "regexp" - "strings" -) - -func shellQuote(s string) string { - switch { - case s == "": - return "''" - case safeRE.MatchString(s): - return s - case strings.IndexByte(s, '\'') == -1: - return "'" + s + "'" - default: - var buf strings.Builder - buf.WriteByte('"') - for _, b := range []byte(s) { - switch { - case b < 0x20 || b >= 0x7F: - buf.WriteByte('\\') - buf.WriteByte('x') - buf.WriteByte(hexChars[(b>>4)&0xF]) - buf.WriteByte(hexChars[b&0xF]) - case charBits[b]&bitEscape != 0: - buf.WriteByte('\\') - buf.WriteByte(b) - default: - buf.WriteByte(b) - } - } - buf.WriteByte('"') - return buf.String() - } -} - -const ( - safeChars = "-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/.@_+=%^:" - escapableChars = "$\"\\`" -) - -var ( - // TODO: find all safe characters - safeRE = regexp.MustCompile("^[" + safeChars + "]+$") - - charBits [256]charBit - - hexChars = [16]byte{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'} -) - -type charBit int - -const ( - bitSafe charBit = 1 << iota - bitEscape -) - -func init() { - for _, c := range safeChars { - charBits[c] |= bitSafe - } - for _, c := range []byte{'$', '"', '\\', '`', '!'} { - charBits[c] |= bitEscape - } -} diff --git a/internal/git/shell_test.go b/internal/git/shell_test.go deleted file mode 100644 index 684b528..0000000 --- a/internal/git/shell_test.go +++ /dev/null @@ -1,45 +0,0 @@ -package git - -import ( - "strconv" - "testing" -) - -func TestShellQuote(t *testing.T) { - t.Parallel() - for i, testcase := range []struct { - input string - want string - }{{ - input: "-a-b-c-", - want: "-a-b-c-", - }, { - input: "", - want: "''", - }, { - input: " ", - want: "' '", - }, { - input: " space ", - want: "' space '", - }, { - input: "abc@123", - want: "abc@123", - }, { - input: "abc$123", - want: "'abc$123'", - }, { - input: "abc'123", - want: `"abc'123"`, - }, { - input: "\n'NL' $X \n", - want: `"\x0a'NL' \$X \x0a"`, - }} { - t.Run(strconv.Itoa(i), func(t *testing.T) { - t.Helper() - if got := shellQuote(testcase.input); got != testcase.want { - t.Errorf("shellQuote(%q) = %q; want %q", testcase.input, got, testcase.want) - } - }) - } -} diff --git a/internal/stacker/operation.go b/internal/stacker/operation.go deleted file mode 100644 index ed42424..0000000 --- a/internal/stacker/operation.go +++ /dev/null @@ -1,361 +0,0 @@ -package stacker - -import ( - "fmt" - "sort" - "strings" - - "github.com/cloneable/stacker/internal/git" -) - -type operation struct { - git git.Git - repo git.Repository - - err error -} - -func op(git git.Git) *operation { - return &operation{ - git: git, - } -} - -func (o *operation) Failf(s string, args ...interface{}) error { - o.err = fmt.Errorf(s, args...) - return o.err -} - -func (o *operation) Err() error { - if o != nil && o.err != nil { - o.git.DumpOutput() - return o.err - } - return nil -} - -func (o *operation) snapshot() { - if o == nil || o.err != nil { - return - } - repo, err := git.SnapshotRepository(o.git) - if err != nil { - o.err = fmt.Errorf("snapshot: %w", err) - return - } - o.repo = repo -} - -func (o *operation) head() git.BranchName { - if o == nil || o.err != nil { - return "" - } - head, ok := o.repo.Head() - if !ok { - o.err = fmt.Errorf("HEAD is unset") - return "" - } - return head -} - -func (o *operation) hasRef(name git.RefName) bool { - if o == nil || o.err != nil { - return false - } - _, found := o.repo.LookupRef(name) - return found -} - -func (o *operation) ref(name git.RefName) git.Ref { - if o == nil || o.err != nil { - return git.Ref{} - } - ref, ok := o.repo.LookupRef(name) - if !ok { - o.err = fmt.Errorf("ref %s not found", name) - return git.Ref{} - } - return ref -} - -func (o *operation) branch(name string) git.BranchName { - if o == nil || o.err != nil { - return "" - } - branchName, ok := o.repo.LookupBranch(name) - if !ok { - o.err = fmt.Errorf("ref %s not found", name) - return "" - } - return branchName -} - -func (o *operation) parseBranchName(name string) git.BranchName { - if o == nil || o.err != nil { - return "" - } - _, err := o.git.Exec( - "check-ref-format", - "--branch", - name, - ) - if err != nil { - o.err = fmt.Errorf("parseBranchName: %w", err) - return "" - } - return git.BranchName(name) -} - -func (o *operation) createBranch(name, base git.BranchName) { - if o == nil || o.err != nil { - return - } - _, err := o.git.Exec( - "branch", - "--create-reflog", - name.String(), - base.String(), - ) - if err != nil { - o.err = fmt.Errorf("createBranch: %w", err) - return - } -} - -func (o *operation) switchBranch(b git.BranchName) { - if o == nil || o.err != nil { - return - } - _, err := o.git.Exec( - "switch", - "--no-guess", - b.String(), - ) - if err != nil { - o.err = fmt.Errorf("switchBranch: %w", err) - return - } -} - -func (o *operation) createSymref(name, target git.RefName, reason string) { - if o == nil || o.err != nil { - return - } - _, err := o.git.Exec( - "symbolic-ref", - "-m", - reason, - name.String(), - target.String(), - ) - if err != nil { - o.err = fmt.Errorf("createSymref: %w", err) - return - } -} - -func (o *operation) deleteSymref(name git.RefName) { - if o == nil || o.err != nil { - return - } - _, err := o.git.Exec( - "symbolic-ref", - "--delete", - name.String(), - ) - if err != nil { - o.err = fmt.Errorf("deleteSymref: %w", err) - return - } -} - -func (o *operation) createRef(name git.RefName, commit git.ObjectName) { - if o == nil || o.err != nil { - return - } - _, err := o.git.Exec( - "update-ref", - "--no-deref", - "--create-reflog", - name.String(), - commit.String(), - git.NonExistantObject.String(), - ) - if err != nil { - o.err = fmt.Errorf("createRef: %w", err) - return - } -} - -func (o *operation) updateRef(name git.RefName, newCommit, curCommit git.ObjectName) { - if o == nil || o.err != nil { - return - } - _, err := o.git.Exec( - "update-ref", - "--no-deref", - "--create-reflog", - name.String(), - newCommit.String(), - curCommit.String(), - ) - if err != nil { - o.err = fmt.Errorf("updateRef: %w", err) - return - } -} - -func (o *operation) deleteRef(name git.RefName, curCommit git.ObjectName) { - if o == nil || o.err != nil { - return - } - _, err := o.git.Exec( - "update-ref", - "--no-deref", - "-d", - name.String(), - curCommit.String(), - ) - if err != nil { - o.err = fmt.Errorf("deleteRef: %w", err) - return - } -} - -func (o *operation) rebaseOnto(name git.BranchName) { - if o == nil || o.err != nil { - return - } - _, err := o.git.Exec( - "rebase", - "--committer-date-is-author-date", - "--onto", - name.StackerBaseRefName().String(), - name.StackerStartRefName().String(), - name.String(), - ) - if err != nil { - o.err = fmt.Errorf("rebaseOnto: %w", err) - return - } -} - -func (o *operation) push(name git.BranchName, remote git.RemoteName, expect git.ObjectName) { - if o == nil || o.err != nil { - return - } - _, err := o.git.Exec( - "push", - "--set-upstream", - fmt.Sprintf("--force-with-lease=%s:%s", name, expect), - remote.String(), - fmt.Sprintf("%s:%s", name, name), - ) - if err != nil { - o.err = fmt.Errorf("push: %w", err) - return - } -} - -func (o *operation) configSet(key, value string) { - if o == nil || o.err != nil { - return - } - _, err := o.git.Exec( - "config", - "--local", - key, - value, - ) - if err != nil { - o.err = fmt.Errorf("configSet: %w", err) - return - } -} - -func (o *operation) configAdd(key, value string) { - if o == nil || o.err != nil { - return - } - _, err := o.git.Exec( - "config", - "--local", - "--add", - key, - value, - ) - if err != nil { - o.err = fmt.Errorf("configAdd: %w", err) - return - } -} - -func (o *operation) configUnsetPattern(key, pattern string) { - if o == nil || o.err != nil { - return - } - res, err := o.git.Exec( - "config", - "--local", - "--fixed-value", - "--unset-all", - key, - pattern, - ) - // 5 means the nothing matched. - if err != nil && res.ExitCode != 5 { - o.err = fmt.Errorf("configUnsetPattern: %w", err) - return - } -} - -func (o *operation) fetchAllPrune() { - if o == nil || o.err != nil { - return - } - _, err := o.git.Exec( - "fetch", - "--all", - "--prune", - ) - if err != nil { - o.err = fmt.Errorf("fetchAllPrune: %w", err) - return - } -} - -func (o *operation) trackedBranches() []git.BranchName { - if o == nil || o.err != nil { - return nil - } - branchMap := make(map[git.BranchName]bool) - for _, ref := range o.repo.AllRefs() { - if ref.Stacker() { - branchMap[ref.Name().BranchName()] = true - } - } - branches := make([]git.BranchName, 0, len(branchMap)) - for branch := range branchMap { - branches = append(branches, branch) - } - sort.Slice(branches, func(i, j int) bool { return branches[i] < branches[j] }) - return branches -} - -func (o *operation) forkpoint(base, branch git.RefName) git.ObjectName { - if o == nil || o.err != nil { - return "" - } - res, err := o.git.Exec( - "merge-base", - "--fork-point", - base.String(), - branch.String(), - ) - if err != nil { - o.err = fmt.Errorf("forkpoint: %w", err) - return "" - } - // TODO: handle not found - return git.ObjectName(strings.TrimSpace(res.Stdout.String())) -} diff --git a/internal/stacker/stacker.go b/internal/stacker/stacker.go deleted file mode 100644 index 2ccdea1..0000000 --- a/internal/stacker/stacker.go +++ /dev/null @@ -1,208 +0,0 @@ -package stacker - -import ( - "context" - "errors" - - "github.com/cloneable/stacker/internal/git" -) - -var errUnimplemented = errors.New("unimplemented") - -type Stacker struct { - git git.Git -} - -func New(repoPath string) *Stacker { - return &Stacker{ - git: &git.Runner{ - Env: nil, - WorkDir: repoPath, - PrintCommands: true, - }, - } -} - -func (s *Stacker) Init(ctx context.Context) error { - op := op(s.git) - op.configAdd("transfer.hideRefs", git.StackerRefPrefix) - op.configAdd("log.excludeDecoration", git.StackerRefPrefix) - - // TODO: read refs, branches, remotes - // TODO: validate stacker refs against branches - // TODO: determine list of needed refs - // TODO: print and create list of created refs - return op.Err() -} - -func (s *Stacker) Clean(ctx context.Context) error { - op := op(s.git) - op.configUnsetPattern("transfer.hideRefs", git.StackerRefPrefix) - op.configUnsetPattern("log.excludeDecoration", git.StackerRefPrefix) - // for _, ref := range op.listStackerRefs() { - // op.deleteRef(ref.Name(), ref.ObjectName()) - // } - // TODO: for each branch - // TODO: ... check if fully merged - // TODO: ... check if remote ref == local branch - // TODO: ... delete stacker refs - // TODO: ... or print warning - return op.Err() -} - -func (s *Stacker) Start(ctx context.Context, name string) error { - op := op(s.git) - op.snapshot() - baseB := op.head() - newName := op.parseBranchName(name) - op.createBranch(newName, baseB) - op.switchBranch(newName) - op.createSymref(newName.StackerBaseRefName(), baseB.RefName(), "stacker: base branch marker") - baseRef := op.ref(baseB.RefName()) - op.createRef(newName.StackerStartRefName(), baseRef.ObjectName()) - return op.Err() -} - -func (s *Stacker) Push(ctx context.Context) error { - op := op(s.git) - - var expectedCommit git.ObjectName - { - op.snapshot() - curB := op.head() - symRef := op.ref(curB.StackerBaseRefName()) - baseRef := op.ref(symRef.SymRefTarget()) - if op.hasRef(curB.StackerRemoteRefName()) { - expectedCommit = op.ref(curB.StackerRemoteRefName()).ObjectName() - } else { - expectedCommit = git.NonExistantObject - } - op.push(curB, baseRef.Remote(), expectedCommit) - } - { - op.snapshot() - curB := op.head() - curRef := op.ref(curB.RefName()) - op.updateRef(curB.StackerRemoteRefName(), curRef.ObjectName(), expectedCommit) - } - - // TODO: for each branch - // TODO: ... determine state (already pushed?) - // TODO: ... determine upstream - // TODO: ... push branch to remote - return op.Err() -} - -func (s *Stacker) Rebase(ctx context.Context) error { - op := op(s.git) - - // TODO: branches - - op.snapshot() - branch := op.head() - baseRef := op.ref(branch.StackerBaseRefName()) - startRef := op.ref(branch.StackerStartRefName()) - op.rebaseOnto(branch) - op.updateRef(branch.StackerStartRefName(), baseRef.ObjectName(), startRef.ObjectName()) - - // TODO: if len(branch) == 0 use current head as branch (head must be branch head) - // TODO: for each branch - // TODO: ... determine list of all stacked branches - // TODO: ... add unselected branches to list - // TODO: topologically sort selected branches - // TODO: for each selected branch - // TODO: ... call git rebase --onto - // TODO: ... update stacker ref - return op.Err() -} - -func (s *Stacker) Sync(ctx context.Context) error { - op := op(s.git) - op.fetchAllPrune() - - // TODO: fast-forward base branches that are not stacker branches. - // TODO: push all or selected ahead/rebased stacker branches. - - return op.Err() -} - -func (s *Stacker) Fix(ctx context.Context, branches ...string) error { - op := op(s.git) - - // TODO: this is hacky. refactor. - if len(branches) == 2 { - branch := op.parseBranchName(branches[0]) - baseBranch := op.parseBranchName(branches[1]) - if baseSymrefName := branch.StackerBaseRefName(); op.hasRef(baseSymrefName) { - baseSymref := op.ref(baseSymrefName) - if baseSymref.SymRefTarget() != baseBranch.RefName() { - return op.Failf("base branch already defined: %v", baseSymref.SymRefTarget()) - } - } else { - op.createSymref(branch.StackerBaseRefName(), baseBranch.RefName(), "stacker: set base branch") - } - if startRefName := branch.StackerStartRefName(); op.hasRef(startRefName) { - // TODO: check if base or ancestor of base - } else { - forkpoint := op.forkpoint(baseBranch.RefName(), branch.RefName()) - op.createRef(branch.StackerStartRefName(), forkpoint) - } - return nil - } else if len(branches) != 0 { - return op.Failf("invalid arguments: %v", branches) - } - - op.snapshot() - for _, branch := range op.trackedBranches() { - if !op.hasRef(branch.RefName()) { - if r := branch.StackerBaseRefName(); op.hasRef(r) { - op.deleteSymref(r) - } - if r := branch.StackerStartRefName(); op.hasRef(r) { - ref := op.ref(r) - op.deleteRef(r, ref.ObjectName()) - } - if r := branch.StackerRemoteRefName(); op.hasRef(r) { - ref := op.ref(r) - op.deleteRef(r, ref.ObjectName()) - } - } - } - - op.snapshot() - for _, branch := range op.trackedBranches() { - // for each existing branch that's somehow still being tracked: - baseSymrefName := branch.StackerBaseRefName() - startRefName := branch.StackerStartRefName() - if op.hasRef(baseSymrefName) { - // there's a base symref - if !op.hasRef(startRefName) { - // but no start ref - baseSymref := op.ref(branch.StackerBaseRefName()) - if !op.hasRef(baseSymref.SymRefTarget()) { - // TODO: base branch doesn't exist (anymore) - continue - } - // figure out forkpoint from what the base symref points to and the branch - // TODO: forkpoint can fail - forkpoint := op.forkpoint(baseSymref.SymRefTarget(), branch.RefName()) - // write the commit as start ref - op.createRef(branch.StackerStartRefName(), forkpoint) - } - } else { - // there's no base symref - if op.hasRef(startRefName) { - // but there's a start ref - // TODO: check for branch at that commit? consult reflog? - } - } - } - - // TODO: no /base/, but /start/ -> look for branch head at /start/, set /base/ - // TODO: no /start/, but /base/ -> use git merge-base to find fork point - // TODO: no /start/ nor /base/ -> do nothing, offer explicit way to track - // TODO: no /remote/, but remote branch exists? -> set ref, if ancestor, if not -> error - // TODO: no remote branch, but /remote/ -> delete ref (check origin?) - - return op.Err() -} diff --git a/internal/stacker/stacker_test.go b/internal/stacker/stacker_test.go deleted file mode 100644 index d83e638..0000000 --- a/internal/stacker/stacker_test.go +++ /dev/null @@ -1,331 +0,0 @@ -package stacker - -import ( - "bytes" - "context" - "os" - "os/exec" - "path" - "path/filepath" - "testing" - - "github.com/cloneable/stacker/internal/git" -) - -func newRepo(t *testing.T) string { - t.Helper() - - // tmpDir, err := os.MkdirTemp(os.TempDir(), "stacker-test-*") - // if err != nil { - // t.Fatalf("cannot create tmp dir: %v", err) - // } - tmpDir := t.TempDir() - - pathOrigin := filepath.Join(tmpDir, "test-origin.git") - git := exec.Command( - "git", - "init", - "--bare", - "--initial-branch=main", - pathOrigin, - ) - if err := git.Run(); err != nil { - t.Fatalf("cannot init origin repo: %v", err) - } - pathRepo := filepath.Join(tmpDir, "test-repo") - git = exec.Command( - "git", - "clone", - "--origin=origin", - pathOrigin, - pathRepo, - ) - if err := git.Run(); err != nil { - t.Fatalf("cannot clone origin repo: %v", err) - } - - return pathRepo -} - -var cmdEnv = []string{ - // Make commit reproducible. - "GIT_CONFIG_GLOBAL=/dev/null", - "GIT_CONFIG_SYSTEM=/dev/null", - "GIT_AUTHOR_NAME=tester", - "GIT_AUTHOR_EMAIL=tester@example.com", - "GIT_AUTHOR_DATE=1600000000 +0000", - "GIT_COMMITTER_NAME=tester", - "GIT_COMMITTER_EMAIL=tester@example.com", - "GIT_COMMITTER_DATE=1600000000 +0000", -} - -func cmd(t *testing.T, dir, name string, args ...string) string { - t.Helper() - stdout := bytes.Buffer{} - stderr := bytes.Buffer{} - c := exec.Command( - name, - args..., - ) - c.Env = cmdEnv - c.Dir = dir - c.Stdout = &stdout - c.Stderr = &stderr - if err := c.Run(); err != nil { - t.Log("STDOUT:\n", stdout.String()) - t.Log("STDERR:\n", stderr.String()) - t.Fatalf("command failed: %v", err) - } - return stdout.String() -} - -func writeFile(t *testing.T, workDir, filePath, content string) { - t.Helper() - if err := os.WriteFile(path.Join(workDir, filePath), []byte(content), 0o600); err != nil { - t.Fatalf("cannot write file %s: %v", filePath, err) - } -} - -func readFile(t *testing.T, workDir, filePath string) string { - t.Helper() - data, err := os.ReadFile(path.Join(workDir, filePath)) - if err != nil { - t.Fatalf("cannot read file %s: %v", filePath, err) - } - return string(data) -} - -type fileState string - -func file(s string) *fileState { f := fileState(s); return &f } -func (f *fileState) Exists() bool { return f != nil } -func (f *fileState) Content() string { - if f == nil { - return "" - } - return string(*f) -} - -func assertFiles(t *testing.T, workDir string, files map[string]*fileState) { - t.Helper() - for filePath, wantFile := range files { - fullPath := path.Join(workDir, filePath) - _, err := os.Stat(fullPath) - gotExists := true - var gotContent string - if err != nil { - if !os.IsNotExist(err) { - t.Fatalf("os.IsNotExist(%q): unexpected error: %v", fullPath, err) - } - gotExists = false - } else { - gotContent = readFile(t, workDir, filePath) - } - if got, want := gotExists, wantFile.Exists(); got != want { - t.Errorf("%s: exists = %t, want %t", filePath, got, want) - } - if got, want := gotContent, wantFile.Content(); got != want { - t.Errorf("%s: content = %q, want %q", filePath, gotContent, want) - } - } -} - -func TestStackerStart(t *testing.T) { - t.Parallel() - ctx := context.Background() - - workDir := newRepo(t) - - writeFile(t, workDir, "main.txt", "0\n") - cmd(t, workDir, "git", "add", "main.txt") - cmd(t, workDir, "git", "commit", "-m", "main: state 0") - cmd(t, workDir, "git", "push") - - stkr := Stacker{ - git: &git.Runner{ - WorkDir: workDir, - Env: cmdEnv, - }, - } - if err := stkr.Start(ctx, "test-branch-1"); err != nil { - t.Fatal(err) - } - - baseCommit := readFile(t, workDir, ".git/refs/heads/main") - - assertFiles(t, workDir, map[string]*fileState{ - ".git/HEAD": file("ref: refs/heads/test-branch-1\n"), - ".git/refs/heads/test-branch-1": file(baseCommit), - ".git/refs/stacker/base/test-branch-1": file("ref: refs/heads/main\n"), - ".git/refs/stacker/start/test-branch-1": file(baseCommit), - ".git/refs/stacker/remote/test-branch-1": nil, - }) -} - -func TestStackerPush(t *testing.T) { - t.Parallel() - ctx := context.Background() - - workDir := newRepo(t) - - writeFile(t, workDir, "main.txt", "0\n") - cmd(t, workDir, "git", "add", "main.txt") - cmd(t, workDir, "git", "commit", "-m", "main: state 0") - cmd(t, workDir, "git", "push") - - stkr := Stacker{ - git: &git.Runner{ - WorkDir: workDir, - Env: cmdEnv, - }, - } - - if err := stkr.Start(ctx, "test-branch-2"); err != nil { - t.Fatal(err) - } - - writeFile(t, workDir, "test-branch-2.txt", "0\n") - cmd(t, workDir, "git", "add", "test-branch-2.txt") - cmd(t, workDir, "git", "commit", "-m", "test-branch-2: state 0") - - branchCommit := readFile(t, workDir, ".git/refs/heads/test-branch-2") - - assertFiles(t, workDir, map[string]*fileState{ - ".git/refs/remotes/origin/test-branch-2": nil, - ".git/refs/stacker/remote/test-branch-2": nil, - }) - - if err := stkr.Push(ctx); err != nil { - t.Fatal(err) - } - - baseCommit := readFile(t, workDir, ".git/refs/heads/main") - - assertFiles(t, workDir, map[string]*fileState{ - ".git/HEAD": file("ref: refs/heads/test-branch-2\n"), - ".git/refs/remotes/origin/test-branch-2": file(branchCommit), - ".git/refs/stacker/base/test-branch-2": file("ref: refs/heads/main\n"), - ".git/refs/stacker/start/test-branch-2": file(baseCommit), - ".git/refs/stacker/remote/test-branch-2": file(branchCommit), - }) -} - -func TestStackerRebase(t *testing.T) { - t.Parallel() - ctx := context.Background() - - workDir := newRepo(t) - - writeFile(t, workDir, "main.txt", "0\n") - cmd(t, workDir, "git", "add", "main.txt") - cmd(t, workDir, "git", "commit", "-m", "main: state 0") - cmd(t, workDir, "git", "push") - - stkr := Stacker{ - git: &git.Runner{ - WorkDir: workDir, - Env: cmdEnv, - }, - } - - if err := stkr.Start(ctx, "test-branch"); err != nil { - t.Fatal(err) - } - - forkCommit := readFile(t, workDir, ".git/refs/heads/main") - - writeFile(t, workDir, "test-branch.txt", "0\n") - cmd(t, workDir, "git", "add", "test-branch.txt") - cmd(t, workDir, "git", "commit", "-m", "test-branch: state 0") - - writeFile(t, workDir, "test-branch.txt", "1\n") - cmd(t, workDir, "git", "add", "test-branch.txt") - cmd(t, workDir, "git", "commit", "-m", "test-branch: state 1") - - cmd(t, workDir, "git", "checkout", "main") - - writeFile(t, workDir, "main.txt", "1\n") - cmd(t, workDir, "git", "add", "main.txt") - cmd(t, workDir, "git", "commit", "-m", "main: state 1") - - baseCommit := readFile(t, workDir, ".git/refs/heads/main") - - cmd(t, workDir, "git", "checkout", "test-branch") - - assertFiles(t, workDir, map[string]*fileState{ - ".git/HEAD": file("ref: refs/heads/test-branch\n"), - ".git/refs/stacker/base/test-branch": file("ref: refs/heads/main\n"), - ".git/refs/stacker/start/test-branch": file(forkCommit), - }) - - if err := stkr.Rebase(ctx); err != nil { - t.Fatal(err) - } - - assertFiles(t, workDir, map[string]*fileState{ - ".git/HEAD": file("ref: refs/heads/test-branch\n"), - ".git/refs/stacker/base/test-branch": file("ref: refs/heads/main\n"), - ".git/refs/stacker/start/test-branch": file(baseCommit), - }) -} - -func TestStackerInit(t *testing.T) { - t.Parallel() - ctx := context.Background() - - workDir := newRepo(t) - - writeFile(t, workDir, "main.txt", "0\n") - cmd(t, workDir, "git", "add", "main.txt") - cmd(t, workDir, "git", "commit", "-m", "main: state 0") - cmd(t, workDir, "git", "push") - - stkr := Stacker{ - git: &git.Runner{ - WorkDir: workDir, - Env: cmdEnv, - }, - } - - if err := stkr.Init(ctx); err != nil { - t.Fatal(err) - } - - excludeDecorations := cmd(t, workDir, "git", "config", "--local", "--get-all", "log.excludeDecoration") - if got, want := excludeDecorations, "refs/stacker/\n"; got != want { - t.Errorf("log.excludeDecoration = %v, want %v", got, want) - } - - if err := stkr.Init(ctx); err != nil { - t.Fatal(err) - } - - // TODO: make Init idempotent - excludeDecorations = cmd(t, workDir, "git", "config", "--local", "--get-all", "log.excludeDecoration") - if got, want := excludeDecorations, "refs/stacker/\nrefs/stacker/\n"; got != want { - t.Errorf("log.excludeDecoration = %v, want %v", got, want) - } -} - -func TestStackerFix(t *testing.T) { - t.Parallel() - ctx := context.Background() - - workDir := newRepo(t) - - writeFile(t, workDir, "main.txt", "0\n") - cmd(t, workDir, "git", "add", "main.txt") - cmd(t, workDir, "git", "commit", "-m", "main: state 0") - cmd(t, workDir, "git", "push") - - stkr := Stacker{ - git: &git.Runner{ - WorkDir: workDir, - Env: cmdEnv, - }, - } - - if err := stkr.Fix(ctx); err != nil { - t.Fatal(err) - } -} diff --git a/internal/stacker/utils.go b/internal/stacker/utils.go deleted file mode 100644 index 2fc2605..0000000 --- a/internal/stacker/utils.go +++ /dev/null @@ -1,30 +0,0 @@ -package stacker - -import "strings" - -func (s *Stacker) ValidBranchName(name string) bool { - if protectedBranches[name] { - return false - } - if strings.ContainsRune(name, '/') { - return false - } - return op(s.git).parseBranchName(name) != "" -} - -func (s *Stacker) ValidBranchNames(names ...string) bool { - for _, name := range names { - if !s.ValidBranchName(name) { - return false - } - } - return true -} - -var protectedBranches = map[string]bool{ - "main": true, - "master": true, - "production": true, - "release": true, - "staging": true, -} diff --git a/main.go b/main.go deleted file mode 100644 index 2ecf719..0000000 --- a/main.go +++ /dev/null @@ -1,12 +0,0 @@ -package main - -import ( - "context" - - "github.com/cloneable/stacker/internal/command" -) - -func main() { - ctx := context.Background() - command.Execute(ctx) -} diff --git a/src/git.rs b/src/git.rs new file mode 100644 index 0000000..93e88e0 --- /dev/null +++ b/src/git.rs @@ -0,0 +1,392 @@ +use ::const_format::concatcp; +use ::csv::ReaderBuilder; +use ::serde::Deserialize; +use ::std::borrow::Cow; +use ::std::clone::Clone; +use ::std::collections::HashMap; +use ::std::convert::From; +use ::std::default::Default; +use ::std::error::Error; +use ::std::format; +use ::std::iter::IntoIterator; +use ::std::iter::Iterator; +use ::std::option::Option::{self, None}; +use ::std::result::Result::{self, Err, Ok}; +use ::std::string::String; +use ::std::string::ToString; +use ::std::todo; +use ::std::vec::Vec; +use ::std::write; + +// TODO: use ObjectName as type for const if possibe +pub const NON_EXISTANT_OBJECT: &'static str = "0000000000000000000000000000000000000000"; + +pub const STC_REF_PREFIX: &'static str = "refs/stc/"; +pub const STC_BASE_REF_PREFIX: &'static str = concatcp!(STC_REF_PREFIX, "base/"); +pub const STC_START_REF_PREFIX: &'static str = concatcp!(STC_REF_PREFIX, "start/"); +pub const STC_REMOTE_REF_PREFIX: &'static str = concatcp!(STC_REF_PREFIX, "remote/"); + +pub const BRANCH_REF_PREFIX: &'static str = "refs/heads/"; + +#[derive(Debug)] +pub struct Status { + pub exitcode: i32, + pub stdout: Vec, + pub stderr: Vec, +} + +impl Status { + pub fn new(exitcode: i32, stdout: Vec, stderr: Vec) -> Self { + Status { + exitcode, + stdout, + stderr, + } + } + + pub fn with(exitcode: i32) -> Self { + Status { + exitcode, + stdout: Default::default(), + stderr: Default::default(), + } + } +} + +impl ::std::fmt::Display for Status { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + write!(f, "SuperError is here!") + } +} + +impl Error for Status { + fn source(&self) -> Option<&(dyn Error + 'static)> { + // XXX + None //Some(&self.side) + } +} + +pub trait Git { + fn exec(&self, args: &[&str]) -> Result; + + fn snapshot(&self) -> Result { + let status = self.exec(&["for-each-ref", "--format", FIELD_FORMATS.join(",").as_str()])?; + let refs = parse_ref(status.stdout.as_slice()).map_err(move |_err| Status::with(1))?; + let head = refs + .values() + .find(move |r| r.head) + .map(move |r| r.name.branchname()); + Ok(Repository { refs, head }) + } + + fn check_branchname<'a>(&self, name: &'a String) -> Result, Status> { + self.exec(&["check-ref-format", "--branch", name])?; + Ok(BranchName(Cow::Borrowed(name))) + } + + fn create_branch(&self, name: &BranchName, base: &BranchName) -> Result<(), Status> { + self.exec(&["branch", "--create-reflog", name.as_str(), base.as_str()]) + .map(move |_| -> () {}) + } + + fn switch_branch(&self, b: &BranchName) -> Result<(), Status> { + self.exec(&["switch", "--no-guess", b.as_str()]) + .map(move |_| -> () {}) + } + + fn create_symref( + &self, + name: &RefName, + target: &RefName, + reason: &'static str, + ) -> Result<(), Status> { + self.exec(&["symbolic-ref", "-m", reason, name.as_str(), target.as_str()]) + .map(move |_| -> () {}) + } + + fn delete_symref(&self, name: &RefName) -> Result<(), Status> { + self.exec(&["symbolic-ref", "--delete", name.as_str()]) + .map(move |_| -> () {}) + } + + fn create_ref(&self, name: &RefName, commit: &ObjectName) -> Result<(), Status> { + self.exec(&[ + "update-ref", + "--no-deref", + "--create-reflog", + name.as_str(), + commit.as_str(), + NON_EXISTANT_OBJECT, + ]) + .map(move |_| -> () {}) + } + + fn update_ref( + &self, + name: &RefName, + new_commit: &ObjectName, + cur_commit: &ObjectName, + ) -> Result<(), Status> { + self.exec(&[ + "update-ref", + "--no-deref", + "--create-reflog", + name.as_str(), + new_commit.as_str(), + cur_commit.as_str(), + ]) + .map(move |_| -> () {}) + } + + fn delete_ref(&self, name: &RefName, cur_commit: &ObjectName) -> Result<(), Status> { + self.exec(&[ + "update-ref", + "--no-deref", + "-d", + name.as_str(), + cur_commit.as_str(), + ]) + .map(move |_| -> () {}) + } + + fn rebase_onto(&self, name: &BranchName) -> Result<(), Status> { + self.exec(&[ + "rebase", + "--committer-date-is-author-date", + "--onto", + name.stc_base_refname().as_str(), + name.stc_start_refname().as_str(), + name.as_str(), + ]) + .map(move |_| -> () {}) + } + + fn push( + &self, + name: &BranchName, + remote: &RemoteName, + expect: &ObjectName, + ) -> Result<(), Status> { + self.exec(&[ + "push", + "--set-upstream", + format!("--force-with-lease={}:{}", name.as_str(), expect.as_str()).as_str(), + remote.as_str(), + format!("{}:{}", name.as_str(), name.as_str()).as_str(), + ]) + .map(move |_| -> () {}) + } + + fn config_set(&self, key: &str, value: &str) -> Result<(), Status> { + self.exec(&["config", "--local", key, value]) + .map(move |_| -> () {}) + } + + fn config_add(&self, key: &str, value: &str) -> Result<(), Status> { + self.exec(&["config", "--local", "--add", key, value]) + .map(move |_| -> () {}) + } + + fn config_unset_pattern(&self, key: &str, pattern: &str) -> Result<(), Status> { + match self.exec(&[ + "config", + "--local", + "--fixed-value", + "--unset-all", + key, + pattern, + ]) { + // 5 means the nothing matched. + Err(status) if status.exitcode != 5 => Err(status), + _ => Ok(()), + } + } + + fn fetch_all_prune(&self) -> Result<(), Status> { + self.exec(&["fetch", "--all", "--prune"]) + .map(move |_| -> () {}) + } + + fn tracked_branches(&self) -> Result, Status> { + todo!() + } + + fn forkpoint(&self, base: &RefName, branch: &RefName) -> Result { + self.exec(&["merge-base", "--fork-point", base.as_str(), branch.as_str()]) + .map(move |status| { + // TODO: handle not found + ObjectName(Cow::Owned( + String::from_utf8_lossy(&status.stdout).to_string(), + )) + }) + } +} + +pub struct Repository<'a> { + refs: HashMap, Ref<'a>>, + head: Option>, +} + +impl<'a> Repository<'a> { + pub fn get_ref(&self, name: &'a RefName) -> Option<&'a Ref> { + self.refs.get(name) + } + + pub fn head(&self) -> Option<&'a BranchName> { + self.head.as_ref() + } +} + +#[derive(PartialEq, PartialOrd, Debug)] +pub struct BranchName<'a>(Cow<'a, String>); + +impl<'a> BranchName<'a> { + const fn new(name: String) -> Self { + BranchName(Cow::Owned(name)) + } + + pub fn as_str(&self) -> &str { + self.0.as_str() + } + + pub fn refname(&self) -> RefName { + RefName(Cow::Owned(BRANCH_REF_PREFIX.to_string() + &self.0)) + } + + pub fn stc_base_refname(&self) -> RefName { + RefName(Cow::Owned(STC_BASE_REF_PREFIX.to_string() + &self.0)) + } + + pub fn stc_start_refname(&self) -> RefName { + RefName(Cow::Owned(STC_START_REF_PREFIX.to_string() + &self.0)) + } + + pub fn stc_remote_refname(&self) -> RefName { + RefName(Cow::Owned(STC_REMOTE_REF_PREFIX.to_string() + &self.0)) + } +} + +#[derive(Deserialize, Clone, Hash, Eq, PartialEq, Ord, PartialOrd, Debug)] +pub struct RefName<'a>(Cow<'a, String>); + +impl<'a> RefName<'a> { + const fn new(name: String) -> Self { + RefName(Cow::Owned(name)) + } + + pub fn as_str(&self) -> &str { + self.0.as_str() + } + + pub fn branchname(&self) -> BranchName<'a> { + let (_, branchname) = self.0.rsplit_once("/").unwrap(); + BranchName::new(branchname.to_string()) + } +} + +#[derive(Deserialize, PartialEq, PartialOrd, Clone, Debug)] +pub struct ObjectName<'a>(pub Cow<'a, String>); + +impl<'a> ObjectName<'a> { + pub const fn new(value: String) -> Self { + ObjectName(Cow::Owned(value)) + } + + pub fn as_str(&self) -> &str { + self.0.as_str() + } +} + +#[derive(Deserialize, PartialEq, PartialOrd, Debug)] +pub struct RemoteName<'a>(Cow<'a, String>); + +impl<'a> RemoteName<'a> { + const fn new(value: String) -> Self { + RemoteName(Cow::Owned(value)) + } + + pub fn as_str(&self) -> &str { + self.0.as_str() + } +} + +#[derive(Deserialize, PartialEq, Debug)] +#[serde(rename_all = "lowercase")] +pub enum RefType { + Commit, + Tree, + Blob, + Tag, +} + +#[derive(Deserialize, PartialEq, Debug)] +pub struct Ref<'a> { + pub name: RefName<'a>, + pub head: bool, + pub objectname: ObjectName<'a>, + pub objecttype: RefType, + pub track: String, + pub remote: RemoteName<'a>, + pub remote_refname: RefName<'a>, + pub symref_target: RefName<'a>, + pub upstream_refname: RefName<'a>, +} + +const FIELD_FORMATS: [&'static str; 9] = [ + "%(refname)", // name + "%(if)%(HEAD)%(then)true%(else)false%(end)", // head + "%(objectname)", // objectname + "%(objecttype)", // objecttype + "%(upstream:trackshort)", // track + "%(upstream:remotename)", // remote + "%(upstream:remoteref)", // remote_refname + "%(symref)", // symref_target + "%(upstream)", // upstream_refname +]; + +fn parse_ref<'a, R: ::std::io::Read + ::std::fmt::Debug>( + csv: R, +) -> Result, Ref<'a>>, ::csv::Error> { + let mut reader = ReaderBuilder::new() + .has_headers(false) + .delimiter(b',') + .from_reader(csv); + let ref_vec = reader + .deserialize::() + .collect::, ::csv::Error>>()?; + let refs = ref_vec + .into_iter() + .map(move |r| (r.name.clone(), r)) + .collect::>(); + Ok(refs) +} + +#[cfg(test)] +mod tests { + use super::*; + use ::std::assert_eq; + + #[test] + fn test_parse_ref() { + let csv = "\ +refs/heads/moo1,true,123abc,commit,<>,origin,refs/heads/moo,,refs/remotes/origin/moo +"; + let refs = parse_ref(csv.as_bytes()).expect("cannot parse"); + assert_eq!(refs.len(), 1); + assert_eq!( + refs.get(&RefName::new("refs/heads/moo1".to_string())) + .unwrap(), + &Ref { + name: RefName::new("refs/heads/moo1".to_string()), + head: true, + objectname: ObjectName::new("123abc".to_string()), + objecttype: RefType::Commit, + track: String::from("<>"), + remote: RemoteName::new("origin".to_string()), + remote_refname: RefName::new("refs/heads/moo".to_string()), + symref_target: RefName::new("".to_string()), + upstream_refname: RefName::new("refs/remotes/origin/moo".to_string()), + } + ) + } +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..7e9c097 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,95 @@ +#![no_implicit_prelude] +#![allow(missing_docs)] // TODO: change to warn/deny +#![allow(dead_code)] // TODO: remove + +use ::clap::{self, Parser, Subcommand}; +use ::std::option::Option::{self, None, Some}; +use ::std::result::Result; +use ::std::string::String; + +mod git; +mod runner; +mod stc; + +#[derive(Parser)] +#[clap(about, version)] +struct Root { + #[clap(subcommand)] + subcommand: Command, +} + +#[derive(Subcommand)] +#[clap()] +enum Command { + #[clap( + name = "clean", + about = "Cleans any stc related refs and settings from repo.", + override_usage = "stc clean" + )] + Clean, + + #[clap( + name = "fix", + about = "Adds, updates and deletes tracking refs if needed.", + override_usage = "stc fix [ [, + #[clap(name = "base", about = "name of the base branch")] + base: Option, + }, + + #[clap( + name = "init", + about = "Initializes the repo and tries to set stc refs for any non-default branches.", + override_usage = "stc init" + )] + Init, + + #[clap( + name = "push", + about = "Sets remote branch head to what local branch head points to.", + override_usage = "stc push" + )] + Push, + + #[clap( + name = "rebase", + about = "Rebases current branch on top of its base branch.", + override_usage = "stc rebase" + )] + Rebase, + + #[clap( + name = "start", + about = "Starts a new branch off of current branch.", + override_usage = "stc start " + )] + Start { + #[clap(name = "branch", about = "name of the new branch to create")] + branch: String, + }, + + #[clap( + name = "sync", + about = "Fetches all branches and tags and prunes deleted ones.", + override_usage = "stc sync" + )] + Sync, +} + +fn main() -> Result<(), git::Status> { + let root = Root::parse(); + let runner = runner::Runner::new("git"); + let stc = stc::STC::new(runner); + match root.subcommand { + Command::Clean => stc.clean(), + Command::Fix { branch, base } => stc.fix(branch, base), + Command::Init => stc.init(), + Command::Push => stc.push(), + Command::Rebase => stc.rebase(), + Command::Start { branch } => stc.start(branch), + Command::Sync => stc.sync(), + } +} diff --git a/src/runner.rs b/src/runner.rs new file mode 100644 index 0000000..8846b22 --- /dev/null +++ b/src/runner.rs @@ -0,0 +1,43 @@ +use crate::git::{Git, Status}; +use ::std::assert_ne; +use ::std::option::Option::Some; +use ::std::process::Command; +use ::std::process::Stdio; +use ::std::result::Result::{self, Err, Ok}; + +pub struct Runner<'a> { + gitpath: &'a str, +} + +impl<'a> Runner<'a> { + pub fn new(gitpath: &'a str) -> Self { + Runner { gitpath } + } +} + +impl<'a> Git for Runner<'a> { + fn exec(&self, args: &[&str]) -> Result { + let cmd = Command::new(self.gitpath) + .args(args) + .stdin(Stdio::null()) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .spawn() + .expect("failed to start git"); + + let output = cmd.wait_with_output().expect("failed to wait on git"); + if output.status.success() { + ::std::eprintln!("[OK] git {:?}", args); + Ok(Status::new(0, output.stdout, output.stderr)) + } else { + if let Some(code) = output.status.code() { + assert_ne!(code, 0); + ::std::eprintln!("[ERR {:?}] git {:?}", code, args); + Err(Status::new(code, output.stdout, output.stderr)) + } else { + ::std::eprintln!("[ERR] git {:?}", args); + Err(Status::new(1, output.stdout, output.stderr)) + } + } + } +} diff --git a/src/stc.rs b/src/stc.rs new file mode 100644 index 0000000..0a33622 --- /dev/null +++ b/src/stc.rs @@ -0,0 +1,216 @@ +use crate::git::*; +use ::std::option::Option::{self, Some}; +use ::std::result::Result::{self, Err, Ok}; +use ::std::string::String; +use ::std::string::ToString; +use ::std::vec::Vec; + +pub struct STC { + git: G, +} + +impl STC { + pub fn new(git: G) -> Self { + STC { git } + } + + pub fn init(&self) -> Result<(), Status> { + let g = &self.git; + g.config_add("transfer.hideRefs", STC_REF_PREFIX)?; + g.config_add("log.excludeDecoration", STC_REF_PREFIX)?; + + // TODO: read refs, branches, remotes + // TODO: validate stc refs against branches + // TODO: determine list of needed refs + // TODO: print and create list of created refs + + Ok(()) + } + + pub fn clean(&self) -> Result<(), Status> { + let g = &self.git; + g.config_unset_pattern("transfer.hideRefs", STC_REF_PREFIX)?; + g.config_unset_pattern("log.excludeDecoration", STC_REF_PREFIX)?; + + // TODO: for each branch + // TODO: ... check if fully merged + // TODO: ... check if remote ref == local branch + // TODO: ... delete stc refs + // TODO: ... or print warning + + Ok(()) + } + + pub fn start(&self, name: String) -> Result<(), Status> { + let g = &self.git; + let repo = g.snapshot()?; + let base_branch = repo.head().ok_or(Status::with(1))?; + let new_name = g.check_branchname(&name)?; + g.create_branch(&new_name, base_branch)?; + g.switch_branch(&new_name)?; + g.create_symref( + &new_name.stc_base_refname(), + &base_branch.refname(), + "stc: base branch marker", + )?; + let base_refname = base_branch.refname(); + let base_ref = repo.get_ref(&base_refname).ok_or(Status::with(1))?; + g.create_ref(&new_name.stc_start_refname(), &base_ref.objectname)?; + + Ok(()) + } + + pub fn push(&self) -> Result<(), Status> { + let g = &self.git; + + let expected_commit: ObjectName; + { + let repo = g.snapshot()?; + let cur_branch = repo.head().ok_or(Status::with(1))?; + let stc_base_refname = cur_branch.stc_base_refname(); + let base_symref = repo.get_ref(&stc_base_refname).ok_or(Status::with(1))?; + let base_ref = repo + .get_ref(&base_symref.symref_target) + .ok_or(Status::with(1))?; + if let Some(remote_ref) = repo.get_ref(&cur_branch.stc_remote_refname()) { + // use ::std::borrow::ToOwned; + expected_commit = ObjectName::new(remote_ref.objectname.0.to_string()); + // TODO: clean clone + } else { + expected_commit = ObjectName::new(NON_EXISTANT_OBJECT.to_string()); + } + g.push(&cur_branch, &base_ref.remote, &expected_commit)?; + } + { + let repo = g.snapshot()?; + let cur_branch = repo.head().ok_or(Status::with(1))?; + let cur_refname = cur_branch.refname(); + let cur_ref = repo.get_ref(&cur_refname).ok_or(Status::with(1))?; + g.update_ref( + &cur_branch.stc_remote_refname(), + &cur_ref.objectname, + &expected_commit, + )?; + } + + Ok(()) + } + + pub fn rebase(&self) -> Result<(), Status> { + let g = &self.git; + + let repo = g.snapshot()?; + let branch = repo.head().ok_or(Status::with(1))?; + let stc_base_refname = branch.stc_base_refname(); + let stc_start_refname = branch.stc_start_refname(); + let base_ref = repo.get_ref(&stc_base_refname).ok_or(Status::with(1))?; + let start_ref = repo.get_ref(&stc_start_refname).ok_or(Status::with(1))?; + g.rebase_onto(&branch)?; + g.update_ref( + &branch.stc_start_refname(), + &base_ref.objectname, + &start_ref.objectname, + )?; + + Ok(()) + } + + pub fn sync(&self) -> Result<(), Status> { + let g = &self.git; + + g.fetch_all_prune()?; + + Ok(()) + } + + pub fn fix(&self, branch: Option, base: Option) -> Result<(), Status> { + let g = &self.git; + + let repo = g.snapshot()?; + // TODO: this is hacky. refactor. + if let Some(branchname) = branch { + if let Some(base_branchname) = base { + let branch = g.check_branchname(&branchname)?; + let base_branch = g.check_branchname(&base_branchname)?; + if let Some(base_symref) = repo.get_ref(&branch.stc_base_refname()) { + if base_symref.symref_target != base_branch.refname() { + return Err(Status::new( + 1, + Vec::::new(), + "base branch already defined".as_bytes().to_vec(), + )); + } + } else { + g.create_symref( + &branch.stc_base_refname(), + &base_branch.refname(), + "stc: set base branch", + )?; + } + if let Some(_start_ref) = repo.get_ref(&branch.stc_start_refname()) { + // TODO: check if base or ancestor of base + } else { + let forkpoint = g.forkpoint(&base_branch.refname(), &branch.refname())?; + g.create_ref(&branch.stc_start_refname(), &forkpoint)?; + } + } else { + return Err(Status::new( + 1, + Vec::::new(), + "base not specified".as_bytes().to_vec(), + )); + } + } + + let repo = g.snapshot()?; + for branch in g.tracked_branches()? { + if repo.get_ref(&branch.refname()).is_none() { + if let Some(r) = repo.get_ref(&branch.stc_base_refname()) { + g.delete_symref(&r.name)?; + } + if let Some(r) = repo.get_ref(&branch.stc_start_refname()) { + g.delete_ref(&r.name, &r.objectname)?; + } + if let Some(r) = repo.get_ref(&branch.stc_remote_refname()) { + g.delete_ref(&r.name, &r.objectname)?; + } + } + } + + let repo = g.snapshot()?; + for branch in g.tracked_branches()? { + // for each existing branch that's somehow still being tracked: + let base_symref_name = branch.stc_base_refname(); + let start_refname = branch.stc_start_refname(); + if let Some(base_symref) = repo.get_ref(&base_symref_name) { + // there's a base symref + if repo.get_ref(&start_refname).is_none() { + // but no start ref + if repo.get_ref(&base_symref.symref_target).is_none() { + // TODO: base branch doesn't exist (anymore) + continue; + } + // figure out forkpoint from what the base symref points to and the branch + // TODO: forkpoint can fail + let forkpoint = g.forkpoint(&base_symref.symref_target, &branch.refname())?; + // write the commit as start ref + g.create_ref(&branch.stc_start_refname(), &forkpoint)?; + } + } else { + // there's no base symref + if let Some(_start_ref) = repo.get_ref(&start_refname) { + // but there's a start ref + // TODO: check for branch at that commit? consult reflog? + } + } + } + + // TODO: no /base/, but /start/ -> look for branch head at /start/, set /base/ + // TODO: no /start/, but /base/ -> use git merge-base to find fork point + // TODO: no /start/ nor /base/ -> do nothing, offer explicit way to track + // TODO: no /remote/, but remote branch exists? -> set ref, if ancestor, if not -> error + // TODO: no remote branch, but /remote/ -> delete ref (check origin?) + + Ok(()) + } +}