Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release notes

## New in git-machete 3.46.0

- added: `machete.github.retrieveByAuthor` and `machete.gitlab.retrieveByAuthor` git config keys
that make PR/MR-listing commands download open PRs/MRs by author (the current user by default, or `--by=<user>` when given) instead of all of them,
which can speed up operations considerably in repositories/projects with many open PRs/MRs

## New in git-machete 3.45.1

- added: `advice.macheteCreateFromFork` git config key suppresses the fork warning in `github create-pr` and `gitlab create-mr` when set to `false` (contributed by @be-student)
Expand Down
78 changes: 77 additions & 1 deletion docs/man/git-machete.1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions docs/source/cli/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ Note: ``config`` is not a command as such, just a help topic (there is no ``git
``machete.github.prDescriptionIntroStyle``
.. include:: git-config-keys/github.prDescriptionIntroStyle.rst

``machete.github.retrieveByAuthor``
.. include:: git-config-keys/github.retrieveByAuthor.rst

``machete.gitlab.{domain,remote,namespace,project,baseRemote,baseNamespace,baseProject}``
.. include:: git-config-keys/gitlab.access.rst

Expand All @@ -32,6 +35,9 @@ Note: ``config`` is not a command as such, just a help topic (there is no ``git
``machete.gitlab.mrDescriptionIntroStyle``
.. include:: git-config-keys/gitlab.mrDescriptionIntroStyle.rst

``machete.gitlab.retrieveByAuthor``
.. include:: git-config-keys/gitlab.retrieveByAuthor.rst

``machete.overrideForkPoint.<branch>.to``
Executing ``git machete fork-point --override-to[-parent|-inferred|=<revision>] [<branch>]`` sets up a fork point override for ``<branch>``.

Expand Down
3 changes: 3 additions & 0 deletions docs/source/cli/github.rst
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ Create, check out and manage GitHub PRs while keeping them reflected in branch l
``machete.github.prDescriptionIntroStyle`` (``create-pr``, ``restack-pr`` and ``retarget-pr``)
.. include:: git-config-keys/github.prDescriptionIntroStyle.rst

``machete.github.retrieveByAuthor`` (``anno-prs``, ``checkout-prs`` and ``update-pr-descriptions``)
.. include:: git-config-keys/github.retrieveByAuthor.rst

**Environment variables (all subcommands)**

``GITHUB_TOKEN``
Expand Down
3 changes: 3 additions & 0 deletions docs/source/cli/gitlab.rst
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ Create, check out and manage GitLab MRs while keeping them reflected in branch l
``machete.gitlab.mrDescriptionIntroStyle`` (``create-mr``, ``restack-mr`` and ``retarget-mr``)
.. include:: git-config-keys/gitlab.mrDescriptionIntroStyle.rst

``machete.gitlab.retrieveByAuthor`` (``anno-mrs``, ``checkout-mrs`` and ``update-mr-descriptions``)
.. include:: git-config-keys/gitlab.retrieveByAuthor.rst

**Environment variables (all subcommands)**

``GITLAB_TOKEN``
Expand Down
17 changes: 17 additions & 0 deletions docs/source/git-config-keys/github.retrieveByAuthor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
When set to ``true``, commands that need to list open pull requests in the repository
(such as ``github anno-prs``, ``github checkout-prs`` and ``traverse`` with GitHub integration)
download open PRs by author rather than every open PR in the repository.

By default (and with ``--mine``), that author is the current user as determined from the GitHub API token.
The ``--by=<login>`` flag selects a different author instead; chain reconstruction (walking upstream/downstream PRs)
uses that same author's PRs, not the current user's.
When checking out specific PR numbers, the author of the first given PR is used instead.

This can speed up operations considerably in repositories with hundreds or thousands of open PRs,
at the cost of not being able to discover PRs opened by other users when traversing PR chains
(for example, when checking out an entire stack that includes PRs from multiple authors).

A valid GitHub API token is required when this key is set.

The ``--all`` flag to ``github checkout-prs`` and ``github update-pr-descriptions``
still downloads all open PRs in the repository, regardless of this setting.
17 changes: 17 additions & 0 deletions docs/source/git-config-keys/gitlab.retrieveByAuthor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
When set to ``true``, commands that need to list open merge requests in the project
(such as ``gitlab anno-mrs``, ``gitlab checkout-mrs`` and ``traverse`` with GitLab integration)
download open MRs by author rather than every open MR in the project.

By default (and with ``--mine``), that author is the current user as determined from the GitLab API token.
The ``--by=<username>`` flag selects a different author instead; chain reconstruction (walking upstream/downstream MRs)
uses that same author's MRs, not the current user's.
When checking out specific MR numbers, the author of the first given MR is used instead.

This can speed up operations considerably in projects with hundreds or thousands of open MRs,
at the cost of not being able to discover MRs opened by other users when traversing MR chains
(for example, when checking out an entire stack that includes MRs from multiple authors).

A valid GitLab API token is required when this key is set.

The ``--all`` flag to ``gitlab checkout-mrs`` and ``gitlab update-mr-descriptions``
still downloads all open MRs in the project, regardless of this setting.
2 changes: 1 addition & 1 deletion git_machete/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '3.45.1'
__version__ = '3.46.0'
4 changes: 2 additions & 2 deletions git_machete/client/traverse.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def traverse(

needs_retarget_pr = False
if opt_sync_github_prs or opt_sync_gitlab_mrs:
prs = list(filter(lambda pr: pr.head == branch, self._get_all_open_prs()))
prs = list(filter(lambda pr: pr.head == branch, self._get_relevant_open_prs()))
if len(prs) > 1:
spec = self.code_hosting_spec
raise MacheteException(
Expand All @@ -274,7 +274,7 @@ def traverse(
needs_create_pr = False
if opt_sync_github_prs or opt_sync_gitlab_mrs:
if parent:
prs = [_pr for _pr in self._get_all_open_prs() if _pr.head == branch]
prs = [_pr for _pr in self._get_relevant_open_prs() if _pr.head == branch]
if not prs:
if branch_anno is None or branch_anno.qualifiers.push:
needs_create_pr = True
Expand Down
Loading