This patch adds the possibility to delete a branch. It extends the branch user API so one can call someBranch.delete() and see the branch disappear from the rendered graph if it is not merged before.
Concretely, it clears out the branch name from the graph's branches property and from its refs. Commits and tags from the branch remain in the graph. Once a branch is deleted, the branch user API throws for the operations that don't make sense anymore. It is also impossible to delete a branch when it is checked out.
On the rendering side, only commits that are not reachable somehow disappear from view. This means that if the deleted branch was merged beforehand, the commits stay visible.
To the best of my understanding of the code, this change is compatible with previous use and behavior (notably, all tests pass without update). I also added tests and stories to cover what I added.
This patch adds the possibility to delete a branch. It extends the branch user API so one can call
someBranch.delete()
and see the branch disappear from the rendered graph if it is not merged before.Concretely, it clears out the branch name from the graph's
branches
property and from itsrefs
. Commits and tags from the branch remain in the graph. Once a branch is deleted, the branch user API throws for the operations that don't make sense anymore. It is also impossible to delete a branch when it is checked out.On the rendering side, only commits that are not reachable somehow disappear from view. This means that if the deleted branch was merged beforehand, the commits stay visible.
To the best of my understanding of the code, this change is compatible with previous use and behavior (notably, all tests pass without update). I also added tests and stories to cover what I added.
Closes #388