Skyscanner/turbolift

Introduce a step-by-step git commiter

Opened this issue · 3 comments

On large repo lists, one often has to run this kind of workflow:

turbolift clone
turbolift forearch <insert here the command to change the repo>

then, to validate the changes, they would run something like this:

turbolift foreach git diff
<frantically scroll through thousands of lines to figure out whether all repositories are successfully changed>
<then, trusting your eye sight, you stage and commit>
turbolift commit

It would be nice to have a way to commit those step-by-step with a visual validation from the user, introducing a --incremental.

The workflow would look like:

turbolift commit -i
-- Repository: REPOSITORY_NAME_1
<git diff on this specific repo>
<prompt for the user to confirm with a y/N>
-- Repository: REPOSITORY_NAME_2
...

We will log in the end the repo list that WASN'T updated, the user can decide what to do with it then.

@rnorth that's kinda what I talked about in the last TAB.
thoughts?

Further questions: Should it be Y/n or y/N? Easier to start with no default to start with and see what happens.

Started working on this, just to validate the proposed workflow:

  1. new flag incremental for commit, toggled off by default
  2. if activated:
    • it will start by printing the git diff (I suggest running -U1 which will only print a single line above and below the change), then
    • ask for user confirmation (there's already a prompt module in the project)
    • if green light, go ahead with the commit
    • if not, add to skip

The untracked files are explicitly excluded from the list, because by default git commit -a will not include them.
Perhaps we could highlight this in a future iteration but I don't think it's required now.

Does this workflow look alright? cc @rnorth @Dan7-7-7