aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2019-06-17code-review-difftool: Retain old `extglob` settingTeddy Wing
If `extglob` was set, we'd always unset it. Check to see if it's set before doing anything with it, and then restore it to its original value.
2019-06-17code-review-difftool: Remove commented code from 42215fe2bbefba19308bd8Teddy Wing
This was a note preceding implementation, and is no longer needed.
2019-06-17get_merge_base(): Change default base to `master...`Teddy Wing
Add the range filter to try to remove commits that we don't care about. Still not sure if this will work in all cases, as sometimes `..` seemed to give me the right collection of files and sometimes `...` did. code-review-difftool: Pass the merge base without range dots (`..` or `...`) to Vim Fugitive, as it doesn't accept revisions with ranges. Not sure what to do if I get a range with two revision names yet, though. Turns on Bash's `extglob` in order to use `?(...)` to include both patterns in the expansion.
2019-06-11code-review-database: Always try to create the databaseTeddy Wing
If the database doesn't exist, we get this error: Error: near line 3: no such table: merge_bases This is because `sqlite3` will always create a new database if it doesn't exist when running a command against a database. The newly-created database doesn't have the required table, and we get the error. Fix the problem by ensuring the database always exists and is initialised properly.
2019-06-10code-review-database: Remove TODOTeddy Wing
This was taken care of in 21534162124501f0410ee31cd31130aa3b92a9f3.
2019-06-10code-review: Add a version number and `--version` program flagTeddy Wing
2019-06-10code-review: Fix `--help` argumentTeddy Wing
The `shift` call came before I was checking the first argument `$1` if it was '--help'. This caused the program to print the 'nonexistent command' error message. Move the `shift` call to just before we pass on the rest of the command line arguments.
2019-06-10Add READMETeddy Wing
2019-06-10Add license (GNU GPLv3+)Teddy Wing
2019-06-10Add a man pageTeddy Wing
Not very detailed at the moment, just copies the usage output. Would be nice to make this more descriptive, and even better to have separate man pages for each subcommand.
2019-06-10code-review: Add usage outputTeddy Wing
Print a real usage message.
2019-06-10code-review-difftool: Remove completed TODOsTeddy Wing
2019-06-10code-review-difftool: Use `code-review-changed-files`Teddy Wing
Use the existing `code-review` tool instead of the full Git command.
2019-06-10Add code-review.bash-completionTeddy Wing
Basic Bash completion of `code-review` subcommands.
2019-06-10code-review-changed-files: Use `get_merge_base`; Print absolute pathsTeddy Wing
* Use the common merge base from `code-review-database`. * Print an absolute path to the file using `$GIT_ROOT` from `code-review-database`. This allows the paths to be useful even when PWD is a subdirectory in the Git repo.
2019-06-10Rename `git-changed-files` to `code-review-changed-files`Teddy Wing
Make the script a `code-review` subcommand. I had originally written it before the `code-review-` subcommand prefix system.
2019-06-10Use `get_merge_base` across scriptsTeddy Wing
Replace `$ARGS` system from before with the merge base value taken from the database. This makes the merge base consistent across `code-review` tools/subcommands.
2019-06-10code-review-database(create_merge_base): Upsert merge baseTeddy Wing
Don't duplicate rows if we call `create_merge_base` multiple times. Doing so would mean we'd get multiple merge base rows for the same head. Instead, overwrite the existing merge base for a given head using an upsert. Thanks a bunch to MarqueIV (https://stackoverflow.com/users/168179/marqueiv) on Stack Overflow for demonstrating a way to do an upsert without the UPSERT syntax. This enables us to do an upsert on SQLite < 3.24.0. Neat trick. https://stackoverflow.com/questions/15277373/sqlite-upsert-update-or-insert/38463024#38463024
2019-06-09code-review-start: Only insert merge_bases row if argument was passedTeddy Wing
Don't create a `merge_bases` entry in the database if no merge base argument was passed to the script. The `get_merge_base` function in `code-review-database` will default to `origin/master` or `master` when no row is found in the database. Rely on those defaults instead of always inserting a row.
2019-06-09Move database functions from code-review-start to code-review-databaseTeddy Wing
Put these functions in a function-only file that can be sourced by other scripts that need database access.
2019-06-09code-review-start: Add `get_merge_base` functionTeddy Wing
Function to get the merge base for the current branch. If none exists in the database, default to `origin/master` if there's an `origin` remote, or `master` if not. Thanks to Serpiton (https://codereview.stackexchange.com/users/61525/serpiton) on Stack Overflow for describing how to get a default value using the `MAX()` function: https://codereview.stackexchange.com/questions/74192/select-first-value-if-exists-otherwise-select-default-value/74252#74252 Thanks to 'tig' (https://stackoverflow.com/users/96823/tig) on Stack Overflow for the command to check if a given Git remote exists: https://stackoverflow.com/questions/12170459/check-if-git-remote-exists-before-first-push/26843249#26843249
2019-06-09code-review-difftool: Change `master..` to `master`Teddy Wing
Turns out some files were excluded using the `..` range.
2019-06-05code-review-start: Add TODO for upsertTeddy Wing
2019-06-05Add draft of 'code-review-start'Teddy Wing
This command will store the desired merge base for the current branch, defaulting to "origin/master". In so doing, subsequent `code-review` subcommands will have access to this and be able to default to a merge base branch instead of: * Having users specify one manually at the command line for each `code-review` subcommand * Having a default merge base branch that's not desired by users I figure I can hopefully get away with not sanitizing SQL input because I don't think you can use apostrophes in Git branch names. Otherwise I'll probably have to port this to another language with a SQLite library, as it doesn't seem possible to easily sanitize inputs in Bash.
2019-06-04code-review-difftool: Use 'vim-fugitive' instead of 'vdwrap'Teddy Wing
Fugitive seems to have fewer surprises and basically just work in Vim.
2019-06-04Add code-review-commitsTeddy Wing
Output a short log of commits.
2019-06-04Add code-review-statTeddy Wing
Outputs a stat of the changed files.
2019-06-03code-review: Pass arguments to subcommand programTeddy Wing
Since subcommands are separate programs, we need to make sure we pass all remaining arguments along to the subcommand. Without this, I wasn't able to pass a different base branch to my `diff` subcommand.
2019-06-03Add code-review-diffTeddy Wing
Script to show a Git diff of the current changes. Uses `master..` as the default base.
2019-06-03Add `code-review`, subcommand runnerTeddy Wing
This script takes a subcommand as the first argument and executes an executable called "code-review-${subcommand}", similar to the way Git does subcommands. Using this subcommand system, I can have different unrelated subcommands in separate files/scripts, making it easier to organise the code.
2019-06-03Move `code-review` to `code-review-difftool`Teddy Wing
Going to set up a Git-style subcommand system where subcommands are separate executables.
2019-06-02git-changed-files: Get an absolute path to the files (WIP)Teddy Wing
A couple methods to get the absolute path to the changed files. This allows the output to be used to operate on changed files even if the current directory is not the repo root. Otherwise, all files are listed relative to the repository root.
2019-06-02Add a script to show filenames of changed filesTeddy Wing
Arguments are a Git refspec.
2019-06-02code-review: Add a note to focus the rightmost tab in VimTeddy Wing
2019-05-18Add directory diff command using `vdwrap`Teddy Wing
Performs a dir diff opening all changed files in separate tabs in Vim all in diff mode. Currently it has some problems as `vdwrap` uses `/dev/null` to compare against new files, but Vim pops up errors saying `/dev/null` isn't a real file.
2018-12-01Add a new interface ideaTeddy Wing
2018-12-01git-review: Make `EX_USAGE` a function-local variableTeddy Wing
This script is going to be sourced into an interactive shell session. Don't set unnecessary variables.
2018-12-01Add `git-review`Teddy Wing
Shell function that checks out a pull request in a git worktree and changes into the worktree directory.
2018-12-01Track ideas fileTeddy Wing