From 2837b33fb9c685703606051f2dbd9631c6e57b8a Mon Sep 17 00:00:00 2001 From: Pawel Lipski Date: Wed, 9 Aug 2023 09:44:15 +0200 Subject: [PATCH] Replace occurrences of `definition file` with `branch layout file` across the docs and code --- .circleci/config.yml | 6 +- RELEASE_NOTES.md | 3 +- blogs/git-machete-1/blog.md | 12 ++-- blogs/git-machete-2/blog.md | 12 ++-- blogs/git-machete-2/sandbox-setup-2.sh | 2 +- completion/git-machete.completion.zsh | 16 ++--- completion/git-machete.fish | 24 +++---- docs/man/git-machete.1 | 80 ++++++++++----------- docs/source/cli/add.rst | 6 +- docs/source/cli/anno.rst | 2 +- docs/source/cli/config.rst | 4 +- docs/source/cli/delete-unmanaged.rst | 2 +- docs/source/cli/diff.rst | 2 +- docs/source/cli/discover.rst | 8 +-- docs/source/cli/edit.rst | 6 +- docs/source/cli/file.rst | 2 +- docs/source/cli/fork-point.rst | 2 +- docs/source/cli/format.rst | 2 +- docs/source/cli/github.rst | 2 +- docs/source/cli/go.rst | 6 +- docs/source/cli/list.rst | 6 +- docs/source/cli/log.rst | 2 +- docs/source/cli/reapply.rst | 2 +- docs/source/cli/show.rst | 6 +- docs/source/cli/slide-out.rst | 2 +- docs/source/cli/squash.rst | 2 +- docs/source/cli/status.rst | 4 +- docs/source/cli/traverse.rst | 2 +- docs/source/short_docs.rst | 8 +-- git_machete/cli.py | 58 +++++++-------- git_machete/client.py | 98 +++++++++++++------------- git_machete/generated_docs.py | 78 ++++++++++---------- graphics/setup-sandbox | 2 +- requirements/coverage.txt | 2 +- tests/mockers.py | 2 +- tests/test_add.py | 14 ++-- tests/test_advance.py | 16 ++--- tests/test_anno.py | 4 +- tests/test_clean.py | 6 +- tests/test_client.py | 10 +-- tests/test_delete_unmanaged.py | 4 +- tests/test_discover.py | 10 +-- tests/test_file.py | 30 ++++---- tests/test_fork_point.py | 12 ++-- tests/test_github.py | 6 +- tests/test_github_anno_prs.py | 6 +- tests/test_github_checkout_prs.py | 10 +-- tests/test_github_create_pr.py | 28 ++++---- tests/test_github_retarget_pr.py | 18 ++--- tests/test_github_sync.py | 6 +- tests/test_go.py | 22 +++--- tests/test_is_managed.py | 4 +- tests/test_list.py | 4 +- tests/test_reapply.py | 4 +- tests/test_show.py | 18 ++--- tests/test_slide_out.py | 16 ++--- tests/test_status.py | 50 ++++++------- tests/test_traverse.py | 40 +++++------ tests/test_update.py | 20 +++--- tox.ini | 2 +- 60 files changed, 415 insertions(+), 418 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index af737bfe8..9bc7954b6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -357,8 +357,4 @@ workflows: - build and upload deb package to ppa - publish snap to the stable channel - # Note: there are also releases happening outside of our CI: - # 1) every time a commit is pushed to `develop` or `master`, a build for docs (`latest` or `stable` version, respectively) - # is triggered automatically via GitHub webhook on https://readthedocs.org/projects/git-machete/builds/, - # 2) every time a https://github.com/r-ryantm bot runs on NixOS/nixpkgs repository, - # Nix git-machete package is updated with the fresh version/package hash according to the data from PyPI. + # Note: there are also releases happening outside of our CI, see PACKAGES.md diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index d1db4ec98..42ab6df0a 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -2,7 +2,8 @@ ## New in git-machete 3.17.9 -- improved: documentation at ReadTheDocs +- improved: layout of documentation at ReadTheDocs +- improved: replaced `definition file` with `branch layout file` across the docs ## New in git-machete 3.17.8 diff --git a/blogs/git-machete-1/blog.md b/blogs/git-machete-1/blog.md index 802a5e2ab..1bc773ad7 100644 --- a/blogs/git-machete-1/blog.md +++ b/blogs/git-machete-1/blog.md @@ -50,7 +50,7 @@ Okey, let's get our hands dirty... first install `git-machete` with the sequence Once you have `git-machete` in your executable `PATH` (and thus git already recognizes the `machete` subcommand), let's specify how you would like to organize your branches — basically, what depends on what. Run `git machete edit` or simply open the `.git/machete` file with your favorite editor. -Paste the following "branch tree" definition: +Paste the following branch layout: ``` develop adjust-reads-prec @@ -147,7 +147,7 @@ Of course you'll still need to sync `edit-margin-not-allowed`, `full-load-gatlin As the cherry on top, let's now assume that you need to merge the `change-table` branch to `develop` as soon as possible and you can't wait for `adjust-reads-prec` and `block-cancel-order` to get merged first. Unfortunately, the two mentioned upstream branches introduced some nice helpers that you later used in `change-table`. -To make the process as painless as possible, let's modify the definition file with `git machete edit`: +To make the process as painless as possible, let's modify the branch layout file with `git machete edit`: ``` develop @@ -164,7 +164,7 @@ master ![git machete status](status-l-3.png) -When you modified the definition file, `git machete status` marked the edge between `develop` and `change-table` as yellow. +When you modified the branch layout file, `git machete status` marked the edge between `develop` and `change-table` as yellow. This means that the downstream branch (`change-table`) is still in sync with the upstream (`develop`), but the upstream branch tip isn't the fork point of the downstream branch. Translating from _git-ese_ to English, there are probably commits from some other branches on the way between `develop` and `change-table`; this is exactly the case now (there are indeed commits originating on `adjust-reads-prec` and `block-cancel-order`). @@ -190,8 +190,8 @@ This will compare the current working directory to the fork point commit of the You can also provide a branch parameter (`git machete diff `) to see the diff of the given branch against its fork point. `git machete add [--onto=] []` adds the specified branch (or the current one, if skipped) onto the given target upstream branch. -The same effect can also be achieved by editing the definition file `.git/machete` manually e.g. with `git machete edit`. -For example, if you run `git branch ignore-whitespace` and then `git machete add --onto=block-cancel-order ignore-whitespace`, you'll end up with the following definition file: +The same effect can also be achieved by editing the branch layout file `.git/machete` manually e.g. with `git machete edit`. +For example, if you run `git branch ignore-whitespace` and then `git machete add --onto=block-cancel-order ignore-whitespace`, you'll end up with the following branch layout file: ``` develop @@ -247,5 +247,5 @@ Anyway, the potentially undesired effects of `git machete` failing to find a cor More git-savvy users may argue that it should be enough to simply use the `--fork-point` option of `git rebase`, but the reality turns out to be harder than that. `git merge-base --fork-point` (and thus `git rebase` with the said option) only takes the reflog of the one provided upstream branch into account. -This works fine as long as nobody disturbs the structure of the tree in the definition file (i.e. the upstream branch of any branch doesn't change). +This works fine as long as nobody disturbs the structure of the tree in the branch layout file (i.e. the upstream branch of any branch doesn't change). Unfortunately, as mentioned before in this post, such tree structure modifications happen pretty often in real-life development, therefore a custom, more powerful way to find the fork point was necessary. diff --git a/blogs/git-machete-2/blog.md b/blogs/git-machete-2/blog.md index 9c927a0c8..f98c37289 100644 --- a/blogs/git-machete-2/blog.md +++ b/blogs/git-machete-2/blog.md @@ -24,7 +24,7 @@ This will serve as a dummy remote for the repo under `~/machete-sandbox`. More specifically, the script runs `git remote add origin ~/machete-sandbox-remote` from `~/machete-sandbox` directory so as to establish an actual local/remote relation between the repos, with similar push/pull capabilities that are available over HTTPS or SSH. -The initial structure of branches in the demo (i.e., the contents of the `.git/machete` definition file, excluding custom annotations that will be covered soon) is as follows: +The initial structure of branches in the demo (i.e., the contents of the `.git/machete` branch layout file, excluding custom annotations that will be covered soon) is as follows: ``` develop @@ -86,7 +86,7 @@ actually repeats pretty often in a daily work with `git machete`, especially whe To free yourself from thinking about what to check out/rebase/push next, you can turn to `git machete traverse` — a wizard that walks (or rather, traverses) the branch dependency tree and suggests what needs to be done to restore sync of branches with their parent branches and remotes. -Let's check out the `develop` branch (which is listed first in the definition file) and then iterate through the branches. +Let's check out the `develop` branch (which is listed first in the branch layout file) and then iterate through the branches. ![git machete traverse](traverse.png) @@ -131,7 +131,7 @@ The stderr output warns that `drop-constraint` isn't present in `.git/machete` a If you take a look at the `sandbox-setup-2.sh`, `drop-constraint` was indeed originally checked out from `call-ws`, even though the branches are no longer in commit-wise sync. Analogically, the `go up` subcommand checked out the inferred upstream. -Note that if `drop-constraint` was tracked in `.git/machete`, then the whole inference wouldn't happen since git machete would instead simply go for the upstream explicitly provided by the user in the definition file. +Note that if `drop-constraint` was tracked in `.git/machete`, then the whole inference wouldn't happen since git machete would instead simply go for the upstream explicitly provided by the user in the branch layout file. Also, the inference doesn't happen for any other `show`/`go` direction (like `down` or `next`) since that behavior could be pretty confusing and generally of little practical use. ### `update` @@ -140,7 +140,7 @@ Let's check out `drop-constraint` back again and, without changing anything in ` ![git machete update](update-3.png) -`update` couldn't find an entry for `drop-constraint` in the definition file, so it fell back to automatic inference. +`update` couldn't find an entry for `drop-constraint` in the branch layout file, so it fell back to automatic inference. ### `add` @@ -160,7 +160,7 @@ For demonstration purposes, let's now remove the `.git/machete` file (so as to m ![git machete discover](discover.png) `discover` gives the choice to either accept the discovered tree right away with `y[es]`, `e[dit]` it first, or reject it with `n[o]`. -In the case of `yes`/`edit`, the old definition file (if it already exists) will be saved under `.git/machete~` (note the added tilde). +In the case of `yes`/`edit`, the old branch layout file (if it already exists) will be saved under `.git/machete~` (note the added tilde). Under the hood, `discover` simply performed upstream inference (just as for `show up` etc.) for every single local branch independently, while applying some tricks (inspired by the [disjoint-set data structure](https://en.wikipedia.org/wiki/Disjoint-set_data_structure)) to make sure no cycles appear in the created graph. @@ -169,7 +169,7 @@ The only thing that obviously could not be inferred were custom annotations. Also, if the tree structure has been changed in the meantime (so that e.g. `develop` became a child of `call-ws` instead of the inverse), `discover` can't be expected to exactly guess the changed structure. The inference is based on git reflogs and doesn't know anything about the current or previous state of the `.git/machete` file. -At this point one can ask a question: why then is the definition file even needed since the upstreams could be always inferred on the fly? +At this point one can ask a question: why then is the branch layout file even needed since the upstreams could be always inferred on the fly? The argument against such an approach is that it wouldn't be desirable if everything in the tool happened automagically/behind the scenes. The developer should keep a sensible amount of control while still being provided with some hints when they're in doubt. It seems much more reasonable than the inverse — inferring everything that's possible and only asking the human when the tool is in doubt. diff --git a/blogs/git-machete-2/sandbox-setup-2.sh b/blogs/git-machete-2/sandbox-setup-2.sh index 6eb2936a1..daf815830 100755 --- a/blogs/git-machete-2/sandbox-setup-2.sh +++ b/blogs/git-machete-2/sandbox-setup-2.sh @@ -51,7 +51,7 @@ newb call-ws cmt Call web service cmt 1st round of fixes push -newb drop-constraint # not added to definition file +newb drop-constraint # not added to branch layout file cmt Drop unneeded SQL constraints git checkout call-ws cmt 2nd round of fixes diff --git a/completion/git-machete.completion.zsh b/completion/git-machete.completion.zsh index 21e13ad00..5f1480dc5 100644 --- a/completion/git-machete.completion.zsh +++ b/completion/git-machete.completion.zsh @@ -160,14 +160,14 @@ __git_machete_cmds=( 'advance:Fast-forward the current branch to match one of its downstreams and subsequently slide out this downstream' 'anno:Manage custom annotations' 'clean:Delete untracked and unmanaged branches and optionally check out open GitHub PRs' - 'delete-unmanaged:Delete local branches that are not present in the definition file' + 'delete-unmanaged:Delete local branches that are not present in the branch layout file' {diff,d}':Diff current working directory or a given branch against its fork point' 'discover:Automatically discover tree of branch dependencies' - {edit,e}':Edit the definition file' - 'file:Display the location of the definition file' + {edit,e}':Edit the branch layout file' + 'file:Display the location of the branch layout file' 'fork-point:Display hash of the fork point commit of a branch' {go,g}':Check out the branch relative to the position of the current branch' - 'github:Creates, checks out and manages GitHub PRs while keeping them reflected in branch definition file' + 'github:Creates, checks out and manages GitHub PRs while keeping them reflected in branch layout file' 'help:Display this overview, or detailed help for a specified command' 'is-managed:Check if the current branch is managed by git-machete (mostly for scripts)' 'list:List all branches that fall into one of pre-defined categories (mostly for internal use)' @@ -191,7 +191,7 @@ __git_machete_help_topics() { set -A topics ${__git_machete_cmds} topics+=( 'config:Docs for the configuration keys and environment variables' - 'format:Format of the .git/machete definition file' + 'format:Format of the .git/machete branch layout file' 'hooks:Display docs for the extra hooks added by git machete' ) _describe -t topics 'git machete help topic' topics "$@" @@ -278,12 +278,12 @@ __git_machete_categories() { local categories # TODO (#115): complete slidable-after's argument categories=( - 'addable:all branches (local or remote) than can be added to the definition file' + 'addable:all branches (local or remote) than can be added to the branch layout file' 'childless:all branches that do not possess child branches' - 'managed:all branches that appear in the definition file' + 'managed:all branches that appear in the branch layout file' 'slidable:all managed branches that have exactly one upstream and one downstream (i.e. the ones that can be slid out with slide-out command)' 'slidable-after:the downstream branch of the given branch, if it exists and is its only downstream (i.e. the one that can be slid out immediately following )' - 'unmanaged:all local branches that do not appear in the definition file' + 'unmanaged:all local branches that do not appear in the branch layout file' 'with-overridden-fork-point:all local branches that have a fork point override config' ) _describe -t categories 'category' categories "$@" diff --git a/completion/git-machete.fish b/completion/git-machete.fish index bb0c869b0..4ab7d7e7e 100644 --- a/completion/git-machete.fish +++ b/completion/git-machete.fish @@ -42,7 +42,7 @@ complete -c git-machete -n "__fish_seen_subcommand_from clean; and not __fish_se # git machete delete-unmanaged -complete -c git-machete -n "not __fish_seen_subcommand_from $__mcht_commands" -f -a delete-unmanaged -d 'Delete local branches that are not present in the definition file' +complete -c git-machete -n "not __fish_seen_subcommand_from $__mcht_commands" -f -a delete-unmanaged -d 'Delete local branches that are not present in the branch layout file' complete -c git-machete -n "__fish_seen_subcommand_from delete-unmanaged; and not __fish_seen_subcommand_from --yes -y" -f -l yes -s y -d 'Don\'t ask for confirmation' # git machete discover @@ -57,10 +57,10 @@ complete -c git-machete -n "not __fish_seen_subcommand_from $__mcht_commands" complete -c git-machete -n "__fish_seen_subcommand_from diff d; and not __fish_seen_subcommand_from --stat -s" -f -l stat -s s -d 'Makes git machete diff pass --stat option to git diff, so that only summary (diffstat) is printed' # git machete edit -complete -c git-machete -n "not __fish_seen_subcommand_from $__mcht_commands" -f -a edit -d 'Edit the definition file' +complete -c git-machete -n "not __fish_seen_subcommand_from $__mcht_commands" -f -a edit -d 'Edit the branch layout file' # git machete file -complete -c git-machete -n "not __fish_seen_subcommand_from $__mcht_commands" -f -a file -d 'Display the location of the definition file' +complete -c git-machete -n "not __fish_seen_subcommand_from $__mcht_commands" -f -a file -d 'Display the location of the branch layout file' # git machete fork-point complete -c git-machete -n "not __fish_seen_subcommand_from $__mcht_commands" -f -a fork-point -d 'Display or override fork point for a branch' @@ -93,9 +93,9 @@ complete -c git-machete -n "__fish_seen_subcommand_from github; and __fish_seen_ complete -c git-machete -n "not __fish_seen_subcommand_from $__mcht_commands" -f -a go -d 'Check out the branch relative to the position of the current branch, accepts down/first/last/next/root/prev/up argument' complete -c git-machete -n "__fish_seen_subcommand_from go g; and not __fish_seen_subcommand_from down d first f last l next n prev p root r up u" -f -a down -d 'the direct children/downstream branch of the current branch' complete -c git-machete -n "__fish_seen_subcommand_from go g; and not __fish_seen_subcommand_from down d first f last l next n prev p root r up u" -f -a first -d 'the first downstream of the root branch of the current branch (like root followed by next), or the root branch itself if the root has no downstream branches' -complete -c git-machete -n "__fish_seen_subcommand_from go g; and not __fish_seen_subcommand_from down d first f last l next n prev p root r up u" -f -a last -d 'the last branch in the definition file that has the same root as the current branch; can be the root branch itself if the root has no downstream branches' -complete -c git-machete -n "__fish_seen_subcommand_from go g; and not __fish_seen_subcommand_from down d first f last l next n prev p root r up u" -f -a next -d 'the direct successor of the current branch in the definition file' -complete -c git-machete -n "__fish_seen_subcommand_from go g; and not __fish_seen_subcommand_from down d first f last l next n prev p root r up u" -f -a prev -d 'the direct predecessor of the current branch in the definition file' +complete -c git-machete -n "__fish_seen_subcommand_from go g; and not __fish_seen_subcommand_from down d first f last l next n prev p root r up u" -f -a last -d 'the last branch in the branch layout file that has the same root as the current branch; can be the root branch itself if the root has no downstream branches' +complete -c git-machete -n "__fish_seen_subcommand_from go g; and not __fish_seen_subcommand_from down d first f last l next n prev p root r up u" -f -a next -d 'the direct successor of the current branch in the branch layout file' +complete -c git-machete -n "__fish_seen_subcommand_from go g; and not __fish_seen_subcommand_from down d first f last l next n prev p root r up u" -f -a prev -d 'the direct predecessor of the current branch in the branch layout file' complete -c git-machete -n "__fish_seen_subcommand_from go g; and not __fish_seen_subcommand_from down d first f last l next n prev p root r up u" -f -a root -d 'the root of the tree where the current branch is located. Note: this will typically be something like develop or master, since all branches are usually meant to be ultimately merged to one of those' complete -c git-machete -n "__fish_seen_subcommand_from go g; and not __fish_seen_subcommand_from down d first f last l next n prev p root r up u" -f -a up -d 'the direct parent/upstream branch of the current branch' @@ -111,12 +111,12 @@ complete -c git-machete -n "__fish_seen_subcommand_from is-managed" -f # git machete list complete -c git-machete -n "not __fish_seen_subcommand_from $__mcht_commands" -f -a list -d 'List all branches that fall into one of pre-defined categories (mostly for internal use)' complete -c git-machete -n "__fish_seen_subcommand_from list; and not __fish_seen_subcommand_from addable childless managed slidable slidable-after unmanaged with-overridden-fork-point" -f -a addable -complete -c git-machete -n "__fish_seen_subcommand_from list; and not __fish_seen_subcommand_from addable childless managed slidable slidable-after unmanaged with-overridden-fork-point" -f -a childless -d 'all branches (local or remote) than can be added to the definition file' -complete -c git-machete -n "__fish_seen_subcommand_from list; and not __fish_seen_subcommand_from addable childless managed slidable slidable-after unmanaged with-overridden-fork-point" -f -a managed -d 'all branches that appear in the definition file' +complete -c git-machete -n "__fish_seen_subcommand_from list; and not __fish_seen_subcommand_from addable childless managed slidable slidable-after unmanaged with-overridden-fork-point" -f -a childless -d 'all branches (local or remote) than can be added to the branch layout file' +complete -c git-machete -n "__fish_seen_subcommand_from list; and not __fish_seen_subcommand_from addable childless managed slidable slidable-after unmanaged with-overridden-fork-point" -f -a managed -d 'all branches that appear in the branch layout file' complete -c git-machete -n "__fish_seen_subcommand_from list; and not __fish_seen_subcommand_from addable childless managed slidable slidable-after unmanaged with-overridden-fork-point" -f -a slidable -d 'all managed branches that have an upstream and can be slid out with slide-out command' complete -c git-machete -n "__fish_seen_subcommand_from list; and not __fish_seen_subcommand_from addable childless managed slidable slidable-after unmanaged with-overridden-fork-point" -f -a slidable-after -d 'the downstream branch of the , if it exists and is the only downstream of (i.e. the one that can be slid out immediately following )' complete -c git-machete -n "__fish_seen_subcommand_from list; and __fish_seen_subcommand_from slidable-after" -f -a '(__fish_git_local_branches)' -complete -c git-machete -n "__fish_seen_subcommand_from list; and not __fish_seen_subcommand_from addable childless managed slidable slidable-after unmanaged with-overridden-fork-point" -f -a unmanaged -d 'all local branches that don\'t appear in the definition file' +complete -c git-machete -n "__fish_seen_subcommand_from list; and not __fish_seen_subcommand_from addable childless managed slidable slidable-after unmanaged with-overridden-fork-point" -f -a unmanaged -d 'all local branches that don\'t appear in the branch layout file' complete -c git-machete -n "__fish_seen_subcommand_from list; and not __fish_seen_subcommand_from addable childless managed slidable slidable-after unmanaged with-overridden-fork-point" -f -a with-overridden-fork-point -d 'all local branches that have a fork point override set up (even if this override does not affect the location of their fork point anymore).' # git machete log @@ -132,9 +132,9 @@ complete -c git-machete -n "not __fish_seen_subcommand_from $__mcht_commands" -f complete -c git-machete -n "__fish_seen_subcommand_from show; and not __fish_seen_subcommand_from current c down d first f last l next n prev p root r up u" -f -a 'current c' -d 'the current branch; exits with a non-zero status if none (detached HEAD)' complete -c git-machete -n "__fish_seen_subcommand_from show; and not __fish_seen_subcommand_from current c down d first f last l next n prev p root r up u" -f -a 'down d' -d 'the direct children/downstream branch of the given branch' complete -c git-machete -n "__fish_seen_subcommand_from show; and not __fish_seen_subcommand_from current c down d first f last l next n prev p root r up u" -f -a 'first f' -d 'the first downstream of the root branch of the given branch (like root followed by next), or the root branch itself if the root has no downstream branches' -complete -c git-machete -n "__fish_seen_subcommand_from show; and not __fish_seen_subcommand_from current c down d first f last l next n prev p root r up u" -f -a 'last l' -d 'the last branch in the definition file that has the same root as the given branch; can be the root branch itself if the root has no downstream branches' -complete -c git-machete -n "__fish_seen_subcommand_from show; and not __fish_seen_subcommand_from current c down d first f last l next n prev p root r up u" -f -a 'next n' -d 'the direct successor of the given branch in the definition file' -complete -c git-machete -n "__fish_seen_subcommand_from show; and not __fish_seen_subcommand_from current c down d first f last l next n prev p root r up u" -f -a 'prev p' -d 'the direct predecessor of the given branch in the definition file' +complete -c git-machete -n "__fish_seen_subcommand_from show; and not __fish_seen_subcommand_from current c down d first f last l next n prev p root r up u" -f -a 'last l' -d 'the last branch in the branch layout file that has the same root as the given branch; can be the root branch itself if the root has no downstream branches' +complete -c git-machete -n "__fish_seen_subcommand_from show; and not __fish_seen_subcommand_from current c down d first f last l next n prev p root r up u" -f -a 'next n' -d 'the direct successor of the given branch in the branch layout file' +complete -c git-machete -n "__fish_seen_subcommand_from show; and not __fish_seen_subcommand_from current c down d first f last l next n prev p root r up u" -f -a 'prev p' -d 'the direct predecessor of the given branch in the branch layout file' complete -c git-machete -n "__fish_seen_subcommand_from show; and not __fish_seen_subcommand_from current c down d first f last l next n prev p root r up u" -f -a 'root r' -d 'the root of the tree where the given branch is located' complete -c git-machete -n "__fish_seen_subcommand_from show; and not __fish_seen_subcommand_from current c down d first f last l next n prev p root r up u" -f -a 'up u' -d 'the direct parent/upstream branch of the given branch' diff --git a/docs/man/git-machete.1 b/docs/man/git-machete.1 index fba611b59..ceb29fe44 100644 --- a/docs/man/git-machete.1 +++ b/docs/man/git-machete.1 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "GIT-MACHETE" "1" "Aug 07, 2023" "" "git-machete" +.TH "GIT-MACHETE" "1" "Aug 09, 2023" "" "git-machete" .SH NAME git-machete \- git-machete 3.17.9 .sp @@ -68,19 +68,19 @@ git machete commands and help topics: .IP \(bu 2 \fI\%config\fP \-\- Display docs for the git machete configuration keys and environment variables .IP \(bu 2 -\fI\%delete\-unmanaged\fP \-\- Delete local branches that are not present in the definition file +\fI\%delete\-unmanaged\fP \-\- Delete local branches that are not present in the branch layout file .IP \(bu 2 \fI\%diff\fP \-\- Diff current working directory or a given branch against its computed fork point .IP \(bu 2 \fI\%discover\fP \-\- Automatically discover tree of branch dependencies .IP \(bu 2 -\fI\%edit\fP \-\- Edit the definition file +\fI\%edit\fP \-\- Edit the branch layout file .IP \(bu 2 -\fI\%file\fP \-\- Display the location of the definition file +\fI\%file\fP \-\- Display the location of the branch layout file .IP \(bu 2 \fI\%fork\-point\fP \-\- Display or override fork point for a branch .IP \(bu 2 -\fI\%format\fP \-\- Display docs for the format of the definition file +\fI\%format\fP \-\- Display docs for the format of the branch layout file .IP \(bu 2 \fI\%github\fP \-\- Create, check out and manage GitHub PRs while keeping them reflected in git machete .IP \(bu 2 @@ -126,7 +126,7 @@ git machete add [\-o|\-\-onto=] [\-R|\-\-as\-root] [\- .UNINDENT .UNINDENT .sp -Adds the provided (or the current branch, if none specified) to the definition file. +Adds the provided (or the current branch, if none specified) to the branch layout file. If is provided but no local branch with the given name exists: .INDENT 0.0 .INDENT 3.5 @@ -140,12 +140,12 @@ otherwise, user is asked whether it should be created as a new local branch. .UNINDENT .UNINDENT .sp -If the definition file is empty or \fB\-R/\-\-as\-root\fP is provided, the branch will be added as a root of the tree of branch dependencies. +If the branch layout file is empty or \fB\-R/\-\-as\-root\fP is provided, the branch will be added as a root of the tree of branch dependencies. Otherwise, the desired upstream (parent) branch can be specified with \fB\-o/\-\-onto\fP\&. Neither of these options is mandatory, however; if both are skipped, git machete will try to automatically infer the target upstream. If the upstream branch can be inferred, the user will be presented with inferred branch and asked to confirm. .sp -Note: all the effects of \fBadd\fP (except git branch creation) can as well be achieved by manually editing the definition file. +Note: all the effects of \fBadd\fP (except git branch creation) can as well be achieved by manually editing the branch layout file. .sp \fBOptions:\fP .INDENT 0.0 @@ -362,7 +362,7 @@ If multiple \(aqs are passed to the command, they are concatena .sp Note: \fBanno\fP command is able to overwrite existing branch qualifiers. .sp -Note: all the effects of \fBanno\fP can be always achieved by manually editing the definition file. +Note: all the effects of \fBanno\fP can be always achieved by manually editing the branch layout file. .sp \fBOptions:\fP .INDENT 0.0 @@ -478,10 +478,10 @@ Configuration key value can be overridden by the presence of the \fB\-\-push\fP .UNINDENT .TP .B \fBmachete.worktree.useTopLevelMacheteFile\fP: -The default value of this key is \fBtrue\fP, which means that the path to machete definition file will be \fB\&.git/machete\fP +The default value of this key is \fBtrue\fP, which means that the path to branch layout file will be \fB\&.git/machete\fP for both regular directory and worktree. .sp -If you want the worktree to have its own machete definition file (located under \fB\&.git/worktrees/.../machete\fP), +If you want the worktree to have its own branch layout file (located under \fB\&.git/worktrees/.../machete\fP), set \fBgit config machete.worktree.useTopLevelMacheteFile false\fP\&. .UNINDENT .sp @@ -637,7 +637,7 @@ git machete delete\-unmanaged [\-y|\-\-yes] .UNINDENT .UNINDENT .sp -Goes one\-by\-one through all the local git branches that don\(aqt exist in the definition file, +Goes one\-by\-one through all the local git branches that don\(aqt exist in the branch layout file, and ask to delete each of them (with \fBgit branch \-d\fP or \fBgit branch \-D\fP) if confirmed by user. No branch will be deleted unless explicitly confirmed by the user (or unless \fB\-y/\-\-yes\fP option is passed). .sp @@ -669,7 +669,7 @@ Runs \fBgit diff\fP of the given branch tip against its fork point or, if none s of the current working tree against the fork point of the currently checked out branch. See help for \fI\%fork\-point\fP for more details on the meaning of \fIfork point\fP\&. .sp -Note: the branch in question does not need to occur in the definition file. +Note: the branch in question does not need to occur in the branch layout file. .sp \fBOptions:\fP .INDENT 0.0 @@ -691,11 +691,11 @@ git machete discover [\-C|\-\-checked\-out\-since=] [\-l|\-\-list\-commits .UNINDENT .UNINDENT .sp -Discovers and displays tree of branch dependencies using a heuristic based on reflogs and asks whether to overwrite the existing definition -\fI\%file\fP with the new discovered tree. -If confirmed with a \fBy[es]\fP or \fBe[dit]\fP reply, backs up the current definition file (if it exists) as \fB$GIT_DIR/machete~\fP +Discovers and displays tree of branch dependencies using a heuristic based on reflogs +and asks whether to overwrite the existing branch layout \fI\%file\fP with the new discovered tree. +If confirmed with a \fBy[es]\fP or \fBe[dit]\fP reply, backs up the current branch layout file (if it exists) as \fB$GIT_DIR/machete~\fP and saves the new tree under the usual \fB$GIT_DIR/machete\fP path. -If the reply was \fBe[dit]\fP, additionally an editor is opened (as in: \fBgit machete\fP \fI\%edit\fP) after saving the new definition file. +If the reply was \fBe[dit]\fP, additionally an editor is opened (as in: \fBgit machete\fP \fI\%edit\fP) after saving the new branch layout file. \fBdiscover\fP retains the existing branch qualifiers used by \fBgit machete traverse\fP (see help for \fI\%traverse\fP). .sp \fBOptions:\fP @@ -733,7 +733,7 @@ git machete e[dit] .UNINDENT .UNINDENT .sp -Opens an editor and lets you edit the definition file manually. +Opens an editor and lets you edit the branch layout file manually. .sp The editor is determined by checking up the following locations: .INDENT 0.0 @@ -761,10 +761,10 @@ The editor is determined by checking up the following locations: .sp and selecting the first one that is defined and points to an executable file accessible on \fBPATH\fP\&. .sp -Note that the above editor selection only applies for editing the definition file, +Note that the above editor selection only applies for editing the branch layout file, but not for any other actions that may be indirectly triggered by git machete, including editing of rebase TODO list, commit messages etc. .sp -The definition file can be always accessed and edited directly under the path returned by \fBgit machete file\fP +The branch layout file can be always accessed and edited directly under the path returned by \fBgit machete file\fP (usually \fB\&.git/machete\fP, unless worktrees or submodules are involved). .sp \fBEnvironment variables:\fP @@ -787,7 +787,7 @@ git machete file .UNINDENT .UNINDENT .sp -Outputs the absolute path of machete definition file. +Outputs the absolute path of branch layout file. The file is always called \fBmachete\fP and is located in the git directory of the project. .sp Three cases are possible: @@ -828,7 +828,7 @@ git machete fork\-point \-\-unset\-override [] .UNINDENT .sp Note: in all three forms, if no \fB\fP is specified, the currently checked out branch is assumed. -The branch in question does not need to occur in the definition file. +The branch in question does not need to occur in the branch layout file. .sp Without any option, displays full hash of the fork point commit for the \fB\fP\&. Fork point of the given \fB\fP is the commit at which the history of the \fB\fP diverges from history of any other branch. @@ -887,7 +887,7 @@ even if the overridden fork point of \fBB\fP is NOT equal to the commit pointed .sp Note: there is no \fBgit machete format\fP command as such; \fBformat\fP is just a topic of \fBgit machete help\fP\&. .sp -The format of the definition file should be as follows: +The format of the branch layout file should be as follows: .INDENT 0.0 .INDENT 3.5 .sp @@ -934,7 +934,7 @@ git machete github .sp where \fB\fP is one of: \fBanno\-prs\fP, \fBcheckout\-prs\fP, \fBcreate\-pr\fP, \fBretarget\-pr\fP\&. .sp -Creates, checks out and manages GitHub PRs while keeping them reflected in branch definition file. +Creates, checks out and manages GitHub PRs while keeping them reflected in branch layout file. .sp \fBNOTE:\fP .INDENT 0.0 @@ -1126,12 +1126,12 @@ Checks out the branch specified by the given direction relative to the current b \fBfirst\fP: the first downstream of the root branch of the current branch (like \fBroot\fP followed by \fBnext\fP), or the root branch itself if the root has no downstream branches. .IP \(bu 2 -\fBlast\fP: the last branch in the definition file that has the same root as the current branch; +\fBlast\fP: the last branch in the branch layout file that has the same root as the current branch; can be the root branch itself if the root has no downstream branches. .IP \(bu 2 -\fBnext\fP: the direct successor of the current branch in the definition file. +\fBnext\fP: the direct successor of the current branch in the branch layout file. .IP \(bu 2 -\fBprev\fP: the direct predecessor of the current branch in the definition file. +\fBprev\fP: the direct predecessor of the current branch in the branch layout file. .IP \(bu 2 \fBroot\fP: the root of the tree where the current branch is located. Note: this will typically be something like \fBdevelop\fP or \fBmaster\fP, @@ -1300,18 +1300,18 @@ Lists all branches that fall into one of the specified categories: .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 -\fBaddable\fP: all branches (local or remote) than can be added to the definition file, +\fBaddable\fP: all branches (local or remote) than can be added to the branch layout file, .IP \(bu 2 \fBchildless\fP: all managed branches that do not possess child branches, .IP \(bu 2 -\fBmanaged\fP: all branches that appear in the definition file, +\fBmanaged\fP: all branches that appear in the branch layout file, .IP \(bu 2 \fBslidable\fP: all managed branches that have an upstream and can be slid out with \fI\%slide\-out\fP command .IP \(bu 2 \fBslidable\-after \fP: the downstream branch of the , if it exists and is the only downstream of (i.e. the one that can be slid out immediately following ), .IP \(bu 2 -\fBunmanaged\fP: all local branches that don\(aqt appear in the definition file, +\fBunmanaged\fP: all local branches that don\(aqt appear in the branch layout file, .IP \(bu 2 \fBwith\-overridden\-fork\-point\fP: all local branches that have a \fI\%fork point\fP override set up (even if this override does not affect the location of their fork point anymore). @@ -1337,7 +1337,7 @@ git machete l[og] [] Runs \fBgit log\fP for the range of commits from tip of the given branch (or current branch, if none specified) back to its fork point. See help for \fI\%fork\-point\fP for more details on meaning of the \fIfork point\fP\&. .sp -Note: the branch in question does not need to occur in the definition file. +Note: the branch in question does not need to occur in the branch layout file. .SH REAPPLY .sp \fBUsage:\fP @@ -1357,7 +1357,7 @@ The chunk of the history to be rebased starts at the automatically computed fork but can also be set explicitly by \fB\-\-fork\-point\fP\&. See help for \fI\%fork\-point\fP for more details on meaning of the \fIfork point\fP\&. .sp -Note: the current reapplied branch does not need to occur in the definition file. +Note: the current reapplied branch does not need to occur in the branch layout file. .sp Tip: \fBreapply\fP can be used for squashing the commits on the current branch to make history more condensed before push to the remote, but there is also dedicated \fBsquash\fP command that achieves the same goal without running \fBgit rebase\fP\&. @@ -1405,12 +1405,12 @@ Outputs name of the branch (or possibly multiple branches, in case of \fBdown\fP \fBfirst\fP: the first downstream of the root branch of the given branch (like \fBroot\fP followed by \fBnext\fP), or the root branch itself if the root has no downstream branches. .IP \(bu 2 -\fBlast\fP: the last branch in the definition file that has the same root as the given branch; can be the root branch itself +\fBlast\fP: the last branch in the branch layout file that has the same root as the given branch; can be the root branch itself if the root has no downstream branches. .IP \(bu 2 -\fBnext\fP: the direct successor of the given branch in the definition file. +\fBnext\fP: the direct successor of the given branch in the branch layout file. .IP \(bu 2 -\fBprev\fP: the direct predecessor of the given branch in the definition file. +\fBprev\fP: the direct predecessor of the given branch in the branch layout file. .IP \(bu 2 \fBroot\fP: the root of the tree where the given branch is located. Note: this will typically be something like \fBdevelop\fP or \fBmaster\fP, @@ -1434,7 +1434,7 @@ git machete slide\-out [\-d|\-\-down\-fork\-point=] [ .UNINDENT .UNINDENT .sp -Removes the given branch (or multiple branches) from the branch tree definition. If no branch has been specified current branch is assumed as the only branch. +Removes the given branch (or multiple branches) from the branch layout. If no branch has been specified current branch is assumed as the only branch. Then synchronizes the downstream (child) branches of the last specified branch on the top of the upstream (parent) branch of the first specified branch. Sync is performed either by rebase (default) or by merge (if \fB\-\-merge\fP option passed). .sp @@ -1545,7 +1545,7 @@ but can also be set explicitly by \fB\-\-fork\-point\fP\&. See help for \fI\%fork\-point\fP for more details on meaning of the \fIfork point\fP\&. The message for the squashed is taken from the earliest squashed commit, i.e. the commit directly following the fork point. .sp -Note: the current squashed branch does not need to occur in the definition file. +Note: the current squashed branch does not need to occur in the branch layout file. .sp Tip: \fBsquash\fP does NOT run \fBgit rebase\fP under the hood. For more complex scenarios that require rewriting the history of current branch, see \fBreapply\fP and \fBupdate\fP\&. .sp @@ -1569,9 +1569,9 @@ git machete s[tatus] [\-\-color=WHEN] [\-l|\-\-list\-commits] [\-L|\-\-list\-com .UNINDENT .UNINDENT .sp -Displays a tree\-shaped status of the branches listed in the definition file. +Displays a tree\-shaped status of the branches listed in the branch layout file. .sp -Apart from simply ASCII\-formatting the definition file, this also: +Apart from simply ASCII\-formatting the branch layout file, this also: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 @@ -1721,7 +1721,7 @@ git machete t[raverse] [\-F|\-\-fetch] [\-l|\-\-list\-commits] [\-M|\-\-merge] .UNINDENT .UNINDENT .sp -Traverses the branch tree in pre\-order (i.e. simply in the order as they occur in the definition file). +Traverses the branch tree in pre\-order (i.e. simply in the order as they occur in the branch layout file). By default \fBtraverse\fP starts from the current branch. This behavior can, however, be customized using options: \fB\-\-start\-from=\fP, \fB\-\-whole\fP or \fB\-w\fP, \fB\-W\fP\&. .sp diff --git a/docs/source/cli/add.rst b/docs/source/cli/add.rst index 6a60a59f8..15fbcddce 100644 --- a/docs/source/cli/add.rst +++ b/docs/source/cli/add.rst @@ -8,19 +8,19 @@ add git machete add [-o|--onto=] [-R|--as-root] [-y|--yes] [] -Adds the provided (or the current branch, if none specified) to the definition file. +Adds the provided (or the current branch, if none specified) to the branch layout file. If is provided but no local branch with the given name exists: * if a remote branch of the same name exists in exactly one remote, then user is asked whether to check out this branch locally (as in ``git checkout``), * otherwise, user is asked whether it should be created as a new local branch. -If the definition file is empty or ``-R/--as-root`` is provided, the branch will be added as a root of the tree of branch dependencies. +If the branch layout file is empty or ``-R/--as-root`` is provided, the branch will be added as a root of the tree of branch dependencies. Otherwise, the desired upstream (parent) branch can be specified with ``-o/--onto``. Neither of these options is mandatory, however; if both are skipped, git machete will try to automatically infer the target upstream. If the upstream branch can be inferred, the user will be presented with inferred branch and asked to confirm. -Note: all the effects of ``add`` (except git branch creation) can as well be achieved by manually editing the definition file. +Note: all the effects of ``add`` (except git branch creation) can as well be achieved by manually editing the branch layout file. **Options:** diff --git a/docs/source/cli/anno.rst b/docs/source/cli/anno.rst index 754f097f0..1e57964ef 100644 --- a/docs/source/cli/anno.rst +++ b/docs/source/cli/anno.rst @@ -33,7 +33,7 @@ If multiple 's are passed to the command, they are concatenated Note: ``anno`` command is able to overwrite existing branch qualifiers. -Note: all the effects of ``anno`` can be always achieved by manually editing the definition file. +Note: all the effects of ``anno`` can be always achieved by manually editing the branch layout file. **Options:** diff --git a/docs/source/cli/config.rst b/docs/source/cli/config.rst index b189c8d1b..f6c17f7e0 100644 --- a/docs/source/cli/config.rst +++ b/docs/source/cli/config.rst @@ -31,10 +31,10 @@ Note: ``config`` is not a command as such, just a help topic (there is no ``git :start-line: 2 ``machete.worktree.useTopLevelMacheteFile``: - The default value of this key is ``true``, which means that the path to machete definition file will be ``.git/machete`` + The default value of this key is ``true``, which means that the path to branch layout file will be ``.git/machete`` for both regular directory and worktree. - If you want the worktree to have its own machete definition file (located under ``.git/worktrees/.../machete``), + If you want the worktree to have its own branch layout file (located under ``.git/worktrees/.../machete``), set ``git config machete.worktree.useTopLevelMacheteFile false``. diff --git a/docs/source/cli/delete-unmanaged.rst b/docs/source/cli/delete-unmanaged.rst index 6b6ab04ee..627412cbb 100644 --- a/docs/source/cli/delete-unmanaged.rst +++ b/docs/source/cli/delete-unmanaged.rst @@ -8,7 +8,7 @@ delete-unmanaged git machete delete-unmanaged [-y|--yes] -Goes one-by-one through all the local git branches that don't exist in the definition file, +Goes one-by-one through all the local git branches that don't exist in the branch layout file, and ask to delete each of them (with ``git branch -d`` or ``git branch -D``) if confirmed by user. No branch will be deleted unless explicitly confirmed by the user (or unless ``-y/--yes`` option is passed). diff --git a/docs/source/cli/diff.rst b/docs/source/cli/diff.rst index 12ccf0932..af37551c7 100644 --- a/docs/source/cli/diff.rst +++ b/docs/source/cli/diff.rst @@ -12,7 +12,7 @@ Runs ``git diff`` of the given branch tip against its fork point or, if none spe of the current working tree against the fork point of the currently checked out branch. See help for :ref:`fork-point` for more details on the meaning of *fork point*. -Note: the branch in question does not need to occur in the definition file. +Note: the branch in question does not need to occur in the branch layout file. **Options:** diff --git a/docs/source/cli/discover.rst b/docs/source/cli/discover.rst index a92b4b9b4..ca6c009b0 100644 --- a/docs/source/cli/discover.rst +++ b/docs/source/cli/discover.rst @@ -8,11 +8,11 @@ discover git machete discover [-C|--checked-out-since=] [-l|--list-commits] [-r|--roots=,,...] [-y|--yes] -Discovers and displays tree of branch dependencies using a heuristic based on reflogs and asks whether to overwrite the existing definition -:ref:`file` with the new discovered tree. -If confirmed with a ``y[es]`` or ``e[dit]`` reply, backs up the current definition file (if it exists) as ``$GIT_DIR/machete~`` +Discovers and displays tree of branch dependencies using a heuristic based on reflogs +and asks whether to overwrite the existing branch layout :ref:`file` with the new discovered tree. +If confirmed with a ``y[es]`` or ``e[dit]`` reply, backs up the current branch layout file (if it exists) as ``$GIT_DIR/machete~`` and saves the new tree under the usual ``$GIT_DIR/machete`` path. -If the reply was ``e[dit]``, additionally an editor is opened (as in: ``git machete`` :ref:`edit`) after saving the new definition file. +If the reply was ``e[dit]``, additionally an editor is opened (as in: ``git machete`` :ref:`edit`) after saving the new branch layout file. ``discover`` retains the existing branch qualifiers used by ``git machete traverse`` (see help for :ref:`traverse`). **Options:** diff --git a/docs/source/cli/edit.rst b/docs/source/cli/edit.rst index 6643be4b6..a2623a18e 100644 --- a/docs/source/cli/edit.rst +++ b/docs/source/cli/edit.rst @@ -8,7 +8,7 @@ edit git machete e[dit] -Opens an editor and lets you edit the definition file manually. +Opens an editor and lets you edit the branch layout file manually. The editor is determined by checking up the following locations: @@ -23,10 +23,10 @@ The editor is determined by checking up the following locations: and selecting the first one that is defined and points to an executable file accessible on ``PATH``. -Note that the above editor selection only applies for editing the definition file, +Note that the above editor selection only applies for editing the branch layout file, but not for any other actions that may be indirectly triggered by git machete, including editing of rebase TODO list, commit messages etc. -The definition file can be always accessed and edited directly under the path returned by ``git machete file`` +The branch layout file can be always accessed and edited directly under the path returned by ``git machete file`` (usually ``.git/machete``, unless worktrees or submodules are involved). **Environment variables:** diff --git a/docs/source/cli/file.rst b/docs/source/cli/file.rst index 54412fc2d..6589c726f 100644 --- a/docs/source/cli/file.rst +++ b/docs/source/cli/file.rst @@ -8,7 +8,7 @@ file git machete file -Outputs the absolute path of machete definition file. +Outputs the absolute path of branch layout file. The file is always called ``machete`` and is located in the git directory of the project. Three cases are possible: diff --git a/docs/source/cli/fork-point.rst b/docs/source/cli/fork-point.rst index 4a09f1596..22926bd0d 100644 --- a/docs/source/cli/fork-point.rst +++ b/docs/source/cli/fork-point.rst @@ -20,7 +20,7 @@ fork-point git machete fork-point --unset-override [] Note: in all three forms, if no ```` is specified, the currently checked out branch is assumed. -The branch in question does not need to occur in the definition file. +The branch in question does not need to occur in the branch layout file. Without any option, displays full hash of the fork point commit for the ````. diff --git a/docs/source/cli/format.rst b/docs/source/cli/format.rst index b93e0cd24..aff39bb99 100644 --- a/docs/source/cli/format.rst +++ b/docs/source/cli/format.rst @@ -4,7 +4,7 @@ format ====== Note: there is no ``git machete format`` command as such; ``format`` is just a topic of ``git machete help``. -The format of the definition file should be as follows: +The format of the branch layout file should be as follows: .. code-block:: diff --git a/docs/source/cli/github.rst b/docs/source/cli/github.rst index 231970f00..c3b921184 100644 --- a/docs/source/cli/github.rst +++ b/docs/source/cli/github.rst @@ -10,7 +10,7 @@ github where ```` is one of: ``anno-prs``, ``checkout-prs``, ``create-pr``, ``retarget-pr``. -Creates, checks out and manages GitHub PRs while keeping them reflected in branch definition file. +Creates, checks out and manages GitHub PRs while keeping them reflected in branch layout file. .. include:: github_api_access.rst .. include:: github_config_keys.rst diff --git a/docs/source/cli/go.rst b/docs/source/cli/go.rst index afee6a7c8..8d6101670 100644 --- a/docs/source/cli/go.rst +++ b/docs/source/cli/go.rst @@ -15,10 +15,10 @@ Checks out the branch specified by the given direction relative to the current b * ``down``: the direct children/downstream branch of the current branch. * ``first``: the first downstream of the root branch of the current branch (like ``root`` followed by ``next``), or the root branch itself if the root has no downstream branches. - * ``last``: the last branch in the definition file that has the same root as the current branch; + * ``last``: the last branch in the branch layout file that has the same root as the current branch; can be the root branch itself if the root has no downstream branches. - * ``next``: the direct successor of the current branch in the definition file. - * ``prev``: the direct predecessor of the current branch in the definition file. + * ``next``: the direct successor of the current branch in the branch layout file. + * ``prev``: the direct predecessor of the current branch in the branch layout file. * ``root``: the root of the tree where the current branch is located. Note: this will typically be something like ``develop`` or ``master``, since all branches are usually meant to be ultimately merged to one of those. diff --git a/docs/source/cli/list.rst b/docs/source/cli/list.rst index eac772658..00a4e7275 100644 --- a/docs/source/cli/list.rst +++ b/docs/source/cli/list.rst @@ -12,13 +12,13 @@ where is one of: ``addable``, ``childless``, ``managed``, ``slidable` Lists all branches that fall into one of the specified categories: - * ``addable``: all branches (local or remote) than can be added to the definition file, + * ``addable``: all branches (local or remote) than can be added to the branch layout file, * ``childless``: all managed branches that do not possess child branches, - * ``managed``: all branches that appear in the definition file, + * ``managed``: all branches that appear in the branch layout file, * ``slidable``: all managed branches that have an upstream and can be slid out with :ref:`slide-out` command * ``slidable-after ``: the downstream branch of the , if it exists and is the only downstream of (i.e. the one that can be slid out immediately following ), - * ``unmanaged``: all local branches that don't appear in the definition file, + * ``unmanaged``: all local branches that don't appear in the branch layout file, * ``with-overridden-fork-point``: all local branches that have a :ref:`fork point` override set up (even if this override does not affect the location of their fork point anymore). diff --git a/docs/source/cli/log.rst b/docs/source/cli/log.rst index 8594be7f8..cb6716dfd 100644 --- a/docs/source/cli/log.rst +++ b/docs/source/cli/log.rst @@ -11,4 +11,4 @@ log Runs ``git log`` for the range of commits from tip of the given branch (or current branch, if none specified) back to its fork point. See help for :ref:`fork-point` for more details on meaning of the *fork point*. -Note: the branch in question does not need to occur in the definition file. +Note: the branch in question does not need to occur in the branch layout file. diff --git a/docs/source/cli/reapply.rst b/docs/source/cli/reapply.rst index f4d993e32..28600c431 100644 --- a/docs/source/cli/reapply.rst +++ b/docs/source/cli/reapply.rst @@ -13,7 +13,7 @@ The chunk of the history to be rebased starts at the automatically computed fork but can also be set explicitly by ``--fork-point``. See help for :ref:`fork-point` for more details on meaning of the *fork point*. -Note: the current reapplied branch does not need to occur in the definition file. +Note: the current reapplied branch does not need to occur in the branch layout file. Tip: ``reapply`` can be used for squashing the commits on the current branch to make history more condensed before push to the remote, but there is also dedicated ``squash`` command that achieves the same goal without running ``git rebase``. diff --git a/docs/source/cli/show.rst b/docs/source/cli/show.rst index c8c80cf85..766bf68c9 100644 --- a/docs/source/cli/show.rst +++ b/docs/source/cli/show.rst @@ -17,10 +17,10 @@ Outputs name of the branch (or possibly multiple branches, in case of ``down``) * ``down``: the direct children/downstream branch of the given branch. * ``first``: the first downstream of the root branch of the given branch (like ``root`` followed by ``next``), or the root branch itself if the root has no downstream branches. - * ``last``: the last branch in the definition file that has the same root as the given branch; can be the root branch itself + * ``last``: the last branch in the branch layout file that has the same root as the given branch; can be the root branch itself if the root has no downstream branches. - * ``next``: the direct successor of the given branch in the definition file. - * ``prev``: the direct predecessor of the given branch in the definition file. + * ``next``: the direct successor of the given branch in the branch layout file. + * ``prev``: the direct predecessor of the given branch in the branch layout file. * ``root``: the root of the tree where the given branch is located. Note: this will typically be something like ``develop`` or ``master``, since all branches are usually meant to be ultimately merged to one of those. diff --git a/docs/source/cli/slide-out.rst b/docs/source/cli/slide-out.rst index 3e7c6fa09..fbefda50d 100644 --- a/docs/source/cli/slide-out.rst +++ b/docs/source/cli/slide-out.rst @@ -8,7 +8,7 @@ slide-out git machete slide-out [-d|--down-fork-point=] [--delete] [-M|--merge] [-n|--no-edit-merge|--no-interactive-rebase] [ [ [ ...]]] -Removes the given branch (or multiple branches) from the branch tree definition. If no branch has been specified current branch is assumed as the only branch. +Removes the given branch (or multiple branches) from the branch layout. If no branch has been specified current branch is assumed as the only branch. Then synchronizes the downstream (child) branches of the last specified branch on the top of the upstream (parent) branch of the first specified branch. Sync is performed either by rebase (default) or by merge (if ``--merge`` option passed). diff --git a/docs/source/cli/squash.rst b/docs/source/cli/squash.rst index f2c602261..d56da33d3 100644 --- a/docs/source/cli/squash.rst +++ b/docs/source/cli/squash.rst @@ -14,7 +14,7 @@ but can also be set explicitly by ``--fork-point``. See help for :ref:`fork-point` for more details on meaning of the *fork point*. The message for the squashed is taken from the earliest squashed commit, i.e. the commit directly following the fork point. -Note: the current squashed branch does not need to occur in the definition file. +Note: the current squashed branch does not need to occur in the branch layout file. Tip: ``squash`` does NOT run ``git rebase`` under the hood. For more complex scenarios that require rewriting the history of current branch, see ``reapply`` and ``update``. diff --git a/docs/source/cli/status.rst b/docs/source/cli/status.rst index d579bb3bf..0e9ec3873 100644 --- a/docs/source/cli/status.rst +++ b/docs/source/cli/status.rst @@ -20,9 +20,9 @@ status git machete s[tatus] [--color=WHEN] [-l|--list-commits] [-L|--list-commits-with-hashes] [--no-detect-squash-merges] -Displays a tree-shaped status of the branches listed in the definition file. +Displays a tree-shaped status of the branches listed in the branch layout file. -Apart from simply ASCII-formatting the definition file, this also: +Apart from simply ASCII-formatting the branch layout file, this also: * colors the edges between upstream (parent) and downstream (children) branches: diff --git a/docs/source/cli/traverse.rst b/docs/source/cli/traverse.rst index 7adafa777..f044e6c4f 100644 --- a/docs/source/cli/traverse.rst +++ b/docs/source/cli/traverse.rst @@ -23,7 +23,7 @@ traverse [--[no-]push] [--[no-]push-untracked] [--return-to=WHERE] [--start-from=WHERE] [-w|--whole] [-W] [-y|--yes] -Traverses the branch tree in pre-order (i.e. simply in the order as they occur in the definition file). +Traverses the branch tree in pre-order (i.e. simply in the order as they occur in the branch layout file). By default ``traverse`` starts from the current branch. This behavior can, however, be customized using options: ``--start-from=``, ``--whole`` or ``-w``, ``-W``. diff --git a/docs/source/short_docs.rst b/docs/source/short_docs.rst index ab167adfd..480b479d6 100644 --- a/docs/source/short_docs.rst +++ b/docs/source/short_docs.rst @@ -5,13 +5,13 @@ * :ref:`anno` -- Manage custom annotations * :ref:`clean` -- Delete untracked and unmanaged branches and also optionally check out user's open GitHub PRs * :ref:`config` -- Display docs for the git machete configuration keys and environment variables -* :ref:`delete-unmanaged` -- Delete local branches that are not present in the definition file +* :ref:`delete-unmanaged` -- Delete local branches that are not present in the branch layout file * :ref:`diff` -- Diff current working directory or a given branch against its computed fork point * :ref:`discover` -- Automatically discover tree of branch dependencies -* :ref:`edit` -- Edit the definition file -* :ref:`file` -- Display the location of the definition file +* :ref:`edit` -- Edit the branch layout file +* :ref:`file` -- Display the location of the branch layout file * :ref:`fork-point` -- Display or override fork point for a branch -* :ref:`format` -- Display docs for the format of the definition file +* :ref:`format` -- Display docs for the format of the branch layout file * :ref:`github` -- Create, check out and manage GitHub PRs while keeping them reflected in git machete * :ref:`go` -- Check out the branch relative to the position of the current branch, accepts down/first/last/next/root/prev/up argument * :ref:`help` -- Display this overview, or detailed help for a specified command diff --git a/git_machete/cli.py b/git_machete/cli.py index a7e8ce48b..364592f65 100644 --- a/git_machete/cli.py +++ b/git_machete/cli.py @@ -519,24 +519,24 @@ def launch(orig_args: List[str]) -> None: machete_client = MacheteClient(git) - if not os.path.exists(machete_client.definition_file_path): + if not os.path.exists(machete_client.branch_layout_file_path): # We're opening in "append" and not "write" mode to avoid a race condition: # if other process writes to the file between we check the # result of `os.path.exists` and call `open`, # then open(..., "w") would result in us clearing up the file # contents, while open(..., "a") has no effect. - with open(machete_client.definition_file_path, "a"): + with open(machete_client.branch_layout_file_path, "a"): pass - elif os.path.isdir(machete_client.definition_file_path): + elif os.path.isdir(machete_client.branch_layout_file_path): # Extremely unlikely case, basically checking if anybody # tampered with the repository. raise MacheteException( - f"{machete_client.definition_file_path} is a directory " + f"{machete_client.branch_layout_file_path} is a directory " "rather than a regular file, aborting") should_perform_interactive_slide_out = MacheteClient.should_perform_interactive_slide_out(cmd) if cmd == "add": - machete_client.read_definition_file(perform_interactive_slide_out=should_perform_interactive_slide_out) + machete_client.read_branch_layout_file(perform_interactive_slide_out=should_perform_interactive_slide_out) branch = get_local_branch_short_name_from_arg_or_current_branch(cli_opts.opt_branch, git) machete_client.add( branch=branch, @@ -546,14 +546,14 @@ def launch(orig_args: List[str]) -> None: verbose=True, switch_head_if_new_branch=True) elif cmd == "advance": - machete_client.read_definition_file(perform_interactive_slide_out=should_perform_interactive_slide_out) + machete_client.read_branch_layout_file(perform_interactive_slide_out=should_perform_interactive_slide_out) git.expect_no_operation_in_progress() current_branch = git.get_current_branch() machete_client.expect_in_managed_branches(current_branch) machete_client.advance(branch=current_branch, opt_yes=cli_opts.opt_yes) elif cmd == "anno": - machete_client.read_definition_file(perform_interactive_slide_out=should_perform_interactive_slide_out, - verify_branches=False) + machete_client.read_branch_layout_file(perform_interactive_slide_out=should_perform_interactive_slide_out, + verify_branches=False) if cli_opts.opt_sync_github_prs: machete_client.sync_annotations_to_github_prs() else: @@ -564,33 +564,33 @@ def launch(orig_args: List[str]) -> None: else: machete_client.print_annotation(branch) elif cmd == "clean": - machete_client.read_definition_file(perform_interactive_slide_out=should_perform_interactive_slide_out) + machete_client.read_branch_layout_file(perform_interactive_slide_out=should_perform_interactive_slide_out) if 'checkout_my_github_prs' in parsed_cli: machete_client.checkout_github_prs(pr_nos=[], my_opened_prs=True) machete_client.delete_unmanaged(opt_yes=cli_opts.opt_yes) machete_client.delete_untracked(opt_yes=cli_opts.opt_yes) elif cmd == "delete-unmanaged": - machete_client.read_definition_file(perform_interactive_slide_out=should_perform_interactive_slide_out) + machete_client.read_branch_layout_file(perform_interactive_slide_out=should_perform_interactive_slide_out) machete_client.delete_unmanaged(opt_yes=cli_opts.opt_yes) elif cmd in {"diff", alias_by_command["diff"]}: - machete_client.read_definition_file(perform_interactive_slide_out=should_perform_interactive_slide_out) + machete_client.read_branch_layout_file(perform_interactive_slide_out=should_perform_interactive_slide_out) diff_branch = get_local_branch_short_name_from_arg(cli_opts.opt_branch) if (cli_opts.opt_branch is not None) else None machete_client.diff(branch=diff_branch, opt_stat=cli_opts.opt_stat) elif cmd == "discover": - machete_client.read_definition_file(perform_interactive_slide_out=should_perform_interactive_slide_out) + machete_client.read_branch_layout_file(perform_interactive_slide_out=should_perform_interactive_slide_out) machete_client.discover_tree( opt_checked_out_since=cli_opts.opt_checked_out_since, opt_list_commits=cli_opts.opt_list_commits, opt_roots=cli_opts.opt_roots, opt_yes=cli_opts.opt_yes) elif cmd in {"edit", alias_by_command["edit"]}: - # No need to read definition file. + # No need to read branch layout file. machete_client.edit() elif cmd == "file": - # No need to read definition file. - print(os.path.abspath(machete_client.definition_file_path)) + # No need to read branch layout file. + print(os.path.abspath(machete_client.branch_layout_file_path)) elif cmd == "fork-point": - machete_client.read_definition_file(perform_interactive_slide_out=should_perform_interactive_slide_out) + machete_client.read_branch_layout_file(perform_interactive_slide_out=should_perform_interactive_slide_out) branch = get_local_branch_short_name_from_arg_or_current_branch(cli_opts.opt_branch, git) machete_client.expect_in_local_branches(branch) if cli_opts.opt_inferred: @@ -612,7 +612,7 @@ def launch(orig_args: List[str]) -> None: else: print(machete_client.fork_point(branch=branch, use_overrides=True)) elif cmd in {"go", alias_by_command["go"]}: - machete_client.read_definition_file(perform_interactive_slide_out=should_perform_interactive_slide_out) + machete_client.read_branch_layout_file(perform_interactive_slide_out=should_perform_interactive_slide_out) git.expect_no_operation_in_progress() current_branch = git.get_current_branch() dest = machete_client.parse_direction(parsed_cli.direction, current_branch, allow_current=False, down_pick_mode=True)[0] @@ -621,7 +621,7 @@ def launch(orig_args: List[str]) -> None: git.checkout(dest) elif cmd == "github": github_subcommand = parsed_cli.subcommand - machete_client.read_definition_file(perform_interactive_slide_out=should_perform_interactive_slide_out) + machete_client.read_branch_layout_file(perform_interactive_slide_out=should_perform_interactive_slide_out) if 'draft' in parsed_cli and github_subcommand != 'create-pr': raise MacheteException("`--draft` option is only valid with `create-pr` subcommand.") @@ -663,7 +663,7 @@ def launch(orig_args: List[str]) -> None: machete_client.delete_unmanaged(opt_yes=False) machete_client.delete_untracked(opt_yes=cli_opts.opt_yes) elif cmd == "is-managed": - machete_client.read_definition_file(perform_interactive_slide_out=should_perform_interactive_slide_out) + machete_client.read_branch_layout_file(perform_interactive_slide_out=should_perform_interactive_slide_out) branch = get_local_branch_short_name_from_arg_or_current_branch(cli_opts.opt_branch, git) if branch is None or branch not in machete_client.managed_branches: sys.exit(ExitCode.MACHETE_EXCEPTION) @@ -674,7 +674,7 @@ def launch(orig_args: List[str]) -> None: elif category != 'slidable-after' and 'branch' in parsed_cli_as_dict: raise MacheteException(f"`git machete list {category}` does not expect extra arguments") - machete_client.read_definition_file(perform_interactive_slide_out=should_perform_interactive_slide_out) + machete_client.read_branch_layout_file(perform_interactive_slide_out=should_perform_interactive_slide_out) res = [] if category == "addable": def strip_remote_name(remote_branch: RemoteBranchShortName) -> LocalBranchShortName: @@ -709,11 +709,11 @@ def strip_remote_name(remote_branch: RemoteBranchShortName) -> LocalBranchShortN if res: print("\n".join(res)) elif cmd in {"log", alias_by_command["log"]}: - machete_client.read_definition_file(perform_interactive_slide_out=should_perform_interactive_slide_out) + machete_client.read_branch_layout_file(perform_interactive_slide_out=should_perform_interactive_slide_out) branch = get_local_branch_short_name_from_arg_or_current_branch(cli_opts.opt_branch, git) machete_client.log(branch) elif cmd == "reapply": - machete_client.read_definition_file(perform_interactive_slide_out=should_perform_interactive_slide_out) + machete_client.read_branch_layout_file(perform_interactive_slide_out=should_perform_interactive_slide_out) git.expect_no_operation_in_progress() current_branch = git.get_current_branch() if "fork_point" in parsed_cli and cli_opts.opt_fork_point: @@ -727,11 +727,11 @@ def strip_remote_name(remote_branch: RemoteBranchShortName) -> LocalBranchShortN if direction == "current" and "branch" in parsed_cli: raise MacheteException('`show current` with a `` argument does not make sense') branch = get_local_branch_short_name_from_arg_or_current_branch(cli_opts.opt_branch, git) - machete_client.read_definition_file(perform_interactive_slide_out=should_perform_interactive_slide_out, - verify_branches=False) + machete_client.read_branch_layout_file(perform_interactive_slide_out=should_perform_interactive_slide_out, + verify_branches=False) print('\n'.join(machete_client.parse_direction(direction, branch, allow_current=True, down_pick_mode=False))) elif cmd == "slide-out": - machete_client.read_definition_file(perform_interactive_slide_out=should_perform_interactive_slide_out) + machete_client.read_branch_layout_file(perform_interactive_slide_out=should_perform_interactive_slide_out) git.expect_no_operation_in_progress() branches = parsed_cli_as_dict.get('branches', [git.get_current_branch()]) machete_client.slide_out( @@ -742,7 +742,7 @@ def strip_remote_name(remote_branch: RemoteBranchShortName) -> LocalBranchShortN opt_no_interactive_rebase=cli_opts.opt_no_interactive_rebase, opt_no_edit_merge=cli_opts.opt_no_edit_merge) elif cmd == "squash": - machete_client.read_definition_file(perform_interactive_slide_out=should_perform_interactive_slide_out) + machete_client.read_branch_layout_file(perform_interactive_slide_out=should_perform_interactive_slide_out) git.expect_no_operation_in_progress() current_branch = git.get_current_branch() if "fork_point" in parsed_cli and cli_opts.opt_fork_point: @@ -752,7 +752,7 @@ def strip_remote_name(remote_branch: RemoteBranchShortName) -> LocalBranchShortN squash_fork_point = cli_opts.opt_fork_point or machete_client.fork_point(branch=current_branch, use_overrides=True) machete_client.squash(current_branch=current_branch, opt_fork_point=squash_fork_point) elif cmd in {"status", alias_by_command["status"]}: - machete_client.read_definition_file(perform_interactive_slide_out=should_perform_interactive_slide_out) + machete_client.read_branch_layout_file(perform_interactive_slide_out=should_perform_interactive_slide_out) machete_client.expect_at_least_one_managed_branch() machete_client.status( warn_when_branch_in_sync_but_fork_point_off=True, @@ -768,7 +768,7 @@ def strip_remote_name(remote_branch: RemoteBranchShortName) -> LocalBranchShortN raise MacheteException( "Invalid argument for `--return-to`. " "Valid arguments: `here|nearest-remaining|stay`.") - machete_client.read_definition_file(perform_interactive_slide_out=should_perform_interactive_slide_out) + machete_client.read_branch_layout_file(perform_interactive_slide_out=should_perform_interactive_slide_out) git.expect_no_operation_in_progress() machete_client.traverse( opt_fetch=cli_opts.opt_fetch, @@ -783,7 +783,7 @@ def strip_remote_name(remote_branch: RemoteBranchShortName) -> LocalBranchShortN opt_start_from=cli_opts.opt_start_from, opt_yes=cli_opts.opt_yes) elif cmd == "update": # pragma: no branch; an unknown command is handled by argparse - machete_client.read_definition_file(perform_interactive_slide_out=should_perform_interactive_slide_out) + machete_client.read_branch_layout_file(perform_interactive_slide_out=should_perform_interactive_slide_out) git.expect_no_operation_in_progress() if "fork_point" in parsed_cli and cli_opts.opt_fork_point: machete_client.check_that_fork_point_is_ancestor_or_equal_to_tip_of_branch( diff --git a/git_machete/client.py b/git_machete/client.py index f7edf7eb9..9d71151da 100644 --- a/git_machete/client.py +++ b/git_machete/client.py @@ -34,10 +34,10 @@ class MacheteClient: def __init__(self, git: GitContext) -> None: self.__git: GitContext = git git.owner = self - self.__definition_file_path: str = self.__get_git_machete_definition_file_path() + self.__branch_layout_file_path: str = self.__get_git_machete_branch_layout_file_path() self.__init_state() - def __get_git_machete_definition_file_path(self) -> str: + def __get_git_machete_branch_layout_file_path(self) -> str: use_top_level_machete_file = self.__git.get_boolean_config_attr(key=git_config_keys.WORKTREE_USE_TOP_LEVEL_MACHETE_FILE, default_value=True) machete_file_directory = self.__git.get_main_git_dir() if use_top_level_machete_file else self.__git.get_worktree_git_dir() @@ -54,8 +54,8 @@ def __init_state(self) -> None: self.__branch_pairs_by_hash_in_reflog: Optional[Dict[FullCommitHash, List[BranchPair]]] = None @property - def definition_file_path(self) -> str: - return self.__definition_file_path + def branch_layout_file_path(self) -> str: + return self.__branch_layout_file_path @property def managed_branches(self) -> List[LocalBranchShortName]: @@ -88,17 +88,17 @@ def expect_at_least_one_managed_branch(self) -> None: def __raise_no_branches_error(self) -> None: raise MacheteException( - f"No branches listed in {self.__definition_file_path}; use `git " + f"No branches listed in {self.__branch_layout_file_path}; use `git " f"machete discover` or `git machete edit`, or edit" - f" {self.__definition_file_path} manually.") + f" {self.__branch_layout_file_path} manually.") - def read_definition_file(self, perform_interactive_slide_out: bool, verify_branches: bool = True) -> None: - with open(self.__definition_file_path) as file: + def read_branch_layout_file(self, perform_interactive_slide_out: bool, verify_branches: bool = True) -> None: + with open(self.__branch_layout_file_path) as file: lines: List[str] = [line.rstrip() for line in file.readlines()] at_depth = {} last_depth = -1 - hint = "Edit the definition file manually with `git machete edit`" + hint = "Edit the branch layout file manually with `git machete edit`" invalid_branches: List[LocalBranchShortName] = [] for index, line in enumerate(lines): @@ -115,8 +115,8 @@ def read_definition_file(self, perform_interactive_slide_out: bool, verify_branc self.__annotations[branch] = Annotation(branch_and_maybe_annotation[1]) if branch in self.managed_branches: raise MacheteException( - f"{self.__definition_file_path}, line {index + 1}: branch " - f"{bold(branch)} re-appears in the tree definition. {hint}") + f"{self.__branch_layout_file_path}, line {index + 1}: branch " + f"{bold(branch)} re-appears in the branch layout. {hint}") if verify_branches and branch not in self.__git.get_local_branches(): invalid_branches += [branch] self.__managed_branches += [branch] @@ -129,7 +129,7 @@ def read_definition_file(self, perform_interactive_slide_out: bool, verify_branc prefix_expanded: str = "".join(mapping[c] for c in prefix) indent_expanded: str = "".join(mapping[c] for c in self.__indent) raise MacheteException( - f"{self.__definition_file_path}, line {index + 1}: " + f"{self.__branch_layout_file_path}, line {index + 1}: " f"invalid indent {bold(prefix_expanded)}, expected a multiply" f" of {bold(indent_expanded)}. {hint}") else: @@ -137,7 +137,7 @@ def read_definition_file(self, perform_interactive_slide_out: bool, verify_branc if depth > last_depth + 1: raise MacheteException( - f"{self.__definition_file_path}, line {index + 1}: too much " + f"{self.__branch_layout_file_path}, line {index + 1}: too much " f"indent (level {depth}, expected at most {last_depth + 1}) " f"for the branch {bold(branch)}. {hint}") last_depth = depth @@ -161,17 +161,17 @@ def read_definition_file(self, perform_interactive_slide_out: bool, verify_branc ans: str = self.ask_if( f"Skipping {bold(invalid_branches[0])} " + "which is not a local branch (perhaps it has been deleted?).\n" + - "Slide it out from the definition file?" + + "Slide it out from the branch layout file?" + get_pretty_choices("y", "e[dit]", "N"), opt_yes_msg=None, opt_yes=False) else: ans = self.ask_if( f"Skipping {', '.join(f'{bold(branch)}' for branch in invalid_branches)}" " which are not local branches (perhaps they have been deleted?).\n" - "Slide them out from the definition file?" + get_pretty_choices("y", "e[dit]", "N"), + "Slide them out from the branch layout file?" + get_pretty_choices("y", "e[dit]", "N"), opt_yes_msg=None, opt_yes=False) else: print(f"Warning: sliding invalid branches: {', '.join(f'{bold(branch)}' for branch in invalid_branches)} " - f"out of the definition file", file=sys.stderr) + f"out of the branch layout file", file=sys.stderr) ans = 'y' def recursive_slide_out_invalid_branches(branch_: LocalBranchShortName) -> List[LocalBranchShortName]: @@ -197,11 +197,11 @@ def recursive_slide_out_invalid_branches(branch_: LocalBranchShortName) -> List[ self.__roots = flat_map(recursive_slide_out_invalid_branches, self.__roots) self.__managed_branches = excluding(self.managed_branches, invalid_branches) if ans in ('y', 'yes'): - self.save_definition_file() + self.save_branch_layout_file() elif ans in ('e', 'edit'): self.edit() self.__init_state() - self.read_definition_file(verify_branches) + self.read_branch_layout_file(verify_branches) def render_tree(self) -> List[str]: if not self.__indent: @@ -220,11 +220,11 @@ def render_dfs(branch: LocalBranchShortName, depth: int) -> List[str]: total += render_dfs(root, depth=0) return total - def back_up_definition_file(self) -> None: - shutil.copyfile(self.__definition_file_path, self.__definition_file_path + "~") + def back_up_branch_layout_file(self) -> None: + shutil.copyfile(self.__branch_layout_file_path, self.__branch_layout_file_path + "~") - def save_definition_file(self) -> None: - with open(self.__definition_file_path, "w") as file: + def save_branch_layout_file(self) -> None: + with open(self.__branch_layout_file_path, "w") as file: file.write("\n".join(self.render_tree()) + "\n") def add(self, @@ -291,7 +291,7 @@ def add(self, "You can either:\n" "1) specify the desired upstream branch with `--onto` or\n" f"2) pass `--as-root` to attach {bold(branch)} as a new root or\n" - "3) edit the definition file manually with `git machete edit`") + "3) edit the branch layout file manually with `git machete edit`") else: msg = (f"Add {bold(branch)} onto the inferred upstream (parent) " f"branch {bold(upstream)}?" + get_pretty_choices('y', 'N')) @@ -312,7 +312,7 @@ def add(self, print(fmt(f"Added branch {bold(branch)} onto {bold(opt_onto)}")) self.__managed_branches += [branch] - self.save_definition_file() + self.save_branch_layout_file() def annotate(self, branch: LocalBranchShortName, words: List[str]) -> None: @@ -320,7 +320,7 @@ def annotate(self, branch: LocalBranchShortName, words: List[str]) -> None: del self.__annotations[branch] else: self.__annotations[branch] = Annotation(" ".join(words)) - self.save_definition_file() + self.save_branch_layout_file() def print_annotation(self, branch: LocalBranchShortName) -> None: if branch in self.__annotations: @@ -472,21 +472,21 @@ def get_root_of(branch: LocalBranchShortName) -> LocalBranchShortName: opt_list_commits_with_hashes=False, opt_no_detect_squash_merges=False) print("") - do_backup = os.path.isfile(self.__definition_file_path) and io.open(self.__definition_file_path).read().strip() + do_backup = os.path.isfile(self.__branch_layout_file_path) and io.open(self.__branch_layout_file_path).read().strip() backup_msg = ( - f"\nThe existing definition file will be backed up as {self.__definition_file_path}~" + f"\nThe existing branch layout file will be backed up as {self.__branch_layout_file_path}~" if do_backup else "") - msg = f"Save the above tree to {self.__definition_file_path}?{backup_msg}" + get_pretty_choices('y', 'e[dit]', 'N') - opt_yes_msg = f"Saving the above tree to {self.__definition_file_path}...{backup_msg}" + msg = f"Save the above tree to {self.__branch_layout_file_path}?{backup_msg}" + get_pretty_choices('y', 'e[dit]', 'N') + opt_yes_msg = f"Saving the above tree to {self.__branch_layout_file_path}...{backup_msg}" ans = self.ask_if(msg, opt_yes_msg, opt_yes=opt_yes) if ans in ('y', 'yes'): if do_backup: - self.back_up_definition_file() - self.save_definition_file() + self.back_up_branch_layout_file() + self.save_branch_layout_file() elif ans in ('e', 'edit'): if do_backup: - self.back_up_definition_file() - self.save_definition_file() + self.back_up_branch_layout_file() + self.save_branch_layout_file() self.edit() def slide_out(self, @@ -555,7 +555,7 @@ def slide_out(self, self.__down_branches[new_upstream] += [new_downstream] # Update definition, fire post-hook, and perform the branch update - self.save_definition_file() + self.save_branch_layout_file() self.__run_post_slide_out_hook(new_upstream, branches_to_slide_out[-1], new_downstreams) self.__git.checkout(new_upstream) @@ -640,7 +640,7 @@ def connected_with_green_edge(bd: LocalBranchShortName) -> bool: self.__down_branches[branch] = flat_map( lambda bd: dds if bd == down_branch else [bd], self.__down_branches.get(branch) or []) - self.save_definition_file() + self.save_branch_layout_file() self.__run_post_slide_out_hook(branch, down_branch, dds) def __print_new_line(self, new_status: bool) -> None: @@ -778,7 +778,7 @@ def traverse( self.__down_branches[upstream] or []) if branch in self.__annotations: del self.__annotations[branch] - self.save_definition_file() + self.save_branch_layout_file() self.__run_post_slide_out_hook(upstream, branch, dbb) if ans == 'yq': return @@ -1222,10 +1222,10 @@ def edit(self) -> int: if not default_editor_with_args: raise MacheteException( f"Cannot determine editor. Set `GIT_MACHETE_EDITOR` environment " - f"variable or edit {self.__definition_file_path} directly.") + f"variable or edit {self.__branch_layout_file_path} directly.") command = default_editor_with_args[0] - args = default_editor_with_args[1:] + [self.__definition_file_path] + args = default_editor_with_args[1:] + [self.__branch_layout_file_path] return utils.run_cmd(command, *args) def __get_editor_with_args(self) -> List[str]: @@ -1593,9 +1593,9 @@ def sync_annotations_to_github_prs(self) -> None: debug('Current GitHub user is ' + (bold(current_user or ''))) all_open_prs: List[GitHubPullRequest] = github_client.derive_pull_requests() print(fmt('OK')) - self.__sync_annotations_to_definition_file(all_open_prs, current_user, verbose=True) + self.__sync_annotations_to_branch_layout_file(all_open_prs, current_user, verbose=True) - def __sync_annotations_to_definition_file(self, prs: List[GitHubPullRequest], current_user: Optional[str], verbose: bool) -> None: + def __sync_annotations_to_branch_layout_file(self, prs: List[GitHubPullRequest], current_user: Optional[str], verbose: bool) -> None: for pr in prs: if LocalBranchShortName.of(pr.head) in self.managed_branches: debug(f'{pr} corresponds to a managed branch') @@ -1629,7 +1629,7 @@ def __sync_annotations_to_definition_file(self, prs: List[GitHubPullRequest], cu if old_annotation_text is not None else Annotation(anno) else: debug(f'{pr} does NOT correspond to a managed branch') - self.save_definition_file() + self.save_branch_layout_file() # Parse and evaluate direction against current branch for show/go commands def parse_direction(self, @@ -2102,7 +2102,7 @@ def checkout_github_prs(self, checked_out_prs.append(pr) debug('Current GitHub user is ' + (current_user or '')) - self.__sync_annotations_to_definition_file(all_open_prs, current_user=current_user, verbose=False) + self.__sync_annotations_to_branch_layout_file(all_open_prs, current_user=current_user, verbose=False) if len(applicable_prs) == 1: self.__git.checkout(LocalBranchShortName.of(pr.head)) @@ -2205,7 +2205,7 @@ def retarget_github_pr(self, head: LocalBranchShortName, ignore_if_missing: bool raise MacheteException( f'Branch {bold(head)} does not have a parent branch (it is a root) ' f'even though there is an open PR #{bold(str(pr.number))} to {bold(pr.base)}.\n' - 'Consider modifying the branch definition file (`git machete edit`)' + 'Consider modifying the branch layout file (`git machete edit`)' f' so that {bold(head)} is a child of {bold(pr.base)}.') if pr.base != new_base: @@ -2218,7 +2218,7 @@ def retarget_github_pr(self, head: LocalBranchShortName, ignore_if_missing: bool self.__annotations[head] = Annotation(f'PR #{pr.number} ' + self.__annotations[head].qualifiers_text) else: self.__annotations[head] = Annotation(f'PR #{pr.number}') - self.save_definition_file() + self.save_branch_layout_file() def __derive_github_domain(self) -> str: return self.__git.get_config_attr_or_none(key=git_config_keys.GITHUB_DOMAIN) or GitHubClient.DEFAULT_GITHUB_DOMAIN @@ -2353,7 +2353,7 @@ def create_github_pr( print(fmt(ok_str)) self.__annotations[head] = Annotation(f'PR #{pr.number}') - self.save_definition_file() + self.save_branch_layout_file() def __handle_diverged_and_newer_state( self, @@ -2496,11 +2496,11 @@ def __sync_before_creating_pr(self, *, opt_onto: Optional[LocalBranchShortName], if current_branch not in self.managed_branches: raise MacheteException( "Command `github create-pr` can NOT be executed on the branch" - " that is not managed by git machete (is not present in git " - "machete definition file). To successfully execute this command " + " that is not managed by git machete (is not present in branch layout file). " + "To successfully execute this command " "either add current branch to the file via commands `add`, " "`discover` or `edit` or agree on adding the branch to the " - "definition file during the execution of `github create-pr` command.") + "branch layout file during the execution of `github create-pr` command.") up_branch: Optional[LocalBranchShortName] = self.__up_branch.get(current_branch) if not up_branch: @@ -2589,7 +2589,7 @@ def delete_untracked(self, opt_yes: bool) -> None: del self.__up_branch[managed_branch] self.__delete_branches(branches_to_delete=branches_to_delete, opt_yes=opt_yes) - self.save_definition_file() + self.save_branch_layout_file() @staticmethod def is_stdout_a_tty() -> bool: diff --git a/git_machete/generated_docs.py b/git_machete/generated_docs.py index 1780e4158..a02307381 100644 --- a/git_machete/generated_docs.py +++ b/git_machete/generated_docs.py @@ -10,13 +10,13 @@ "anno": "Manage custom annotations", "clean": "Delete untracked and unmanaged branches and also optionally check out user's open GitHub PRs", "config": "Display docs for the git machete configuration keys and environment variables", - "delete-unmanaged": "Delete local branches that are not present in the definition file", + "delete-unmanaged": "Delete local branches that are not present in the branch layout file", "diff": "Diff current working directory or a given branch against its computed fork point", "discover": "Automatically discover tree of branch dependencies", - "edit": "Edit the definition file", - "file": "Display the location of the definition file", + "edit": "Edit the branch layout file", + "file": "Display the location of the branch layout file", "fork-point": "Display or override fork point for a branch", - "format": "Display docs for the format of the definition file", + "format": "Display docs for the format of the branch layout file", "github": "Create, check out and manage GitHub PRs while keeping them reflected in git machete", "go": "Check out the branch relative to the position of the current branch, accepts down/first/last/next/root/prev/up argument", "help": "Display this overview, or detailed help for a specified command", @@ -39,18 +39,18 @@ Usage: git machete add [-o|--onto=] [-R|--as-root] [-y|--yes] [] - Adds the provided (or the current branch, if none specified) to the definition file. + Adds the provided (or the current branch, if none specified) to the branch layout file. If is provided but no local branch with the given name exists: * if a remote branch of the same name exists in exactly one remote, then user is asked whether to check out this branch locally (as in `git checkout`), * otherwise, user is asked whether it should be created as a new local branch. - If the definition file is empty or `-R/--as-root` is provided, the branch will be added as a root of the tree of branch dependencies. + If the branch layout file is empty or `-R/--as-root` is provided, the branch will be added as a root of the tree of branch dependencies. Otherwise, the desired upstream (parent) branch can be specified with `-o/--onto`. Neither of these options is mandatory, however; if both are skipped, git machete will try to automatically infer the target upstream. If the upstream branch can be inferred, the user will be presented with inferred branch and asked to confirm. - Note: all the effects of `add` (except git branch creation) can as well be achieved by manually editing the definition file. + Note: all the effects of `add` (except git branch creation) can as well be achieved by manually editing the branch layout file. Options: -o, --onto= @@ -170,7 +170,7 @@ Note: `anno` command is able to overwrite existing branch qualifiers. - Note: all the effects of `anno` can be always achieved by manually editing the definition file. + Note: all the effects of `anno` can be always achieved by manually editing the branch layout file. Options: -b, --branch= @@ -311,10 +311,10 @@ `machete.worktree.useTopLevelMacheteFile`: - The default value of this key is `true`, which means that the path to machete definition file will be `.git/machete` + The default value of this key is `true`, which means that the path to branch layout file will be `.git/machete` for both regular directory and worktree. - If you want the worktree to have its own machete definition file (located under `.git/worktrees/.../machete`), + If you want the worktree to have its own branch layout file (located under `.git/worktrees/.../machete`), set `git config machete.worktree.useTopLevelMacheteFile false`. Environment variables: @@ -334,7 +334,7 @@ Usage: git machete delete-unmanaged [-y|--yes] - Goes one-by-one through all the local git branches that don't exist in the definition file, + Goes one-by-one through all the local git branches that don't exist in the branch layout file, and ask to delete each of them (with `git branch -d` or `git branch -D`) if confirmed by user. No branch will be deleted unless explicitly confirmed by the user (or unless `-y/--yes` option is passed). @@ -354,7 +354,7 @@ of the current working tree against the fork point of the currently checked out branch. See help for `fork-point` for more details on the meaning of fork point. - Note: the branch in question does not need to occur in the definition file. + Note: the branch in question does not need to occur in the branch layout file. Options: -s, --stat @@ -364,11 +364,11 @@ Usage: git machete discover [-C|--checked-out-since=] [-l|--list-commits] [-r|--roots=,,...] [-y|--yes] - Discovers and displays tree of branch dependencies using a heuristic based on reflogs and asks whether to overwrite the existing definition - `file` with the new discovered tree. - If confirmed with a `y[es]` or `e[dit]` reply, backs up the current definition file (if it exists) as `$GIT_DIR/machete~` + Discovers and displays tree of branch dependencies using a heuristic based on reflogs + and asks whether to overwrite the existing branch layout `file` with the new discovered tree. + If confirmed with a `y[es]` or `e[dit]` reply, backs up the current branch layout file (if it exists) as `$GIT_DIR/machete~` and saves the new tree under the usual `$GIT_DIR/machete` path. - If the reply was `e[dit]`, additionally an editor is opened (as in: `git machete` `edit`) after saving the new definition file. + If the reply was `e[dit]`, additionally an editor is opened (as in: `git machete` `edit`) after saving the new branch layout file. `discover` retains the existing branch qualifiers used by `git machete traverse` (see help for `traverse`). Options: @@ -391,7 +391,7 @@ Usage: git machete e[dit] - Opens an editor and lets you edit the definition file manually. + Opens an editor and lets you edit the branch layout file manually. The editor is determined by checking up the following locations: * `$GIT_MACHETE_EDITOR` @@ -405,10 +405,10 @@ and selecting the first one that is defined and points to an executable file accessible on `PATH`. - Note that the above editor selection only applies for editing the definition file, + Note that the above editor selection only applies for editing the branch layout file, but not for any other actions that may be indirectly triggered by git machete, including editing of rebase TODO list, commit messages etc. - The definition file can be always accessed and edited directly under the path returned by `git machete file` + The branch layout file can be always accessed and edited directly under the path returned by `git machete file` (usually `.git/machete`, unless worktrees or submodules are involved). Environment variables: @@ -420,7 +420,7 @@ Usage: git machete file - Outputs the absolute path of machete definition file. + Outputs the absolute path of branch layout file. The file is always called `machete` and is located in the git directory of the project. Three cases are possible: @@ -439,7 +439,7 @@ git machete fork-point --unset-override [] Note: in all three forms, if no `` is specified, the currently checked out branch is assumed. - The branch in question does not need to occur in the definition file. + The branch in question does not need to occur in the branch layout file. Without any option, displays full hash of the fork point commit for the ``. Fork point of the given `` is the commit at which the history of the `` diverges from history of any other branch. @@ -489,7 +489,7 @@ "format": """ Note: there is no `git machete format` command as such; `format` is just a topic of `git machete help`. - The format of the definition file should be as follows: + The format of the branch layout file should be as follows: develop adjust-reads-prec PR #234 rebase=no push=no @@ -520,7 +520,7 @@ where `` is one of: `anno-prs`, `checkout-prs`, `create-pr`, `retarget-pr`. - Creates, checks out and manages GitHub PRs while keeping them reflected in branch definition file. + Creates, checks out and manages GitHub PRs while keeping them reflected in branch layout file. To allow GitHub API access for private repositories (and also to perform side-effecting actions like opening a PR, even in case of public repositories), a GitHub API token with `repo` scope is required, see https://github.com/settings/tokens. @@ -648,10 +648,10 @@ * `down`: the direct children/downstream branch of the current branch. * `first`: the first downstream of the root branch of the current branch (like `root` followed by `next`), or the root branch itself if the root has no downstream branches. - * `last`: the last branch in the definition file that has the same root as the current branch; + * `last`: the last branch in the branch layout file that has the same root as the current branch; can be the root branch itself if the root has no downstream branches. - * `next`: the direct successor of the current branch in the definition file. - * `prev`: the direct predecessor of the current branch in the definition file. + * `next`: the direct successor of the current branch in the branch layout file. + * `prev`: the direct predecessor of the current branch in the branch layout file. * `root`: the root of the tree where the current branch is located. Note: this will typically be something like `develop` or `master`, since all branches are usually meant to be ultimately merged to one of those. @@ -757,13 +757,13 @@ where is one of: `addable`, `childless`, `managed`, `slidable`, `slidable-after `, `unmanaged`, `with-overridden-fork-point`. Lists all branches that fall into one of the specified categories: - * `addable`: all branches (local or remote) than can be added to the definition file, + * `addable`: all branches (local or remote) than can be added to the branch layout file, * `childless`: all managed branches that do not possess child branches, - * `managed`: all branches that appear in the definition file, + * `managed`: all branches that appear in the branch layout file, * `slidable`: all managed branches that have an upstream and can be slid out with `slide-out` command * `slidable-after `: the downstream branch of the , if it exists and is the only downstream of (i.e. the one that can be slid out immediately following ), - * `unmanaged`: all local branches that don't appear in the definition file, + * `unmanaged`: all local branches that don't appear in the branch layout file, * `with-overridden-fork-point`: all local branches that have a `fork point` override set up (even if this override does not affect the location of their fork point anymore). @@ -776,7 +776,7 @@ Runs `git log` for the range of commits from tip of the given branch (or current branch, if none specified) back to its fork point. See help for `fork-point` for more details on meaning of the fork point. - Note: the branch in question does not need to occur in the definition file. + Note: the branch in question does not need to occur in the branch layout file. """, "reapply": """ Usage: @@ -787,7 +787,7 @@ but can also be set explicitly by `--fork-point`. See help for `fork-point` for more details on meaning of the fork point. - Note: the current reapplied branch does not need to occur in the definition file. + Note: the current reapplied branch does not need to occur in the branch layout file. Tip: `reapply` can be used for squashing the commits on the current branch to make history more condensed before push to the remote, but there is also dedicated `squash` command that achieves the same goal without running `git rebase`. @@ -814,10 +814,10 @@ * `down`: the direct children/downstream branch of the given branch. * `first`: the first downstream of the root branch of the given branch (like `root` followed by `next`), or the root branch itself if the root has no downstream branches. - * `last`: the last branch in the definition file that has the same root as the given branch; can be the root branch itself + * `last`: the last branch in the branch layout file that has the same root as the given branch; can be the root branch itself if the root has no downstream branches. - * `next`: the direct successor of the given branch in the definition file. - * `prev`: the direct predecessor of the given branch in the definition file. + * `next`: the direct successor of the given branch in the branch layout file. + * `prev`: the direct predecessor of the given branch in the branch layout file. * `root`: the root of the tree where the given branch is located. Note: this will typically be something like `develop` or `master`, since all branches are usually meant to be ultimately merged to one of those. @@ -827,7 +827,7 @@ Usage: git machete slide-out [-d|--down-fork-point=] [--delete] [-M|--merge] [-n|--no-edit-merge|--no-interactive-rebase] [ [ [ ...]]] - Removes the given branch (or multiple branches) from the branch tree definition. If no branch has been specified current branch is assumed as the only branch. + Removes the given branch (or multiple branches) from the branch layout. If no branch has been specified current branch is assumed as the only branch. Then synchronizes the downstream (child) branches of the last specified branch on the top of the upstream (parent) branch of the first specified branch. Sync is performed either by rebase (default) or by merge (if `--merge` option passed). @@ -897,7 +897,7 @@ See help for `fork-point` for more details on meaning of the fork point. The message for the squashed is taken from the earliest squashed commit, i.e. the commit directly following the fork point. - Note: the current squashed branch does not need to occur in the definition file. + Note: the current squashed branch does not need to occur in the branch layout file. Tip: `squash` does NOT run `git rebase` under the hood. For more complex scenarios that require rewriting the history of current branch, see `reapply` and `update`. @@ -909,9 +909,9 @@ Usage: git machete s[tatus] [--color=WHEN] [-l|--list-commits] [-L|--list-commits-with-hashes] [--no-detect-squash-merges] - Displays a tree-shaped status of the branches listed in the definition file. + Displays a tree-shaped status of the branches listed in the branch layout file. - Apart from simply ASCII-formatting the definition file, this also: + Apart from simply ASCII-formatting the branch layout file, this also: * colors the edges between upstream (parent) and downstream (children) branches: - red edge means that the downstream branch tip is not a direct descendant of the upstream branch tip, - yellow edge means that the downstream branch tip is a direct descendant of the upstream branch tip, @@ -997,7 +997,7 @@ [--[no-]push] [--[no-]push-untracked] [--return-to=WHERE] [--start-from=WHERE] [-w|--whole] [-W] [-y|--yes] - Traverses the branch tree in pre-order (i.e. simply in the order as they occur in the definition file). + Traverses the branch tree in pre-order (i.e. simply in the order as they occur in the branch layout file). By default `traverse` starts from the current branch. This behavior can, however, be customized using options: `--start-from=`, `--whole` or `-w`, `-W`. diff --git a/graphics/setup-sandbox b/graphics/setup-sandbox index f04b01d40..9e4679864 100755 --- a/graphics/setup-sandbox +++ b/graphics/setup-sandbox @@ -53,7 +53,7 @@ newb call-ws cmt Call web service cmt 1st round of fixes push -newb drop-constraint # not added to definition file +newb drop-constraint # not added to branch layout file cmt Drop unneeded SQL constraints git checkout call-ws cmt 2nd round of fixes diff --git a/requirements/coverage.txt b/requirements/coverage.txt index 2d0b77f87..50692e15a 100644 --- a/requirements/coverage.txt +++ b/requirements/coverage.txt @@ -1,3 +1,3 @@ coverage==7.2.7 pytest==7.4.0 -pytest-mock==3.11.0 +pytest-mock==3.11.1 diff --git a/tests/mockers.py b/tests/mockers.py index cac6e386d..b6ffd06a0 100644 --- a/tests/mockers.py +++ b/tests/mockers.py @@ -75,7 +75,7 @@ def assert_failure(cmds: Iterable[str], expected_result: str, expected_exception assert error_message == expected_result -def rewrite_definition_file(new_body: str) -> None: +def rewrite_branch_layout_file(new_body: str) -> None: new_body = textwrap.dedent(new_body) with open(".git/machete", 'w') as def_file: def_file.writelines(new_body) diff --git a/tests/test_add.py b/tests/test_add.py index c4bcab62e..3eb5950be 100644 --- a/tests/test_add.py +++ b/tests/test_add.py @@ -2,7 +2,7 @@ from .base_test import BaseTest from .mockers import (assert_failure, assert_success, mock_input_returning, - mock_input_returning_y, rewrite_definition_file) + mock_input_returning_y, rewrite_branch_layout_file) class TestAdd(BaseTest): @@ -24,7 +24,7 @@ def test_add(self, mocker: MockerFixture) -> None: develop feature """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) self.repo_sandbox.new_branch("bugfix/feature_fail") @@ -110,7 +110,7 @@ def test_add_new_branch_onto_managed_current_branch(self, mocker: MockerFixture) .commit() ) - rewrite_definition_file("master") + rewrite_branch_layout_file("master") self.patch_symbol(mocker, "builtins.input", mock_input_returning_y) assert_success( @@ -128,7 +128,7 @@ def test_add_new_branch_when_cannot_infer_parent(self, mocker: MockerFixture) -> .check_out("master") ) - rewrite_definition_file("develop") + rewrite_branch_layout_file("develop") self.patch_symbol(mocker, "builtins.input", mock_input_returning_y) assert_failure( @@ -138,7 +138,7 @@ def test_add_new_branch_when_cannot_infer_parent(self, mocker: MockerFixture) -> You can either: 1) specify the desired upstream branch with --onto or 2) pass --as-root to attach foo as a new root or - 3) edit the definition file manually with git machete edit""" + 3) edit the branch layout file manually with git machete edit""" ) def test_add_already_managed_branch(self) -> None: @@ -149,7 +149,7 @@ def test_add_already_managed_branch(self) -> None: .commit("develop commit.") ) - rewrite_definition_file("master\n develop") + rewrite_branch_layout_file("master\n develop") assert_failure(['add', 'develop'], 'Branch develop already exists in the tree of branch dependencies') @@ -161,7 +161,7 @@ def test_add_onto_non_existent_branch(self) -> None: .commit("develop commit.") ) - rewrite_definition_file("master") + rewrite_branch_layout_file("master") assert_failure( ['add', 'develop', '--onto', 'foo'], diff --git a/tests/test_advance.py b/tests/test_advance.py index 73140bb4d..def76c830 100644 --- a/tests/test_advance.py +++ b/tests/test_advance.py @@ -5,14 +5,14 @@ from .base_test import BaseTest from .mockers import (assert_failure, assert_success, launch_command, - mock_input_returning, rewrite_definition_file) + mock_input_returning, rewrite_branch_layout_file) class TestAdvance(BaseTest): def test_advance_for_no_downstream_branches(self) -> None: self.repo_sandbox.new_branch("root").commit() - rewrite_definition_file("root") + rewrite_branch_layout_file("root") assert_failure(["advance"], "root does not have any downstream (child) branches to advance towards") @@ -24,7 +24,7 @@ def test_advance_when_detached_head(self) -> None: .new_branch("develop") .commit() ) - rewrite_definition_file("master\n develop") + rewrite_branch_layout_file("master\n develop") self.repo_sandbox.check_out("HEAD~") assert_failure(["advance"], "Not currently on any branch", expected_exception=UnderlyingGitException) @@ -39,7 +39,7 @@ def test_advance_for_no_applicable_downstream_branches(self) -> None: .check_out("master") .commit() ) - rewrite_definition_file("master\n develop") + rewrite_branch_layout_file("master\n develop") assert_failure(["advance"], "No downstream (child) branch of master is connected to master with a green edge") @@ -52,7 +52,7 @@ def test_advance_with_immediate_cancel(self, mocker: MockerFixture) -> None: .commit() .check_out("master") ) - rewrite_definition_file("master\n develop") + rewrite_branch_layout_file("master\n develop") self.patch_symbol(mocker, "builtins.input", mock_input_returning("n")) assert_success(["advance"], "Fast-forward master to match develop? (y, N)\n") @@ -76,7 +76,7 @@ def test_advance_with_push_for_one_downstream_branch(self) -> None: root level-1-branch """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) level_1_commit_hash = self.repo_sandbox.get_current_commit_hash() self.repo_sandbox.check_out("root") @@ -122,7 +122,7 @@ def test_advance_without_push_for_one_downstream_branch(self) -> None: level-2a-branch level-2b-branch """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) self.repo_sandbox.check_out("root") launch_command("advance", "-y") @@ -166,7 +166,7 @@ def test_advance_for_a_few_possible_downstream_branches_and_yes_option(self, moc level-1a-branch level-1b-branch """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) expected_error_message = "More than one downstream (child) branch of root " \ "is connected to root with a green edge and -y/--yes option is specified" diff --git a/tests/test_anno.py b/tests/test_anno.py index bebc62791..aaddea5ce 100644 --- a/tests/test_anno.py +++ b/tests/test_anno.py @@ -1,5 +1,5 @@ from .base_test import BaseTest -from .mockers import assert_success, launch_command, rewrite_definition_file +from .mockers import assert_success, launch_command, rewrite_branch_layout_file class TestAnno(BaseTest): @@ -25,7 +25,7 @@ def test_anno(self) -> None: develop feature """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) # Test `git machete anno` without providing the branch name launch_command('anno', 'Custom annotation for `develop` branch') diff --git a/tests/test_clean.py b/tests/test_clean.py index c8113b17a..fe066782d 100644 --- a/tests/test_clean.py +++ b/tests/test_clean.py @@ -2,7 +2,7 @@ from .base_test import BaseTest from .mockers import (assert_success, launch_command, mock_input_returning_y, - rewrite_definition_file) + rewrite_branch_layout_file) from .mockers_github import mock_github_token_for_domain_none @@ -46,13 +46,13 @@ def test_clean(self, mocker: MockerFixture) -> None: moo2 mars """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) launch_command('clean') expected_status_output = ( """ - Warning: sliding invalid branches: bar2, foo2, moo2, mars out of the definition file + Warning: sliding invalid branches: bar2, foo2, moo2, mars out of the branch layout file master * | o-bar (untracked) diff --git a/tests/test_client.py b/tests/test_client.py index 9ba6109c0..5dc875473 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -5,14 +5,14 @@ from git_machete.git_operations import GitContext, LocalBranchShortName from .base_test import BaseTest -from .mockers import rewrite_definition_file +from .mockers import rewrite_branch_layout_file class TestClient(BaseTest): - def test_annotations_read_definition_file(self) -> None: + def test_annotations_read_branch_layout_file(self) -> None: """ - Verify behaviour of a 'MacheteClient.read_definition_file()' method + Verify behaviour of a 'MacheteClient.read_branch_layout_file()' method """ ( self.repo_sandbox @@ -56,9 +56,9 @@ def test_annotations_read_definition_file(self) -> None: feature8 annotation rebase=no push=no rebase=no push=no """ self.repo_sandbox.new_branch("root") - rewrite_definition_file(body) + rewrite_branch_layout_file(body) machete_client = MacheteClient(GitContext()) - machete_client.read_definition_file(perform_interactive_slide_out=False) + machete_client.read_branch_layout_file(perform_interactive_slide_out=False) annotations: Dict[LocalBranchShortName, Annotation] = machete_client.annotations feature_2_branch = LocalBranchShortName.of('feature2') diff --git a/tests/test_delete_unmanaged.py b/tests/test_delete_unmanaged.py index 0ccfe934c..ed8756f5c 100644 --- a/tests/test_delete_unmanaged.py +++ b/tests/test_delete_unmanaged.py @@ -3,7 +3,7 @@ from .base_test import BaseTest from .mockers import (assert_success, fixed_author_and_committer_date_in_past, launch_command, mock__run_cmd_and_forward_stdout, - mock_input_returning, rewrite_definition_file) + mock_input_returning, rewrite_branch_layout_file) class TestDeleteUnmanaged(BaseTest): @@ -24,7 +24,7 @@ def test_delete_unmanaged(self, mocker: MockerFixture) -> None: """ master """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) self.patch_symbol(mocker, "builtins.input", mock_input_returning("q")) launch_command("delete-unmanaged", "-v") diff --git a/tests/test_discover.py b/tests/test_discover.py index dea1489ec..b98c21a65 100644 --- a/tests/test_discover.py +++ b/tests/test_discover.py @@ -7,7 +7,7 @@ from .base_test import BaseTest from .mockers import (assert_failure, assert_success, launch_command, mock_input_returning, overridden_environment, - rewrite_definition_file) + rewrite_branch_layout_file) class TestDiscover(BaseTest): @@ -39,7 +39,7 @@ def test_discover(self) -> None: feature2 annotation feature3 annotation rebase=no push=no """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) launch_command('discover', '-y') assert os.path.exists(".git/machete~") @@ -73,7 +73,7 @@ def test_discover(self) -> None: o-feature4 * (untracked) Saving the above tree to .git/machete... - The existing definition file will be backed up as .git/machete~ + The existing branch layout file will be backed up as .git/machete~ """ ) assert_success(['discover', '--roots=feature1,master', '-y'], expected_discover_output) @@ -193,7 +193,7 @@ def test_discover_with_merged_branches(self, mocker: MockerFixture) -> None: launch_command("discover") assert self.repo_sandbox.read_file(".git/machete") == "" - rewrite_definition_file("master\n feature1") + rewrite_branch_layout_file("master\n feature1") self.patch_symbol(mocker, 'builtins.input', mock_input_returning('e')) with overridden_environment(GIT_MACHETE_EDITOR='cat'): @@ -209,7 +209,7 @@ def test_discover_with_merged_branches(self, mocker: MockerFixture) -> None: x-feature2 Save the above tree to .git/machete? - The existing definition file will be backed up as .git/machete~ (y, e[dit], N) + The existing branch layout file will be backed up as .git/machete~ (y, e[dit], N) """ ) diff --git a/tests/test_file.py b/tests/test_file.py index 43268d311..a1ea54e64 100644 --- a/tests/test_file.py +++ b/tests/test_file.py @@ -24,33 +24,33 @@ def test_file(self) -> None: .commit("feature commit.") ) - # check git machete definition file path when inside a normal directory - definition_file_full_path = launch_command("file") - definition_file_path = Path(definition_file_full_path).parts - definition_file_path_relative_to_git_dir = '/'.join(definition_file_path[-2:]).rstrip('\n') - assert definition_file_path_relative_to_git_dir == '.git/machete' + # check branch layout file path when inside a normal directory + branch_layout_file_full_path = launch_command("file") + branch_layout_file_path = Path(branch_layout_file_full_path).parts + branch_layout_file_path_relative_to_git_dir = '/'.join(branch_layout_file_path[-2:]).rstrip('\n') + assert branch_layout_file_path_relative_to_git_dir == '.git/machete' if self.repo_sandbox.get_git_version() >= (2, 5): # `git worktree` command was introduced in git version 2.5 - # check git machete definition file path when inside a worktree using the default `True` value + # check branch layout file path when inside a worktree using the default `True` value # for the `machete.worktree.useTopLevelMacheteFile` key self.repo_sandbox\ .execute("git worktree add -f -b snickers_feature snickers_worktree develop")\ .chdir('snickers_worktree') - definition_file_full_path = launch_command("file") - definition_file_path = Path(definition_file_full_path).parts - definition_file_path_relative_to_git_dir = '/'.join(definition_file_path[-2:]).rstrip('\n') - assert definition_file_path_relative_to_git_dir == '.git/machete' + branch_layout_file_full_path = launch_command("file") + branch_layout_file_path = Path(branch_layout_file_full_path).parts + branch_layout_file_path_relative_to_git_dir = '/'.join(branch_layout_file_path[-2:]).rstrip('\n') + assert branch_layout_file_path_relative_to_git_dir == '.git/machete' - # check git machete definition file path when inside a worktree + # check branch layout file path when inside a worktree # but with the `machete.worktree.useTopLevelMacheteFile` key set to `False` self.repo_sandbox\ .set_git_config_key('machete.worktree.useTopLevelMacheteFile', 'false')\ .execute("git worktree add -f -b mars_feature mars_worktree develop")\ .chdir('mars_worktree') - definition_file_full_path = launch_command("file") - definition_file_path = Path(definition_file_full_path).parts - definition_file_path_relative_to_git_dir = '/'.join(definition_file_path[-4:]).rstrip('\n') - assert definition_file_path_relative_to_git_dir == '.git/worktrees/mars_worktree/machete' + branch_layout_file_full_path = launch_command("file") + branch_layout_file_path = Path(branch_layout_file_full_path).parts + branch_layout_file_path_relative_to_git_dir = '/'.join(branch_layout_file_path[-4:]).rstrip('\n') + assert branch_layout_file_path_relative_to_git_dir == '.git/worktrees/mars_worktree/machete' def test_file_outside_git_repo(self) -> None: os.chdir(mkdtemp()) diff --git a/tests/test_fork_point.py b/tests/test_fork_point.py index 027a0f851..4b5bcfcf1 100644 --- a/tests/test_fork_point.py +++ b/tests/test_fork_point.py @@ -3,7 +3,7 @@ from .base_test import BaseTest from .mockers import (assert_failure, assert_success, fixed_author_and_committer_date_in_past, launch_command, - rewrite_definition_file) + rewrite_branch_layout_file) class TestForkPoint(BaseTest): @@ -25,7 +25,7 @@ def test_fork_point_get(self) -> None: develop feature """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) # Test `git machete fork-point` without providing the branch name # hash 67007ed30def3b9b658380b895a9f62b525286e0 corresponds to the commit on develop branch @@ -80,7 +80,7 @@ def test_fork_point_override_to_commit(self) -> None: master develop """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) # invalid fork point with length not equal to 40 self.repo_sandbox.set_git_config_key('machete.overrideForkPoint.develop.to', 39 * 'a') @@ -133,7 +133,7 @@ def test_fork_point_override_to_parent_and_inferred(self) -> None: master develop """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) assert launch_command("fork-point").strip() == "a71ffac2c1d41b8d1592a25f0056e4dfca829608" assert launch_command("fork-point", "--inferred").strip() == "a71ffac2c1d41b8d1592a25f0056e4dfca829608" @@ -200,7 +200,7 @@ def test_fork_point_overridden_to_non_descendant_of_parent_while_branch_descenda branch-1 branch-2 """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) launch_command('fork-point', '--override-to=branch-0') assert launch_command("fork-point").strip() == self.repo_sandbox.get_commit_hash("branch-1") @@ -219,7 +219,7 @@ def test_fork_point_while_parent_unrelated_to_child(self) -> None: branch-1 branch-2 """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) assert_failure( ["fork-point"], diff --git a/tests/test_github.py b/tests/test_github.py index 701490aa4..9ff57cfc3 100644 --- a/tests/test_github.py +++ b/tests/test_github.py @@ -9,7 +9,7 @@ from tests.mockers import (assert_failure, assert_success, launch_command, mock__popen_cmd_with_fixed_results, mock_input_returning_y, overridden_environment, - rewrite_definition_file) + rewrite_branch_layout_file) from tests.mockers_github import (MockGitHubAPIState, mock_from_url, mock_github_token_for_domain_fake, mock_github_token_for_domain_none, @@ -63,13 +63,13 @@ def test_github_api_pagination(self, mocker: MockerFixture) -> None: self.repo_sandbox.check_out('develop').new_branch(f'feature_{i:02d}').commit().push() self.repo_sandbox.check_out('develop') body: str = 'develop *\n' + '\n'.join([f'feature_{i:02d}' for i in range(self.PR_COUNT_FOR_TEST_GITHUB_API_PAGINATION)]) + '\n' - rewrite_definition_file(body) + rewrite_branch_layout_file(body) self.repo_sandbox.check_out('develop') for i in range(self.PR_COUNT_FOR_TEST_GITHUB_API_PAGINATION): self.repo_sandbox.delete_branch(f"feature_{i:02d}") body = 'develop *\n' - rewrite_definition_file(body) + rewrite_branch_layout_file(body) launch_command('github', 'checkout-prs', '--all') launch_command('discover', '--checked-out-since=1 day ago') diff --git a/tests/test_github_anno_prs.py b/tests/test_github_anno_prs.py index 9c34e21cd..c4a886870 100644 --- a/tests/test_github_anno_prs.py +++ b/tests/test_github_anno_prs.py @@ -2,7 +2,7 @@ from tests.base_test import BaseTest from tests.mockers import (assert_failure, assert_success, launch_command, - rewrite_definition_file) + rewrite_branch_layout_file) from tests.mockers_github import (MockGitHubAPIState, mock_github_token_for_domain_fake, mock_repository_info, mock_urlopen) @@ -81,7 +81,7 @@ def test_github_anno_prs(self, mocker: MockerFixture) -> None: call-ws drop-constraint """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) # test that `anno-prs` add `rebase=no push=no` qualifiers to branches associated with the PRs whose owner # is different than the current user, overwrite annotation text but doesn't overwrite existing qualifiers @@ -184,7 +184,7 @@ def test_github_anno_prs_local_branch_name_different_than_tracking_branch_name(s feature feature_1 """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) launch_command("github", "anno-prs") expected_status_output = """ diff --git a/tests/test_github_checkout_prs.py b/tests/test_github_checkout_prs.py index ad3893780..6a7a833ef 100644 --- a/tests/test_github_checkout_prs.py +++ b/tests/test_github_checkout_prs.py @@ -6,7 +6,7 @@ from git_machete.github import GitHubClient, RemoteAndOrganizationAndRepository from tests.base_test import BaseTest, GitRepositorySandbox from tests.mockers import (assert_failure, assert_success, launch_command, - rewrite_definition_file) + rewrite_branch_layout_file) from tests.mockers_github import (MockGitHubAPIState, mock_from_url, mock_github_token_for_domain_fake, mock_github_token_for_domain_none, @@ -163,7 +163,7 @@ def test_github_checkout_prs(self, mocker: MockerFixture) -> None: restrict_access chore/redundant_checks """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) # not broken chain of pull requests (root found in dependency tree) launch_command('github', 'checkout-prs', '18') @@ -430,7 +430,7 @@ def test_github_checkout_prs_freshly_cloned(self, mocker: MockerFixture) -> None .push() ) os.chdir(self.repo_sandbox.local_path) - rewrite_definition_file("master") + rewrite_branch_layout_file("master") expected_msg = ("Checking for open GitHub PRs... OK\n" "Pull request #2 checked out at local branch comments/add_docstrings\n") assert_success( @@ -521,7 +521,7 @@ def test_github_checkout_prs_from_fork_with_deleted_repo(self, mocker: MockerFix root develop """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) expected_msg = ("Checking for open GitHub PRs... OK\n" "Warn: Pull request #2 comes from fork and its repository is already deleted. " "No remote tracking data will be set up for feature/allow_checkout branch.\n" @@ -691,7 +691,7 @@ def test_github_checkout_prs_of_current_user_and_other_users(self, mocker: Mocke testing/add_user chore/comments """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) # test that `checkout-prs` add `rebase=no push=no` qualifiers to branches associated with the PRs whose owner # is different than the current user diff --git a/tests/test_github_create_pr.py b/tests/test_github_create_pr.py index 55e5af40b..8177f2076 100644 --- a/tests/test_github_create_pr.py +++ b/tests/test_github_create_pr.py @@ -7,7 +7,7 @@ from tests.mockers import (assert_failure, assert_success, fixed_author_and_committer_date_in_past, launch_command, mock_input_returning, - mock_input_returning_y, rewrite_definition_file) + mock_input_returning_y, rewrite_branch_layout_file) from tests.mockers_github import (MockGitHubAPIState, mock_from_url, mock_github_token_for_domain_fake, mock_github_token_for_domain_none, @@ -90,7 +90,7 @@ def test_github_create_pr(self, mocker: MockerFixture) -> None: call-ws drop-constraint """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) launch_command("github", "create-pr") # ahead of origin state, push is advised and accepted @@ -226,7 +226,7 @@ def test_github_create_pr(self, mocker: MockerFixture) -> None: drop-constraint testing/endpoints """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) expected_error_message = "All commits in testing/endpoints branch are already included in develop branch.\n" \ "Cannot create pull request." @@ -276,7 +276,7 @@ def test_github_create_pr(self, mocker: MockerFixture) -> None: def test_github_create_pr_for_root_branch(self) -> None: self.repo_sandbox.new_branch("master").commit() - rewrite_definition_file("master") + rewrite_branch_layout_file("master") assert_failure( ["github", "create-pr"], "Branch master does not have a parent branch (it is a root), base branch for the PR cannot be established." @@ -321,7 +321,7 @@ def test_github_create_pr_missing_base_branch_on_remote(self, mocker: MockerFixt feature/api_handling feature/api_exception_handling """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) expected_msg = ("Fetching origin...\n" "Warn: Base branch for this PR (feature/api_handling) is not found on remote, pushing...\n" @@ -386,7 +386,7 @@ def test_github_create_pr_with_multiple_non_origin_remotes(self, mocker: MockerF branch-1 feature """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) self.patch_symbol(mocker, 'builtins.input', mock_input_returning('q')) expected_result = """ @@ -472,9 +472,9 @@ def test_github_create_pr_with_multiple_non_origin_remotes(self, mocker: MockerF assert_failure( ['github', 'create-pr'], "Command github create-pr can NOT be executed on the branch that is not managed by git machete " - "(is not present in git machete definition file). " + "(is not present in branch layout file). " "To successfully execute this command either add current branch to the file via commands add, discover or edit " - "or agree on adding the branch to the definition file during the execution of github create-pr command." + "or agree on adding the branch to the branch layout file during the execution of github create-pr command." ) self.patch_symbol(mocker, 'builtins.input', mock_input_returning('y')) @@ -601,7 +601,7 @@ def test_github_create_pr_for_no_push_qualifier(self, mocker: MockerFixture) -> .new_branch("develop").commit() ) - rewrite_definition_file("master\n\tdevelop push=no") + rewrite_branch_layout_file("master\n\tdevelop push=no") assert_success( ['github', 'create-pr'], @@ -619,7 +619,7 @@ def test_github_create_pr_for_no_remotes(self) -> None: .new_branch("develop").commit() ) - rewrite_definition_file("master\n\tdevelop") + rewrite_branch_layout_file("master\n\tdevelop") assert_failure( ['github', 'create-pr'], @@ -637,7 +637,7 @@ def test_github_create_pr_for_branch_behind_remote(self, mocker: MockerFixture) .new_branch("develop").commit().commit().push().reset_to("HEAD~") ) - rewrite_definition_file("master\n\tdevelop") + rewrite_branch_layout_file("master\n\tdevelop") self.patch_symbol(mocker, 'builtins.input', mock_input_returning('q')) assert_failure( @@ -663,7 +663,7 @@ def test_github_create_pr_for_untracked_branch(self, mocker: MockerFixture) -> N .new_branch("develop").commit() ) - rewrite_definition_file("master\n\tdevelop") + rewrite_branch_layout_file("master\n\tdevelop") self.patch_symbol(mocker, 'builtins.input', mock_input_returning('q')) assert_success( @@ -679,7 +679,7 @@ def test_github_create_pr_for_branch_diverged_from_and_newer_than_remote(self, m .amend_commit("Different commit message") ) - rewrite_definition_file("master\n\tdevelop") + rewrite_branch_layout_file("master\n\tdevelop") self.patch_symbol(mocker, 'builtins.input', mock_input_returning('yq')) assert_success( @@ -703,7 +703,7 @@ def test_github_create_pr_for_branch_diverged_from_and_older_than_remote(self, m with fixed_author_and_committer_date_in_past(): self.repo_sandbox.amend_commit() - rewrite_definition_file("master\n\tdevelop") + rewrite_branch_layout_file("master\n\tdevelop") self.patch_symbol(mocker, 'builtins.input', mock_input_returning('y')) assert_success( diff --git a/tests/test_github_retarget_pr.py b/tests/test_github_retarget_pr.py index 612b2cff3..4b6b6a770 100644 --- a/tests/test_github_retarget_pr.py +++ b/tests/test_github_retarget_pr.py @@ -4,7 +4,7 @@ from tests.base_test import BaseTest from tests.mockers import (assert_failure, assert_success, launch_command, - rewrite_definition_file) + rewrite_branch_layout_file) from tests.mockers_github import (MockGitHubAPIState, mock_from_url, mock_repository_info, mock_urlopen) @@ -80,7 +80,7 @@ def test_github_retarget_pr(self, mocker: MockerFixture) -> None: feature feature_4 """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) launch_command("anno", "-H") @@ -177,7 +177,7 @@ def test_github_retarget_pr_explicit_branch(self, mocker: MockerFixture) -> None feature branch-without-pr """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) launch_command("anno", "-H") expected_status_output = """ @@ -263,7 +263,7 @@ def test_github_retarget_pr_multiple_non_origin_remotes(self, mocker: MockerFixt branch-1 feature """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) expected_error_message = ( "Multiple non-origin remotes correspond to GitHub in this repository: origin_1, origin_2 -> aborting.\n" @@ -288,7 +288,7 @@ def test_github_retarget_pr_multiple_non_origin_remotes(self, mocker: MockerFixt feature feature_1 """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) assert_success( ['github', 'retarget-pr'], @@ -310,7 +310,7 @@ def test_github_retarget_pr_multiple_non_origin_remotes(self, mocker: MockerFixt feature_1 feature_2 """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) assert_failure(["github", "retarget-pr"], expected_error_message) @@ -342,7 +342,7 @@ def test_github_retarget_pr_multiple_non_origin_remotes(self, mocker: MockerFixt feature_2 feature_3 """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) assert_success( ['github', 'retarget-pr'], @@ -361,10 +361,10 @@ def test_github_retarget_pr_root_branch(self, mocker: MockerFixture) -> None: self.patch_symbol(mocker, 'urllib.request.urlopen', mock_urlopen(self.github_api_state_for_test_retarget_pr_root_branch)) self.repo_sandbox.new_branch("master").commit() - rewrite_definition_file("master") + rewrite_branch_layout_file("master") assert_failure( ['github', 'retarget-pr'], "Branch master does not have a parent branch (it is a root) even though there is an open PR #15 to root.\n" - "Consider modifying the branch definition file (git machete edit) so that master is a child of root." + "Consider modifying the branch layout file (git machete edit) so that master is a child of root." ) diff --git a/tests/test_github_sync.py b/tests/test_github_sync.py index 29f9289f1..bc75d01e2 100644 --- a/tests/test_github_sync.py +++ b/tests/test_github_sync.py @@ -2,7 +2,7 @@ from tests.base_test import BaseTest from tests.mockers import (assert_success, launch_command, - mock_input_returning_y, rewrite_definition_file) + mock_input_returning_y, rewrite_branch_layout_file) from tests.mockers_github import (MockGitHubAPIState, mock_from_url, mock_github_token_for_domain_fake, mock_repository_info, mock_urlopen) @@ -64,7 +64,7 @@ def test_github_sync(self, mocker: MockerFixture) -> None: moo2 snickers """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) ( self.repo_sandbox @@ -77,7 +77,7 @@ def test_github_sync(self, mocker: MockerFixture) -> None: expected_status_output = ( """ - Warning: sliding invalid branches: bar2, foo2, moo2 out of the definition file + Warning: sliding invalid branches: bar2, foo2, moo2 out of the branch layout file master | o-bar (untracked) diff --git a/tests/test_go.py b/tests/test_go.py index f7257695c..9db14aa25 100644 --- a/tests/test_go.py +++ b/tests/test_go.py @@ -5,7 +5,7 @@ from .base_test import BaseTest from .mockers import (assert_failure, assert_success, launch_command, - mock_input_returning, rewrite_definition_file) + mock_input_returning, rewrite_branch_layout_file) class TestGo(BaseTest): @@ -50,7 +50,7 @@ def test_go_up(self) -> None: level-0-branch level-1-branch """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) self.repo_sandbox.check_out("level-0-branch") assert_failure(["go", "up"], "Branch level-0-branch has no upstream branch") @@ -101,7 +101,7 @@ def test_go_down(self, mocker: MockerFixture) -> None: level-2a-branch level-2b-branch """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) self.repo_sandbox.check_out("level-0-branch") launch_command("go", "down") @@ -153,7 +153,7 @@ def test_go_first_root_with_downstream(self) -> None: a-additional-root branch-from-a-additional-root """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) self.repo_sandbox.check_out("level-3b-branch") launch_command("go", "first") @@ -182,7 +182,7 @@ def test_go_first_root_without_downstream(self) -> None: """ level-0-branch """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) launch_command("go", "first") assert 'level-0-branch' == launch_command("show", "current").strip(), \ @@ -229,7 +229,7 @@ def test_go_last(self) -> None: x-additional-root branch-from-x-additional-root """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) self.repo_sandbox.check_out("level-1a-branch") launch_command("go", "last", "--debug") @@ -277,7 +277,7 @@ def test_go_next_successor_exists(self) -> None: level-2a-branch level-1b-branch """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) launch_command("go", "next") assert 'level-1b-branch' == launch_command("show", "current").strip(), \ @@ -316,7 +316,7 @@ def test_go_next_successor_on_another_root_tree(self) -> None: level-1-branch x-additional-root """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) launch_command("go", "next") assert 'x-additional-root' == launch_command("show", "current").strip(), \ @@ -357,7 +357,7 @@ def test_go_prev_successor_exists(self) -> None: level-2a-branch level-1b-branch """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) launch_command("go", "prev") assert 'level-2a-branch' == launch_command("show", "current").strip(), \ @@ -394,7 +394,7 @@ def test_go_prev_successor_on_another_root_tree(self) -> None: a-additional-root level-0-branch """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) launch_command("go", "prev") assert 'a-additional-root' == launch_command("show", "current").strip(), \ @@ -441,7 +441,7 @@ def test_go_root(self) -> None: additional-root branch-from-additional-root """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) launch_command("go", "root") assert 'level-0-branch' == launch_command("show", "current").strip(), \ diff --git a/tests/test_is_managed.py b/tests/test_is_managed.py index 9c99236ee..85168e890 100644 --- a/tests/test_is_managed.py +++ b/tests/test_is_managed.py @@ -1,7 +1,7 @@ import pytest from .base_test import BaseTest -from .mockers import launch_command, rewrite_definition_file +from .mockers import launch_command, rewrite_branch_layout_file class TestIsManaged(BaseTest): @@ -26,7 +26,7 @@ def test_is_managed(self) -> None: develop feature """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) # Test `git machete is-managed` without providing the branch name launch_command('is-managed') diff --git a/tests/test_list.py b/tests/test_list.py index 6f7e51a6d..964294127 100644 --- a/tests/test_list.py +++ b/tests/test_list.py @@ -4,7 +4,7 @@ from .base_test import BaseTest from .mockers import (assert_failure, assert_success, launch_command, - rewrite_definition_file) + rewrite_branch_layout_file) class TestList(BaseTest): @@ -43,7 +43,7 @@ def test_list(self) -> None: feature_0_1 feature_1 """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) ( self.repo_sandbox diff --git a/tests/test_reapply.py b/tests/test_reapply.py index 12df0ce67..ae1a97c1b 100644 --- a/tests/test_reapply.py +++ b/tests/test_reapply.py @@ -2,7 +2,7 @@ from .base_test import BaseTest from .mockers import (assert_success, fixed_author_and_committer_date_in_past, launch_command, overridden_environment, - rewrite_definition_file) + rewrite_branch_layout_file) class TestReapply(BaseTest): @@ -37,7 +37,7 @@ def test_reapply(self) -> None: level-1-branch level-2-branch """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) self.repo_sandbox.check_out("level-1-branch") assert_success( diff --git a/tests/test_show.py b/tests/test_show.py index be2d7d8ee..88864f050 100644 --- a/tests/test_show.py +++ b/tests/test_show.py @@ -2,7 +2,7 @@ from .base_test import BaseTest from .mockers import (assert_failure, assert_success, launch_command, - rewrite_definition_file) + rewrite_branch_layout_file) class TestShow(BaseTest): @@ -59,7 +59,7 @@ def setup_standard_tree(self) -> None: hotfix/add-trigger ignore-trailing """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) assert_success( ["status"], @@ -111,7 +111,7 @@ def test_show_up(self) -> None: level-0-branch level-1-branch """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) assert 'level-0-branch' == launch_command("show", "up").strip(), \ ("Verify that 'git machete show up' displays name of a parent/upstream " @@ -174,7 +174,7 @@ def test_show_down(self) -> None: level-2-branch level-1b-branch """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) assert launch_command("show", "down").strip() == "level-1a-branch\nlevel-1b-branch" assert launch_command("show", "d").strip() == "level-1a-branch\nlevel-1b-branch" @@ -221,7 +221,7 @@ def test_show_first(self) -> None: a-additional-root branch-from-a-additional-root """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) assert 'level-1a-branch' == launch_command("show", "first").strip(), \ ("Verify that 'git machete show first' displays name of the first downstream " @@ -266,7 +266,7 @@ def test_show_last(self) -> None: x-additional-root branch-from-x-additional-root """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) assert 'level-1b-branch' == launch_command("show", "last").strip(), \ ("Verify that 'git machete show last' displays name of the last downstream " @@ -304,7 +304,7 @@ def test_show_next(self) -> None: level-2a-branch level-1b-branch """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) assert launch_command("show", "next").strip() == 'level-1b-branch' assert launch_command("show", "n").strip() == 'level-1b-branch' @@ -336,7 +336,7 @@ def test_show_prev(self) -> None: level-2a-branch level-1b-branch """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) assert launch_command("show", "prev").strip() == 'level-2a-branch' assert launch_command("show", "p").strip() == 'level-2a-branch' @@ -373,7 +373,7 @@ def test_show_root(self) -> None: additional-root branch-from-additional-root """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) assert 'level-0-branch' == launch_command("show", "root").strip(), \ ("Verify that 'git machete show root' displays name of the root of " diff --git a/tests/test_slide_out.py b/tests/test_slide_out.py index f3b2a19dc..fd79e972c 100644 --- a/tests/test_slide_out.py +++ b/tests/test_slide_out.py @@ -3,7 +3,7 @@ from .base_test import BaseTest from .mockers import (assert_failure, assert_success, fixed_author_and_committer_date_in_past, launch_command, - mock_input_returning_y, rewrite_definition_file) + mock_input_returning_y, rewrite_branch_layout_file) class TestSlideOut(BaseTest): @@ -42,7 +42,7 @@ def test_slide_out(self, mocker: MockerFixture) -> None: child_c child_d """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) assert_success( ["status", "-l"], @@ -178,7 +178,7 @@ def test_slide_out_with_post_slide_out_hook(self) -> None: branch-1 branch-2 """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) self.repo_sandbox.write_to_file(".git/hooks/machete-post-slide-out", '#!/bin/sh\necho "$@" > machete-post-slide-out-output') self.repo_sandbox.set_file_executable(".git/hooks/machete-post-slide-out") @@ -211,7 +211,7 @@ def test_slide_out_with_invalid_down_fork_point(self) -> None: branch-2 branch-3 """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) assert_failure( ['slide-out', '-n', 'branch-1', 'branch-2', '-d', hash_of_commit_that_is_not_ancestor_of_branch_2], @@ -232,7 +232,7 @@ def test_slide_out_with_down_fork_point_and_no_child_of_last_branch(self) -> Non branch-0 branch-1 """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) assert_failure( ['slide-out', '-d=@~', 'branch-1'], @@ -261,7 +261,7 @@ def test_slide_out_with_down_fork_point_and_single_child_of_last_branch(self) -> branch-2 branch-3 """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) launch_command( 'slide-out', '-n', 'branch-1', 'branch-2', '-d', hash_of_second_commit_on_branch_3) @@ -299,7 +299,7 @@ def test_slide_out_with_down_fork_point_and_multiple_children_of_last_branch(sel branch-2a branch-2b """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) assert_failure( ['slide-out', '-n', 'branch-1', '-d', hash_of_only_commit_on_branch_2b], @@ -329,7 +329,7 @@ def test_slide_out_with_invalid_sequence_of_branches(self) -> None: branch-3 branch-2b """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) assert_failure( ['slide-out', 'branch-0'], diff --git a/tests/test_status.py b/tests/test_status.py index 922eb1d47..25f94d1aa 100644 --- a/tests/test_status.py +++ b/tests/test_status.py @@ -10,12 +10,12 @@ from .mockers import (assert_failure, assert_success, fixed_author_and_committer_date_in_past, launch_command, mock_input_returning, mock_input_returning_y, - overridden_environment, rewrite_definition_file) + overridden_environment, rewrite_branch_layout_file) class TestStatus(BaseTest): - def test_branch_reappears_in_definition(self) -> None: + def test_branch_reappears_in_branch_layout(self) -> None: body: str = \ """ @@ -24,10 +24,10 @@ def test_branch_reappears_in_definition(self) -> None: \t\n develop """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) - expected_error_message: str = '.git/machete, line 6: branch develop re-appears in the tree definition. ' \ - 'Edit the definition file manually with git machete edit' + expected_error_message: str = '.git/machete, line 6: branch develop re-appears in the branch layout. ' \ + 'Edit the branch layout file manually with git machete edit' assert_failure(['status'], expected_error_message) def test_indent_not_multiply_of_base_indent(self) -> None: @@ -37,10 +37,10 @@ def test_indent_not_multiply_of_base_indent(self) -> None: \tdevelop \t foo """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) expected_error_message: str = '.git/machete, line 4: invalid indent , expected a multiply of . ' \ - 'Edit the definition file manually with git machete edit' + 'Edit the branch layout file manually with git machete edit' assert_failure(['status'], expected_error_message) def test_indent_too_deep(self) -> None: @@ -50,10 +50,10 @@ def test_indent_too_deep(self) -> None: \tdevelop \t\t\tfoo """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) expected_error_message: str = '.git/machete, line 4: too much indent (level 3, expected at most 2) for the branch foo. ' \ - 'Edit the definition file manually with git machete edit' + 'Edit the branch layout file manually with git machete edit' assert_failure(['status'], expected_error_message) def test_single_invalid_branch_interactive_slide_out(self, mocker: MockerFixture) -> None: @@ -70,10 +70,10 @@ def test_single_invalid_branch_interactive_slide_out(self, mocker: MockerFixture master \t\tfoo """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) expected_output = """ Skipping foo which is not a local branch (perhaps it has been deleted?). - Slide it out from the definition file? (y, e[dit], N) + Slide it out from the branch layout file? (y, e[dit], N) master * """ @@ -108,10 +108,10 @@ def test_multiple_invalid_branches_interactive_slide_out(self, mocker: MockerFix baz \t\tfeature """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) expected_output = """ Skipping foo, bar, qux, baz which are not local branches (perhaps they have been deleted?). - Slide them out from the definition file? (y, e[dit], N) + Slide them out from the branch layout file? (y, e[dit], N) master | o-develop @@ -137,7 +137,7 @@ def test_status_advice_ignored_non_executable_hook(self) -> None: master develop """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) self.repo_sandbox.write_to_file(".git/hooks/machete-status-branch", "#!/bin/sh\ngit ls-tree $1 | wc -l | sed 's/ *//'") assert_success( @@ -177,7 +177,7 @@ def test_status_branch_hook_output(self) -> None: develop """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) self.repo_sandbox.write_to_file(".git/hooks/machete-status-branch", "#!/bin/sh\ngit ls-tree $1 | wc -l | sed 's/ *//'") self.repo_sandbox.set_file_executable(".git/hooks/machete-status-branch") @@ -230,7 +230,7 @@ def test_extra_space_before_branch_name(self) -> None: bar foo """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) expected_status_output = ( """ @@ -282,7 +282,7 @@ def test_squashed_branch_recognized_as_merged_with_traverse(self) -> None: feature child """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) assert_success( ["status", "-l"], @@ -441,7 +441,7 @@ def test_status_inferring_counterpart_for_fetching_of_branch(self) -> None: snickers mars """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) expected_status_output = ( """ master @@ -474,7 +474,7 @@ def test_status_when_child_branch_is_pushed_immediately_after_creation(self) -> foo bar """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) expected_status_output = ( """ master @@ -502,7 +502,7 @@ def test_status_fork_point_without_reflogs(self) -> None: master develop """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) self.repo_sandbox.remove_directory(".git/logs/") @@ -537,7 +537,7 @@ def test_status_yellow_edges(self) -> None: feature-1 feature-2 """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) expected_status_output = ( """ @@ -595,7 +595,7 @@ def test_status_non_ascii_junctions(self) -> None: feature-1 feature-2 """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) expected_status_output = ( """\ @@ -624,7 +624,7 @@ def test_status_during_rebase(self) -> None: master develop """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) with overridden_environment(GIT_SEQUENCE_EDITOR="sed -i.bak '1s/^pick /edit /'"): launch_command("update") @@ -658,7 +658,7 @@ def test_status_during_side_effecting_operations(self) -> None: master develop """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) # AM @@ -740,7 +740,7 @@ def test_status_no_fork_point_for_child_branch(self) -> None: master develop """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) assert_success( ["status", "-l"], diff --git a/tests/test_traverse.py b/tests/test_traverse.py index 0c34e9f29..f0f5c9b4a 100644 --- a/tests/test_traverse.py +++ b/tests/test_traverse.py @@ -9,7 +9,7 @@ from .mockers import (assert_failure, assert_success, fixed_author_and_committer_date_in_past, launch_command, mock_input_returning, mock_input_returning_y, - overridden_environment, rewrite_definition_file) + overridden_environment, rewrite_branch_layout_file) class TestTraverse(BaseTest): @@ -66,7 +66,7 @@ def setup_standard_tree(self) -> None: hotfix/add-trigger ignore-trailing """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) assert_success( ["status"], """ @@ -108,7 +108,7 @@ def test_traverse_slide_out(self, mocker: MockerFixture) -> None: develop PR #123 feature """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) self.patch_symbol(mocker, 'builtins.input', mock_input_returning("n")) assert_success( @@ -331,7 +331,7 @@ def test_traverse_no_push_override(self) -> None: def test_traverse_ahead_of_remote_responses(self, mocker: MockerFixture) -> None: self.repo_sandbox.new_branch("master").commit().push().commit() - rewrite_definition_file("master") + rewrite_branch_layout_file("master") self.patch_symbol(mocker, 'builtins.input', mock_input_returning("q")) assert_success(["traverse"], "Push master to origin? (y, N, q, yq)\n") @@ -355,7 +355,7 @@ def test_traverse_behind_remote_responses(self, mocker: MockerFixture) -> None: self.repo_sandbox.new_branch("master")\ .commit().commit().push()\ .reset_to("HEAD~") - rewrite_definition_file("master") + rewrite_branch_layout_file("master") self.patch_symbol(mocker, 'builtins.input', mock_input_returning("q")) assert_success( @@ -390,7 +390,7 @@ def test_traverse_behind_remote_responses(self, mocker: MockerFixture) -> None: def test_traverse_diverged_from_and_newer_responses(self, mocker: MockerFixture) -> None: self.repo_sandbox.new_branch("master").commit().push().amend_commit("Different commit message") - rewrite_definition_file("master") + rewrite_branch_layout_file("master") self.patch_symbol(mocker, 'builtins.input', mock_input_returning("q")) assert_success( @@ -427,7 +427,7 @@ def test_traverse_diverged_from_and_older_responses(self, mocker: MockerFixture) self.repo_sandbox.new_branch("master").commit().push() with fixed_author_and_committer_date_in_past(): self.repo_sandbox.amend_commit() - rewrite_definition_file("master") + rewrite_branch_layout_file("master") self.patch_symbol(mocker, 'builtins.input', mock_input_returning("q")) assert_success( @@ -562,7 +562,7 @@ def test_traverse_no_push_no_checkout(self) -> None: master hotfix/add-trigger """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) assert_success( ["status"], """ @@ -722,7 +722,7 @@ def test_traverse_with_merge(self, mocker: MockerFixture) -> None: mars snickers """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) self.patch_symbol(mocker, "builtins.input", mock_input_returning("q")) launch_command("traverse", "-M") @@ -760,7 +760,7 @@ def test_traverse_qualifiers_no_push(self) -> None: \thotfix/add-trigger push=no \t\tignore-trailing """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) launch_command("traverse", "-Wy", "--no-push-untracked", "--push-untracked") assert_success( @@ -798,7 +798,7 @@ def test_traverse_qualifiers_no_rebase(self) -> None: \thotfix/add-trigger \t\tignore-trailing """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) launch_command("traverse", "-Wy") assert_success( @@ -836,7 +836,7 @@ def test_traverse_qualifiers_no_rebase_no_push(self) -> None: \thotfix/add-trigger \t\tignore-trailing """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) launch_command("traverse", "-Wy") assert_success( @@ -874,7 +874,7 @@ def test_traverse_qualifiers_no_slide_out(self) -> None: \thotfix/add-trigger \t\tignore-trailing """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) self.repo_sandbox.check_out('develop').merge('call-ws') launch_command("traverse", "-Wy") @@ -933,7 +933,7 @@ def test_traverse_removes_current_directory(self) -> None: with-directory without-directory """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) os.chdir("directory") @@ -991,7 +991,7 @@ def test_traverse_reset_keep_failing(self) -> None: .write_to_file(file_path="foo.txt", file_content="3") ) - rewrite_definition_file("master") + rewrite_branch_layout_file("master") assert_failure( ["traverse", "--fetch", "-y", "--debug"], @@ -1011,7 +1011,7 @@ def test_traverse_with_stop_for_edit(self, mocker: MockerFixture) -> None: .check_out("branch-0") .commit() ) - rewrite_definition_file("branch-0\n\tbranch-1") + rewrite_branch_layout_file("branch-0\n\tbranch-1") self.patch_symbol(mocker, 'builtins.input', mock_input_returning_y) with overridden_environment(GIT_SEQUENCE_EDITOR="sed -i.bak '1s/^pick /edit /'"): @@ -1040,7 +1040,7 @@ def test_reset_to_remote_after_rebase(self) -> None: .check_out("branch-0") .commit() ) - rewrite_definition_file("branch-0\n\tbranch-1") + rewrite_branch_layout_file("branch-0\n\tbranch-1") with fixed_author_and_committer_date_in_past(): assert_success( @@ -1069,7 +1069,7 @@ def test_reset_to_remote_after_rebase(self) -> None: def test_traverse_quit_on_pushing_untracked(self, mocker: MockerFixture) -> None: self.repo_sandbox.new_branch("master").commit() - rewrite_definition_file("master") + rewrite_branch_layout_file("master") self.patch_symbol(mocker, 'builtins.input', mock_input_returning("q")) assert_success( ["traverse"], @@ -1089,7 +1089,7 @@ def test_traverse_multiple_remotes(self, mocker: MockerFixture) -> None: ) self.repo_sandbox.new_branch("master").commit() - rewrite_definition_file("master") + rewrite_branch_layout_file("master") self.patch_symbol(mocker, 'builtins.input', mock_input_returning("xd")) assert_success( @@ -1142,7 +1142,7 @@ def test_traverse_yellow_edges(self, mocker: MockerFixture) -> None: feature-1 feature-2 """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) self.patch_symbol(mocker, 'builtins.input', mock_input_returning("n", "n")) assert_success( diff --git a/tests/test_update.py b/tests/test_update.py index 2130980a8..3f624387f 100644 --- a/tests/test_update.py +++ b/tests/test_update.py @@ -6,7 +6,7 @@ from .mockers import (assert_failure, assert_success, fixed_author_and_committer_date_in_past, launch_command, mock_input_returning, mock_input_returning_y, - overridden_environment, rewrite_definition_file) + overridden_environment, rewrite_branch_layout_file) class TestUpdate(BaseTest): @@ -33,7 +33,7 @@ def test_update_with_fork_point_not_specified(self) -> None: level-1-branch level-2-branch """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) parents_new_commit_hash = self.repo_sandbox.get_current_commit_hash() self.repo_sandbox.check_out("level-1-branch") @@ -63,7 +63,7 @@ def test_update_by_merge(self) -> None: level-1-branch level-2-branch """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) self.repo_sandbox.check_out("level-1-branch") old_level_1_commit_hash = self.repo_sandbox.get_current_commit_hash() @@ -93,7 +93,7 @@ def test_update_drops_empty_commits(self) -> None: level-0-branch level-1-branch """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) parents_new_commit_hash = self.repo_sandbox.get_current_commit_hash() self.repo_sandbox.check_out("level-1-branch") @@ -147,7 +147,7 @@ def test_update_with_fork_point_specified(self) -> None: root branch-1 """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) launch_command( "update", "--no-interactive-rebase", "-f", branch_second_commit_hash) @@ -187,7 +187,7 @@ def test_update_with_invalid_fork_point(self) -> None: branch-1a branch-1b """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) expected_error_message = "Fork point 807bcd9f5e9c7e52e7866eedcb58c2e000526700 " \ "is not ancestor of or the tip of the branch-1b branch." @@ -202,7 +202,7 @@ def test_update_with_stop_for_edit(self) -> None: .new_branch("branch-1") .commit() ) - rewrite_definition_file("branch-0\n\tbranch-1") + rewrite_branch_layout_file("branch-0\n\tbranch-1") with overridden_environment(GIT_SEQUENCE_EDITOR="sed -i.bak '1s/^pick /edit /'"): launch_command("update") @@ -225,7 +225,7 @@ def test_update_unmanaged_branch(self, mocker: MockerFixture) -> None: .commit() .check_out("branch-1") ) - rewrite_definition_file("branch-0") + rewrite_branch_layout_file("branch-0") original_branch_1_hash = self.repo_sandbox.get_commit_hash("branch-1") self.patch_symbol(mocker, "builtins.input", mock_input_returning("")) @@ -267,7 +267,7 @@ def test_update_with_pre_rebase_hook(self) -> None: branch-0 branch-1 """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) self.repo_sandbox.write_to_file(".git/hooks/machete-pre-rebase", '#!/bin/sh\necho "$@" > machete-pre-rebase-output') self.repo_sandbox.set_file_executable(".git/hooks/machete-pre-rebase") @@ -315,7 +315,7 @@ def test_update_during_side_effecting_operations(self) -> None: master develop """ - rewrite_definition_file(body) + rewrite_branch_layout_file(body) # AM diff --git a/tox.ini b/tox.ini index 94ed9d676..83340a3ab 100644 --- a/tox.ini +++ b/tox.ini @@ -3,7 +3,7 @@ # Let's still include pep8-check despite a preceding autopep8 run to filter out certain errors # (like W293 blank line in multiline strings contains whitespace) # that don't seem to ever get fixed by autopep8. -envlist = pep8,isort,pep8-check,mypy-py311,vulture-check +envlist = pep8,isort,pep8-check,mypy-py311,vulture-check,sphinx-man,py-docs minversion = 2.3.2 skipsdist = True