Skip to content

Commit

Permalink
Prepare open-sourcing (add to README, some clean-up)
Browse files Browse the repository at this point in the history
This commit adds more text to the README.
It also cleans up `Cargo.toml` just a little bit.
And it adds license notices to the top of all source code files.
Plus, I have run `cargo upgrades` and `cargo update` to update the dependencies.

Test Plan: code review and `cargo check && cargo clippy`

Reviewers: jacksongabbard, flooey, jozef-mokry

Reviewed By: flooey

Pull Request: #39
  • Loading branch information
Sven Over authored May 23, 2022
1 parent d861447 commit 77a7da0
Show file tree
Hide file tree
Showing 25 changed files with 556 additions and 254 deletions.
611 changes: 365 additions & 246 deletions Cargo.lock

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ version = "1.2.1"
authors = ["Sven Over <[email protected]>", "Jozef Mokry <[email protected]>"]
description = "Submit pull requests for individual, amendable, rebaseable commits to GitHub"
repository = "https://github.com/getcord/spr"
homepage = "https://github.com/getcord/spr"
license = "MIT"
edition = "2021"
exclude = [".github", ".gitignore"]

[dependencies]
async-compat = "^0.2.1"
Expand All @@ -14,21 +16,19 @@ async-lock = "^2.4.0"
async-process = "^1.3.0"
clap = { version = "^3.0.14", features = ["derive", "wrap_help"] }
console = "^0.15.0"
dialoguer = "^0.9.0"
dialoguer = "^0.10.1"
futures = "^0.3.21"
futures-lite = "^1.12.0"
git2 = "^0.13.25"
git2 = "^0.14.4"
indoc = "^1.0.3"
lazy-regex = "^2.2.2"
octocrab = "^0.15.4"
once_cell = "^1.9.0"
octocrab = "^0.16.0"
serde = "^1.0.136"
textwrap = "0.14.2"
textwrap = "0.15.0"
thiserror = "^1.0.30"
unicode-normalization = "^0.1.19"
graphql_client = "0.10.0"
reqwest = { version = "^0.11", features = ["json"] }


[dev-dependencies]
smol = "^1.2.5"
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)
MIT License

Copyright (c) 2022 Sven Over <[email protected]>
Copyright (c) Radical HQ Limited

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,39 @@
A command-line tool for submitting and updating GitHub Pull Requests from local
Git commits that may be amended and rebased. Pull Requests can be stacked to
allow for a series of code reviews of interdependent code.

spr is pronounced /ˈsuːpəɹ/, like the English word 'super'.

## Installation

### Install from Source

