twosigma / twosigma/git-meta

add a `revert` command

Open
#452 0 comments 0 reactions 0 assignees View on GitHub
revert
Dominant language
JavaScript
Stars
233
Forks
54
PR merge metrics
No merged PRs in 30d

Description

# Specifcation
First iteration will be as simple as possible; we can expand later as requested:

* only options are `--continue` and `--abort`
* support for only a single commit (no `..` notation)
* Will prompt user to edit a message initialized with `Revert "$message'` as with Git
* We *will* show the status of the changes to be committed, e.g.:
```
# On branch master
# Changes to be committed:
#\tdeleted: foo
```
* submodule commits
* the revert command will generate only one commit in each submodule, no matter how many were introduced by the meta-repo commit being generated
* this commit will have the same commit message as that selected for the meta-repo

# Implementation

* Will add a new REVERT sequencer type
* Will be similar to cherry-pick in that we will write a sequencer entry in the meta-repo but not submodules
* `--continue` just fails if there are conflicts, and commits changed submodules otherwise -- nothing really to continue -- though be sure to fail if nothing is staged
* logic to apply to submodules:
* abort if commit to revert introduced URL-only changes (`CherryPickUtil.ensureNoURLChanges`)
* compute submodule changes via `exports.changeSubmodules`
* apply inverse of returned `simpleChanges` using `CherryPickUtil.changeSubmodules`
* for non-simple changes, generate the diff for `oldSha` to `newSha` and attempt to apply it to each submodule, opening if necessary
* this diff can be used along with `DiffUtil.getRepostatus` to obtain a `RepoStatus` object that can be used with `PrintStatusUtil` to obtain the text need for the commit message prompt
* see `CherryPickUtil.rewriteCommit` for more info

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.