Age | Commit message (Collapse) | Author |
|
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.
|
|
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.
|
|
This was taken care of in 21534162124501f0410ee31cd31130aa3b92a9f3.
|
|
|
|
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.
|
|
|
|
|
|
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.
|
|
Print a real usage message.
|
|
|
|
Use the existing `code-review` tool instead of the full Git command.
|
|
Basic Bash completion of `code-review` subcommands.
|
|
* 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.
|
|
Make the script a `code-review` subcommand. I had originally written it
before the `code-review-` subcommand prefix system.
|
|
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.
|
|
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
|
|
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.
|
|
Put these functions in a function-only file that can be sourced by other
scripts that need database access.
|
|
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
|
|
Turns out some files were excluded using the `..` range.
|
|
|
|
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.
|
|
Fugitive seems to have fewer surprises and basically just work in Vim.
|
|
Output a short log of commits.
|
|
Outputs a stat of the changed files.
|
|
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.
|
|
Script to show a Git diff of the current changes. Uses `master..` as the
default base.
|
|
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.
|
|
Going to set up a Git-style subcommand system where subcommands are
separate executables.
|
|
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.
|
|
Arguments are a Git refspec.
|
|
|
|
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.
|
|
|
|
This script is going to be sourced into an interactive shell session.
Don't set unnecessary variables.
|
|
Shell function that checks out a pull request in a git worktree and
changes into the worktree directory.
|
|
|