spr is written in Rust. You need a Rust toolchain to build from source. See [rustup.rs](https://rustup.rs) for information on how to install Rust if you have not got a Rust toolchain on your system already.

With Rust all set up, clone this repository and run `cargo build --release`. The spr binary will be in the `target/release` directory.

## Quickstart

To use spr, run `spr init` inside a local checkout of a GitHub-backed git repository. You will be asked for a GitHub PAT (Personal Access Token), which spr will use to make calls to the GitHub API in order to create and merge pull requests.

To submit a commit for pull request, run `spr diff`.

If you want to make changes to the pull request, amend your local commit (and/or rebase it) and call `spr diff` again. When updating an existing pull request, spr will ask you for a short message to describe the update.

To squash-merge an open pull request, run `spr land`.

For more information on spr commands and options, run `spr help`. For more information on a specific spr command, run `spr help <COMMAND>` (e.g. `spr help diff`).

## Documentation

There is no more documentation at this point. This README will be updated as soon as there are additional resources.

## Contributing

Feel free to submit an issue on [GitHub](https://github.com/getcord/spr) if you have found a problem. If you can even provide a fix, please raise a pull request!

If there are larger changes or features that you would like to work on, please raise an issue on GitHub first to discuss.

### License

spr is [MIT licensed](./LICENSE).
7 changes: 7 additions & 0 deletions src/async_memoizer.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* Copyright (c) Radical HQ Limited
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

use std::{collections::HashMap, hash::Hash};

use crate::{
Expand Down
7 changes: 7 additions & 0 deletions src/commands/amend.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* Copyright (c) Radical HQ Limited
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

use crate::{
error::{Error, Result},
message::validate_commit_message,
Expand Down
7 changes: 7 additions & 0 deletions src/commands/diff.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* Copyright (c) Radical HQ Limited
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

use crate::{
error::{add_error, Error, Result, ResultExt},
git::PreparedCommit,
Expand Down
7 changes: 7 additions & 0 deletions src/commands/format.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* Copyright (c) Radical HQ Limited
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

use crate::{
error::{Error, Result},
message::validate_commit_message,
Expand Down
7 changes: 7 additions & 0 deletions src/commands/init.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* Copyright (c) Radical HQ Limited
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

use async_compat::CompatExt;
use indoc::formatdoc;

Expand Down
7 changes: 7 additions & 0 deletions src/commands/land.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* Copyright (c) Radical HQ Limited
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

use async_compat::CompatExt;
use indoc::formatdoc;
use std::io::Write;
Expand Down
7 changes: 7 additions & 0 deletions src/commands/list.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* Copyright (c) Radical HQ Limited
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

use crate::error::Error;
use crate::error::Result;
use async_compat::CompatExt;
Expand Down
7 changes: 7 additions & 0 deletions src/commands/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* Copyright (c) Radical HQ Limited
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

pub mod amend;
pub mod diff;
pub mod format;
Expand Down
7 changes: 7 additions & 0 deletions src/commands/patch.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* Copyright (c) Radical HQ Limited
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

use crate::{
error::Result,
message::{build_commit_message, MessageSection},
Expand Down
7 changes: 7 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* Copyright (c) Radical HQ Limited
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

use std::collections::HashSet;

use crate::utils::slugify;
Expand Down
7 changes: 7 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* Copyright (c) Radical HQ Limited
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

#[derive(Clone, Debug)]
pub struct Error {
messages: Vec<String>,
Expand Down
7 changes: 7 additions & 0 deletions src/executor.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* Copyright (c) Radical HQ Limited
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

thread_local! {
static EXECUTOR: async_executor::LocalExecutor<'static> =
async_executor::LocalExecutor::new();
Expand Down
7 changes: 7 additions & 0 deletions src/future.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* Copyright (c) Radical HQ Limited
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

use crate::executor::spawn;
use std::collections::HashMap;
use std::future::Future as StdFuture;
Expand Down
7 changes: 7 additions & 0 deletions src/git.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* Copyright (c) Radical HQ Limited
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

use std::collections::{HashSet, VecDeque};

use crate::{
Expand Down
7 changes: 7 additions & 0 deletions src/github.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* Copyright (c) Radical HQ Limited
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

use graphql_client::{GraphQLQuery, Response};
use serde::Deserialize;

Expand Down
7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* Copyright (c) Radical HQ Limited
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

pub mod async_memoizer;
pub mod commands;
pub mod config;
Expand Down
7 changes: 7 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* Copyright (c) Radical HQ Limited
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

//! A command-line tool for submitting and updating GitHub Pull Requests from
//! local Git commits that may be amended and rebased. Pull Requests can be
//! stacked to allow for a series of code reviews of interdependent code.
Expand Down
7 changes: 7 additions & 0 deletions src/message.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* Copyright (c) Radical HQ Limited
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

use crate::{
error::{Error, Result},
output::output,
Expand Down
7 changes: 7 additions & 0 deletions src/output.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* Copyright (c) Radical HQ Limited
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

use crate::{error::Result, git::PreparedCommit, message::MessageSection};

pub fn output(icon: &str, text: &str) -> Result<()> {
Expand Down
7 changes: 7 additions & 0 deletions src/spr.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* Copyright (c) Radical HQ Limited
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

use crate::error::{Error, Result};
use clap::{Parser, Subcommand};
use reqwest::{self, header};
Expand Down
7 changes: 7 additions & 0 deletions src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* Copyright (c) Radical HQ Limited
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

use crate::error::{Error, Result};

use std::io::Write;
Expand Down

0 comments on commit 77a7da0

Please sign in to comment.