Commit Graph

14 Commits

Author SHA1 Message Date
Amaury Denoyelle b27470fd1d SCRIPTS: git-show-backports: do not truncate git-show output
git-show-backports lists a git-show command which can be used to inspect
all commits subject to backport. This command specifies formatting
option to reproduce default git-show output, especially for commit
messages indented with 4 spaces character. However, it also add wrapping
on message line longer than 72 characters. This reduce lisibility of
messages where large info are written such as backtraces.

Improve this by changing git-show format option. Use a limit value of 0
to disable wrapping while preserving indentation.

This could be backported to every stable version to simplify backporting
process.
2024-06-21 15:08:42 +02:00
Willy Tarreau f97db23b6d SCRIPTS: git-show-backports: automatic ref and base detection with -m
When running with -m (check for missing backports) we often have to fill
lots of information that can be determined automatically the vast majority
of the time:
  - restart point (last cherry-picked ID from one of the last commits)
  - current branch (HEAD)
  - reference branch (the one that contains most of the last commits)

These elements are not that hard to determine, so let's make sure we
can fall back to them when running in missing mode.

The reference branch is guessed by looking at the upstream branch that
most frequently contains some of the last 10 commits. It can be inaccurate
if multiple branches exist with these commits, or when upstream changes
due to a non-LTS branch disappearing in the middle of the series, in which
case passing "-r" will help. But most of the time it works OK. It also gives
precedence to local branches over remote ones for such choices. A test in
2.4 at commit 793a4b520 correctly shows 2.6/master as the upstream despite
2.5 having been used for the early ones of the tag.

For the restart point, we assume that the most recent commit that was
backported serves as a reference (and not the most recently backported
commit). This means that the usual case where an old commit was found
to be missing will not fool the analysis. Commits are inspected from
2 commits before the last tag, and reordered from the parent's tree
to see which one is the last one.

With this, it's sufficient to issue "git-show-backports -q -m" to get
the list of backports from the upstream branch, restarting from the
last backported one.
2023-08-14 13:12:56 +02:00
Willy Tarreau 0d026edaef SCRIPTS: git-show-backports: re-enable file-based filtering
The early version of the script used to support passing non-branch
arguments but as it evolved we lost that option. Let's use "--" as a
delimiter after the branch(es) to pass optional file names to filter
on. This is convenient to list missing patches on a specific set of
files.
2021-11-03 08:41:01 +01:00
Willy Tarreau 1f927d1bc2 SCRIPTS: git-show-backports: emit the shell command to backport a commit
It's cumbersome to copy-paste a commit ID into another window after having
typed "git cherry-pick -sx", so let's have the suggested output format of
git-show prepare this line just before the subject line, it remains at a
stable position on the terminal when searching for "/^commit". One just
has to copy-paste the line into another terminal will result in the commit
being properly picked.
2020-07-31 16:57:35 +02:00
Willy Tarreau f456f6f2a3 SCRIPTS: git-show-backports: make -m most only show the left branch
We've never used the output of the rightmost branch with this tool,
and it systematically causes two identical outputs making the job
harder during backport sessions. Let's simply remove the right part
when it's identical to the left one. This also adds a few line feeds
to make the output more readable.
2020-07-31 16:57:09 +02:00
Willy Tarreau be9b00f992 SCRIPTS: use /usr/bin/env bash instead of /bin/bash for scripts
Given that some OSes have bash in /usr/local/bin and in order not to
give too easy an excuse to Olivier for not backporting fixes, let's
make a few scripts rely on /usr/bin/env bash instead of /bin/bash :-)
2020-02-05 04:49:07 +01:00
Willy Tarreau 1a3af78302 SCRIPTS: git-show-backports: add "-s" to proposed cherry-pick commands
Since we're using signed-off-by tags for backports, let's add -s to
the command so that we can finally copy-paste it!
2019-11-25 15:51:47 +01:00
Willy Tarreau 48d92ee3f4 SCRIPTS: git-show-backports: add missing quotes to "echo"
Two places were not properly protected, resulting in '*' in commit
subjects being interpreted!
2018-07-30 14:45:55 +02:00
Willy Tarreau 5e637e556d SCRIPTS: git-show-backports: add -H to use the hash of the commit message
Sometimes certain commits don't contain useful tracking information but
we'd still like to be able to report them. Here we implement a hash on
the author's name, e-mail and date, the subject and the body before the
first s-o-b or cherry-picked line. These parts are supposed to be
reasonable invariant across backports and are usable to compute an
invariant hash of a given commit. When we don't find ancestry in a
commit, we try this method (if -H is specified) to compare commits
hashes and we can report a match. The equivalent commit is reported
as "XXXX+?" to indicate that it's an apparent backport but we don't
know how far it goes.
2016-12-14 16:48:16 +01:00
Willy Tarreau b684cd4642 SCRIPTS: git-show-backports: fix a harmless typo
There was a double output redirection in this script while dumping the
current branch's refs which could cause either an error or an empty file.
2016-12-14 16:48:16 +01:00
Willy Tarreau ef393a62d8 SCRIPTS: make git-show-backports also dump a "git show" command
This is very convenient for backport reviews as in a single
command you get all the patches one at a time with their
changelog and backport instructions.
2016-10-25 22:12:54 +02:00
Willy Tarreau 29c44e1f1e SCRIPTS: make git-show-backports capable of limiting its history
When comparing very different branches, it can take a very long time
to scan all commits from the very old common ancestor (eg: haproxy
1.4 to 1.7). Now it is possible to specify a range of commits instead
of a specific branch, and the analysis will be limited to this range
for all commits. The user is responsible for ensuring that the range
covers all possible backports from base to ref, otherwise some of them
may be reported missing while they are not.

This also works with linux kernels, for example :

   git-show-backports -u -q -m -r v3.14.69 -b v3.14.65 v3.10.101..HEAD
2016-05-19 07:19:19 +02:00
Willy Tarreau 29b684bf86 SCRIPTS: teach git-show-backports how to report upstream commits
When git-show-backports is called with -u, instead of reporting the
commit IDs of the original branch on the left, it will display the
upstream commit IDs when such IDs are known, and will also display
them in the suggested "git cherry-pick" command line. This is useful
when the new branch is more recent than the one being checked and/or
it is desired to get rid of intermediary changes.
2016-05-19 07:19:19 +02:00
Willy Tarreau 62b71eea5e BUILD: add a few release and backport scripts in scripts/
These ones have been used for several months already and are quite
convenient to emit new releases and backport fixes. I'm fed up with
having different versions on different machines, let's commit them
now.
2016-05-10 12:08:44 +02:00