History log of /u-boot/tools/patman/settings.py
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 8f8d3f72 19-Dec-2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>

patman: additionally honor a local .patman config file

This enables versioning a project specific patman configuration file.
It also makes it possible to declare the project name, which is not a
useful thing to do in $HOME/.patman. A new test is added, along
updated documentation.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# db16edd8 19-Dec-2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>

patman: fail early in Setup when provided config file does not exist

Rationale: if the user explicitly provide this argument, they probably
intend for it to be used.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 2c58a5e2 19-Dec-2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>

patman: set the default config_fname argument value to None

This better matches Python conventions, allowing to easily test
whether the optional argument is provided.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 57e3b03f 19-Dec-2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>

patman: import gitutil module where it is needed

Instead of propagating it from the module entry point (main script).

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8b73f9bf 19-Dec-2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>

patman: replace deprecated SafeConfigParser with ConfigParser

The SafeConfigParser class has been renamed in Python 3.2 to
ConfigParser, and the old alias has been deprecated since.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 872f3a4c 19-Dec-2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>

patman: fix pep8 warnings in settings module

Remove extraneous imports, variables and comply to PEP 8 maximum line
width, among other PEP 8 changes suggested by Pyflake.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# dce4322c 19-Jul-2022 Douglas Anderson <dianders@chromium.org>

patman: By default don't pass "--no-tree" to checkpatch for linux

When you pass "--no-tree" to checkpatch it disables some extra checks
that are important for Linux. Specifically I want checks like:

warning: DT compatible string "boogie,woogie" appears un-documented
check ./Documentation/devicetree/bindings/

Let's make the default for Linux to _not_ pass --no-tree. We'll have a
config option and command line flag to override.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4780f7d8 29-Apr-2022 Sean Anderson <sean.anderson@seco.com>

patman: Fix defaults not propagating to subparsers

On python 3.8.10 (and 3.10), subparsers are not updated with defaults. I
suspect this is related to [1]. Fix this by explicitly updating
subparsers with settings.

[1] https://github.com/python/cpython/issues/89398

Fixes: 3145b63513 ("patman: Update defaults in subparsers")
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Tested-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>

# 32cc6ae2 11-Feb-2022 Simon Glass <sjg@chromium.org>

patman: Correct pylint errors

Fix pylint errors that can be fixed and mask those that seem to be
incorrect.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0157b187 29-Jan-2022 Simon Glass <sjg@chromium.org>

patman: Convert camel case in gitutil.py

Convert this file to snake case and update all files which use it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ddc44c2c 24-Nov-2020 Philipp Tomsich <philipp.tomsich@vrull.eu>

patman: Add project-default for 'gcc'

Add defaults for FSF/GNU projects, such as gcc, that provide sensible
settings for those projects.

Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Reviewed-by: Simon Glass <sjg@chromium.org>

# fc0056e8 08-Nov-2020 Simon Glass <sjg@chromium.org>

patman: Drop unicode helper functions

We don't need these now that everything uses Python 3. Remove them and
the extra code in GetBytes() and ToBytes() too.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3145b635 03-Nov-2020 Simon Glass <sjg@chromium.org>

patman: Update defaults in subparsers

At present values from the settings file are only applied to the main
parser. With the new parser structure this means that some settings are
ignored.

Update the implementation to set defaults across the main parser and all
subparsers. Also fix up the comments, since ArgumentParser is being used
now.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fda1e372 05-Jul-2020 Simon Glass <sjg@chromium.org>

patman: Convert to ArgumentParser

Convert from OptionParser to ArgumentParser to match binman. With this we
can easily add sub-commands.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7208396b 24-Jul-2020 Tom Rini <trini@konsulko.com>

Revert "Merge tag 'dm-pull-20jul20' of git://git.denx.de/u-boot-dm"

This reverts commit 5d3a21df6694ebd66d5c34c9d62a26edc7456fc7, reversing
changes made to 56d37f1c564107e27d873181d838571b7d7860e7.

Unfortunately this is causing CI failures:
https://travis-ci.org/github/trini/u-boot/jobs/711313649

Signed-off-by: Tom Rini <trini@konsulko.com>

# e676fab7 05-Jul-2020 Simon Glass <sjg@chromium.org>

patman: Convert to ArgumentParser

Convert from OptionParser to ArgumentParser to match binman. With this we
can easily add sub-commands.

Signed-off-by: Simon Glass <sjg@chromium.org>

# dd3dac2f 07-Jun-2020 Simon Glass <sjg@chromium.org>

patman: Avoid importing gitutil in settings

Pass this module in so that settings does not need to import it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Stefan Bosch <stefan_b@posteo.net>

# bf776679 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Move to absolute imports

At present patman sets the python path on startup so that it can access
the libraries it needs. If we convert to use absolute imports this is not
necessary.

Move patman to use absolute imports. This requires changes in tools which
use the patman libraries (which is most of them).

Signed-off-by: Simon Glass <sjg@chromium.org>

# c3a13cc3 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Drop Python 2 StringIO code

We can rely on Python 3 now, so drop the workaround for importing
StringIO.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 83a45187 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Drop references to __future__

We don't need these now that the tools using Python 3. Drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 272cd85d 31-Oct-2019 Simon Glass <sjg@chromium.org>

patman: Use unicode for file I/O

At present patman test fail in some environments which don't use utf-8
as the default file encoding. Add this explicitly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ebb45c7 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Avoid unicode type in settings unit tests

The unicode type does not exist in Python 3 and when displaying strings
they do not have the 'u' prefix. Adjusts the settings unit tests to deal
with this difference, by converting the comparison value to a string, thus
dropping the 'u'.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 513eace4 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Move unicode helpers to tools

Create helper functions in the tools module to deal with the differences
between unicode in Python 2 (where we use the 'unicode' type) and Python 3
(where we use the 'str' type).

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a4c5dd4 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Use items() instead of iteritems()

Python 3 requires this, and Python 2 allows it. Convert the code over to
ensure compatibility with Python 3.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ec9e0f47 01-Oct-2018 Simon Glass <sjg@chromium.org>

patman: Handle unicode in _ProjectConfigParser tests

With Python 2.7.15rc1, ConfigParser.SafeConfigParser has unfortunately
started returning unicode, for unknown reasons. Adjust the code to handle
this by converting everything to unicode. We cannot convert things to
ASCII since email addresses may be encoded with UTF-8.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b8a48fbc 27-Jun-2018 Adam Sampson <ats@offog.org>

patman: Split alias entries on arbitrary whitespace

Previously the first three words in a git-mailrc alias entry could only
be separated by spaces. git-send-email and Mutt both allow arbitrary
whitespace here.

Signed-off-by: Adam Sampson <ats@offog.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# ad893140 12-Sep-2017 Simon Glass <sjg@chromium.org>

patman: Fix error when the email blacklist is missing

This section of the settings file may be missing. Handle that gracefully
rather than emitting an error.

Also update patman to write this section when a new settings file is
created.

Fixes: e11aa602 (patman: add support for omitting bouncing addresses)

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Chris Packham <judge.pckham@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>

# e11aa602 01-Sep-2017 Chris Packham <judge.packham@gmail.com>

patman: add support for omitting bouncing addresses

Add support for reading a list of bouncing addresses from a in-tree file
(doc/bounces) and from the ~/.patman config file. These addresses are
stripped from the Cc list.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com <mailto:philipp.tomsich@theobroma-systems.com>>

# f5d44b9b 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Fix doctest StringIO import for python 3.x

In python 3.x StringIO is no longer a module, and the class can instead
be found in the io module. Adjust the code in the doctest input to
account for both.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# c9eac38a 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Use items() to iterate over dictionaries

In python 3.x the iteritems() method has been removed from dictionaries,
and the items() method does effectively the same thing. On python 2.x
using items() is a little less efficient since it involves copying data,
but as speed isn't a concern in this code switch to using items() anyway
for simplicity.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2ce7b21e 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Import 'configparser' lower case to be python 3.x safe

In python 3.x module names used in import statements are case sensitive,
and the configparser module is named in all lower-case. Import it as such
in order to avoid errors when running with python 3.x.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# a920a17b 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Make print statements python 3.x safe

In python 3.x, print must be used as a function call. Convert all print
statements to the function call style, importing from __future__ where
we print with no trailing newline or print to a file object.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 8895b3e1 29-Jan-2015 Simon Glass <sjg@chromium.org>

patman: Read in the git-mailrc alias file

We should read this file to obtain a set of aliases. This reduces the need
to create them in the ~/.patman file.

This feature did exist in some version of patman, and is mentioned in the
help but it did not find its way upstream.

Reported-by: Graeme Russ <gruss@tss-engineering.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a1dcee84 03-Dec-2012 Doug Anderson <dianders@chromium.org>

patman: Add the concept of multiple projects

There are cases that we want to support different settings (or maybe
even different aliases) for different projects. Add support for this
by:
* Adding detection for two big projects: U-Boot and Linux.
* Adding default settings for Linux (U-Boot is already good with the
standard patman defaults).
* Extend the new "settings" feature in .patman to specify per-project
settings.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 8568baed 03-Dec-2012 Doug Anderson <dianders@chromium.org>

patman: Add support for settings in .patman

This patch adds support for a [settings] section in the .patman file.
In this section you can add settings that will affect the default
values for command-line options.

Support is added in a generic way such that any setting can be updated
by just referring to the "dest" of the option that is passed to the
option parser. At the moment options that would make sense to put in
settings are "ignore_errors", "process_tags", and "verbose". You
could override them like:

[settings]
ignore_errors: True
process_tags: False
verbose: True

The settings functionality is also used in a future change which adds
support for per-project settings.

Signed-off-by: Doug Anderson <dianders@chromium.org>

# 87d65558 23-May-2012 Vikram Narayanan <vikram186@gmail.com>

patman: Handle creation of patman config file

patman shouts when it couldn't find a $(HOME)/.patman file.
Handle it in a sane way by creating a new one for the user.
It looks for a user.name and user.email in the global .gitconfig
file, waits for the user input if it can't find there. Update the
same in the README

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>

# 2b36c75d 23-May-2012 Vikram Narayanan <vikram186@gmail.com>

patman: Change the location of patman config file

Move the config file from ~/.config/patman to ~/.patman as it is
more appropriate to have it there. Update the same in the README.

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>

# 0d24de9d 14-Jan-2012 Simon Glass <sjg@chromium.org>

Add 'patman' patch generation, checking and submission script

What is this?

=============

This tool is a Python script which:
- Creates patch directly from your branch
- Cleans them up by removing unwanted tags
- Inserts a cover letter with change lists
- Runs the patches through checkpatch.pl and its own checks
- Optionally emails them out to selected people

It is intended to automate patch creation and make it a less
error-prone process. It is useful for U-Boot and Linux work so far,
since it uses the checkpatch.pl script.

It is configured almost entirely by tags it finds in your commits.
This means that you can work on a number of different branches at
once, and keep the settings with each branch rather than having to
git format-patch, git send-email, etc. with the correct parameters
each time. So for example if you put:

in one of your commits, the series will be sent there.

See the README file for full details.
END

Signed-off-by: Simon Glass <sjg@chromium.org>

# dce4322c 19-Jul-2022 Douglas Anderson <dianders@chromium.org>

patman: By default don't pass "--no-tree" to checkpatch for linux

When you pass "--no-tree" to checkpatch it disables some extra checks
that are important for Linux. Specifically I want checks like:

warning: DT compatible string "boogie,woogie" appears un-documented
check ./Documentation/devicetree/bindings/

Let's make the default for Linux to _not_ pass --no-tree. We'll have a
config option and command line flag to override.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4780f7d8 29-Apr-2022 Sean Anderson <sean.anderson@seco.com>

patman: Fix defaults not propagating to subparsers

On python 3.8.10 (and 3.10), subparsers are not updated with defaults. I
suspect this is related to [1]. Fix this by explicitly updating
subparsers with settings.

[1] https://github.com/python/cpython/issues/89398

Fixes: 3145b63513 ("patman: Update defaults in subparsers")
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Tested-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>

# 32cc6ae2 11-Feb-2022 Simon Glass <sjg@chromium.org>

patman: Correct pylint errors

Fix pylint errors that can be fixed and mask those that seem to be
incorrect.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0157b187 29-Jan-2022 Simon Glass <sjg@chromium.org>

patman: Convert camel case in gitutil.py

Convert this file to snake case and update all files which use it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ddc44c2c 24-Nov-2020 Philipp Tomsich <philipp.tomsich@vrull.eu>

patman: Add project-default for 'gcc'

Add defaults for FSF/GNU projects, such as gcc, that provide sensible
settings for those projects.

Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Reviewed-by: Simon Glass <sjg@chromium.org>

# fc0056e8 08-Nov-2020 Simon Glass <sjg@chromium.org>

patman: Drop unicode helper functions

We don't need these now that everything uses Python 3. Remove them and
the extra code in GetBytes() and ToBytes() too.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3145b635 03-Nov-2020 Simon Glass <sjg@chromium.org>

patman: Update defaults in subparsers

At present values from the settings file are only applied to the main
parser. With the new parser structure this means that some settings are
ignored.

Update the implementation to set defaults across the main parser and all
subparsers. Also fix up the comments, since ArgumentParser is being used
now.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fda1e372 05-Jul-2020 Simon Glass <sjg@chromium.org>

patman: Convert to ArgumentParser

Convert from OptionParser to ArgumentParser to match binman. With this we
can easily add sub-commands.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7208396b 24-Jul-2020 Tom Rini <trini@konsulko.com>

Revert "Merge tag 'dm-pull-20jul20' of git://git.denx.de/u-boot-dm"

This reverts commit 5d3a21df6694ebd66d5c34c9d62a26edc7456fc7, reversing
changes made to 56d37f1c564107e27d873181d838571b7d7860e7.

Unfortunately this is causing CI failures:
https://travis-ci.org/github/trini/u-boot/jobs/711313649

Signed-off-by: Tom Rini <trini@konsulko.com>

# e676fab7 05-Jul-2020 Simon Glass <sjg@chromium.org>

patman: Convert to ArgumentParser

Convert from OptionParser to ArgumentParser to match binman. With this we
can easily add sub-commands.

Signed-off-by: Simon Glass <sjg@chromium.org>

# dd3dac2f 07-Jun-2020 Simon Glass <sjg@chromium.org>

patman: Avoid importing gitutil in settings

Pass this module in so that settings does not need to import it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Stefan Bosch <stefan_b@posteo.net>

# bf776679 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Move to absolute imports

At present patman sets the python path on startup so that it can access
the libraries it needs. If we convert to use absolute imports this is not
necessary.

Move patman to use absolute imports. This requires changes in tools which
use the patman libraries (which is most of them).

Signed-off-by: Simon Glass <sjg@chromium.org>

# c3a13cc3 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Drop Python 2 StringIO code

We can rely on Python 3 now, so drop the workaround for importing
StringIO.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 83a45187 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Drop references to __future__

We don't need these now that the tools using Python 3. Drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 272cd85d 31-Oct-2019 Simon Glass <sjg@chromium.org>

patman: Use unicode for file I/O

At present patman test fail in some environments which don't use utf-8
as the default file encoding. Add this explicitly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ebb45c7 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Avoid unicode type in settings unit tests

The unicode type does not exist in Python 3 and when displaying strings
they do not have the 'u' prefix. Adjusts the settings unit tests to deal
with this difference, by converting the comparison value to a string, thus
dropping the 'u'.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 513eace4 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Move unicode helpers to tools

Create helper functions in the tools module to deal with the differences
between unicode in Python 2 (where we use the 'unicode' type) and Python 3
(where we use the 'str' type).

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a4c5dd4 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Use items() instead of iteritems()

Python 3 requires this, and Python 2 allows it. Convert the code over to
ensure compatibility with Python 3.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ec9e0f47 01-Oct-2018 Simon Glass <sjg@chromium.org>

patman: Handle unicode in _ProjectConfigParser tests

With Python 2.7.15rc1, ConfigParser.SafeConfigParser has unfortunately
started returning unicode, for unknown reasons. Adjust the code to handle
this by converting everything to unicode. We cannot convert things to
ASCII since email addresses may be encoded with UTF-8.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b8a48fbc 27-Jun-2018 Adam Sampson <ats@offog.org>

patman: Split alias entries on arbitrary whitespace

Previously the first three words in a git-mailrc alias entry could only
be separated by spaces. git-send-email and Mutt both allow arbitrary
whitespace here.

Signed-off-by: Adam Sampson <ats@offog.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# ad893140 12-Sep-2017 Simon Glass <sjg@chromium.org>

patman: Fix error when the email blacklist is missing

This section of the settings file may be missing. Handle that gracefully
rather than emitting an error.

Also update patman to write this section when a new settings file is
created.

Fixes: e11aa602 (patman: add support for omitting bouncing addresses)

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Chris Packham <judge.pckham@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>

# e11aa602 01-Sep-2017 Chris Packham <judge.packham@gmail.com>

patman: add support for omitting bouncing addresses

Add support for reading a list of bouncing addresses from a in-tree file
(doc/bounces) and from the ~/.patman config file. These addresses are
stripped from the Cc list.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com <mailto:philipp.tomsich@theobroma-systems.com>>

# f5d44b9b 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Fix doctest StringIO import for python 3.x

In python 3.x StringIO is no longer a module, and the class can instead
be found in the io module. Adjust the code in the doctest input to
account for both.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# c9eac38a 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Use items() to iterate over dictionaries

In python 3.x the iteritems() method has been removed from dictionaries,
and the items() method does effectively the same thing. On python 2.x
using items() is a little less efficient since it involves copying data,
but as speed isn't a concern in this code switch to using items() anyway
for simplicity.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2ce7b21e 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Import 'configparser' lower case to be python 3.x safe

In python 3.x module names used in import statements are case sensitive,
and the configparser module is named in all lower-case. Import it as such
in order to avoid errors when running with python 3.x.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# a920a17b 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Make print statements python 3.x safe

In python 3.x, print must be used as a function call. Convert all print
statements to the function call style, importing from __future__ where
we print with no trailing newline or print to a file object.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 8895b3e1 29-Jan-2015 Simon Glass <sjg@chromium.org>

patman: Read in the git-mailrc alias file

We should read this file to obtain a set of aliases. This reduces the need
to create them in the ~/.patman file.

This feature did exist in some version of patman, and is mentioned in the
help but it did not find its way upstream.

Reported-by: Graeme Russ <gruss@tss-engineering.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a1dcee84 03-Dec-2012 Doug Anderson <dianders@chromium.org>

patman: Add the concept of multiple projects

There are cases that we want to support different settings (or maybe
even different aliases) for different projects. Add support for this
by:
* Adding detection for two big projects: U-Boot and Linux.
* Adding default settings for Linux (U-Boot is already good with the
standard patman defaults).
* Extend the new "settings" feature in .patman to specify per-project
settings.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 8568baed 03-Dec-2012 Doug Anderson <dianders@chromium.org>

patman: Add support for settings in .patman

This patch adds support for a [settings] section in the .patman file.
In this section you can add settings that will affect the default
values for command-line options.

Support is added in a generic way such that any setting can be updated
by just referring to the "dest" of the option that is passed to the
option parser. At the moment options that would make sense to put in
settings are "ignore_errors", "process_tags", and "verbose". You
could override them like:

[settings]
ignore_errors: True
process_tags: False
verbose: True

The settings functionality is also used in a future change which adds
support for per-project settings.

Signed-off-by: Doug Anderson <dianders@chromium.org>

# 87d65558 23-May-2012 Vikram Narayanan <vikram186@gmail.com>

patman: Handle creation of patman config file

patman shouts when it couldn't find a $(HOME)/.patman file.
Handle it in a sane way by creating a new one for the user.
It looks for a user.name and user.email in the global .gitconfig
file, waits for the user input if it can't find there. Update the
same in the README

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>

# 2b36c75d 23-May-2012 Vikram Narayanan <vikram186@gmail.com>

patman: Change the location of patman config file

Move the config file from ~/.config/patman to ~/.patman as it is
more appropriate to have it there. Update the same in the README.

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>

# 0d24de9d 14-Jan-2012 Simon Glass <sjg@chromium.org>

Add 'patman' patch generation, checking and submission script

What is this?

=============

This tool is a Python script which:
- Creates patch directly from your branch
- Cleans them up by removing unwanted tags
- Inserts a cover letter with change lists
- Runs the patches through checkpatch.pl and its own checks
- Optionally emails them out to selected people

It is intended to automate patch creation and make it a less
error-prone process. It is useful for U-Boot and Linux work so far,
since it uses the checkpatch.pl script.

It is configured almost entirely by tags it finds in your commits.
This means that you can work on a number of different branches at
once, and keep the settings with each branch rather than having to
git format-patch, git send-email, etc. with the correct parameters
each time. So for example if you put:

in one of your commits, the series will be sent there.

See the README file for full details.
END

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4780f7d8 29-Apr-2022 Sean Anderson <sean.anderson@seco.com>

patman: Fix defaults not propagating to subparsers

On python 3.8.10 (and 3.10), subparsers are not updated with defaults. I
suspect this is related to [1]. Fix this by explicitly updating
subparsers with settings.

[1] https://github.com/python/cpython/issues/89398

Fixes: 3145b63513 ("patman: Update defaults in subparsers")
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Tested-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>

# 32cc6ae2 11-Feb-2022 Simon Glass <sjg@chromium.org>

patman: Correct pylint errors

Fix pylint errors that can be fixed and mask those that seem to be
incorrect.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0157b187 29-Jan-2022 Simon Glass <sjg@chromium.org>

patman: Convert camel case in gitutil.py

Convert this file to snake case and update all files which use it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ddc44c2c 24-Nov-2020 Philipp Tomsich <philipp.tomsich@vrull.eu>

patman: Add project-default for 'gcc'

Add defaults for FSF/GNU projects, such as gcc, that provide sensible
settings for those projects.

Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Reviewed-by: Simon Glass <sjg@chromium.org>

# fc0056e8 08-Nov-2020 Simon Glass <sjg@chromium.org>

patman: Drop unicode helper functions

We don't need these now that everything uses Python 3. Remove them and
the extra code in GetBytes() and ToBytes() too.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3145b635 03-Nov-2020 Simon Glass <sjg@chromium.org>

patman: Update defaults in subparsers

At present values from the settings file are only applied to the main
parser. With the new parser structure this means that some settings are
ignored.

Update the implementation to set defaults across the main parser and all
subparsers. Also fix up the comments, since ArgumentParser is being used
now.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fda1e372 05-Jul-2020 Simon Glass <sjg@chromium.org>

patman: Convert to ArgumentParser

Convert from OptionParser to ArgumentParser to match binman. With this we
can easily add sub-commands.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7208396b 24-Jul-2020 Tom Rini <trini@konsulko.com>

Revert "Merge tag 'dm-pull-20jul20' of git://git.denx.de/u-boot-dm"

This reverts commit 5d3a21df6694ebd66d5c34c9d62a26edc7456fc7, reversing
changes made to 56d37f1c564107e27d873181d838571b7d7860e7.

Unfortunately this is causing CI failures:
https://travis-ci.org/github/trini/u-boot/jobs/711313649

Signed-off-by: Tom Rini <trini@konsulko.com>

# e676fab7 05-Jul-2020 Simon Glass <sjg@chromium.org>

patman: Convert to ArgumentParser

Convert from OptionParser to ArgumentParser to match binman. With this we
can easily add sub-commands.

Signed-off-by: Simon Glass <sjg@chromium.org>

# dd3dac2f 07-Jun-2020 Simon Glass <sjg@chromium.org>

patman: Avoid importing gitutil in settings

Pass this module in so that settings does not need to import it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Stefan Bosch <stefan_b@posteo.net>

# bf776679 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Move to absolute imports

At present patman sets the python path on startup so that it can access
the libraries it needs. If we convert to use absolute imports this is not
necessary.

Move patman to use absolute imports. This requires changes in tools which
use the patman libraries (which is most of them).

Signed-off-by: Simon Glass <sjg@chromium.org>

# c3a13cc3 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Drop Python 2 StringIO code

We can rely on Python 3 now, so drop the workaround for importing
StringIO.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 83a45187 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Drop references to __future__

We don't need these now that the tools using Python 3. Drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 272cd85d 31-Oct-2019 Simon Glass <sjg@chromium.org>

patman: Use unicode for file I/O

At present patman test fail in some environments which don't use utf-8
as the default file encoding. Add this explicitly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ebb45c7 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Avoid unicode type in settings unit tests

The unicode type does not exist in Python 3 and when displaying strings
they do not have the 'u' prefix. Adjusts the settings unit tests to deal
with this difference, by converting the comparison value to a string, thus
dropping the 'u'.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 513eace4 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Move unicode helpers to tools

Create helper functions in the tools module to deal with the differences
between unicode in Python 2 (where we use the 'unicode' type) and Python 3
(where we use the 'str' type).

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a4c5dd4 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Use items() instead of iteritems()

Python 3 requires this, and Python 2 allows it. Convert the code over to
ensure compatibility with Python 3.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ec9e0f47 01-Oct-2018 Simon Glass <sjg@chromium.org>

patman: Handle unicode in _ProjectConfigParser tests

With Python 2.7.15rc1, ConfigParser.SafeConfigParser has unfortunately
started returning unicode, for unknown reasons. Adjust the code to handle
this by converting everything to unicode. We cannot convert things to
ASCII since email addresses may be encoded with UTF-8.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b8a48fbc 27-Jun-2018 Adam Sampson <ats@offog.org>

patman: Split alias entries on arbitrary whitespace

Previously the first three words in a git-mailrc alias entry could only
be separated by spaces. git-send-email and Mutt both allow arbitrary
whitespace here.

Signed-off-by: Adam Sampson <ats@offog.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# ad893140 12-Sep-2017 Simon Glass <sjg@chromium.org>

patman: Fix error when the email blacklist is missing

This section of the settings file may be missing. Handle that gracefully
rather than emitting an error.

Also update patman to write this section when a new settings file is
created.

Fixes: e11aa602 (patman: add support for omitting bouncing addresses)

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Chris Packham <judge.pckham@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>

# e11aa602 01-Sep-2017 Chris Packham <judge.packham@gmail.com>

patman: add support for omitting bouncing addresses

Add support for reading a list of bouncing addresses from a in-tree file
(doc/bounces) and from the ~/.patman config file. These addresses are
stripped from the Cc list.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com <mailto:philipp.tomsich@theobroma-systems.com>>

# f5d44b9b 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Fix doctest StringIO import for python 3.x

In python 3.x StringIO is no longer a module, and the class can instead
be found in the io module. Adjust the code in the doctest input to
account for both.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# c9eac38a 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Use items() to iterate over dictionaries

In python 3.x the iteritems() method has been removed from dictionaries,
and the items() method does effectively the same thing. On python 2.x
using items() is a little less efficient since it involves copying data,
but as speed isn't a concern in this code switch to using items() anyway
for simplicity.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2ce7b21e 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Import 'configparser' lower case to be python 3.x safe

In python 3.x module names used in import statements are case sensitive,
and the configparser module is named in all lower-case. Import it as such
in order to avoid errors when running with python 3.x.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# a920a17b 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Make print statements python 3.x safe

In python 3.x, print must be used as a function call. Convert all print
statements to the function call style, importing from __future__ where
we print with no trailing newline or print to a file object.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 8895b3e1 29-Jan-2015 Simon Glass <sjg@chromium.org>

patman: Read in the git-mailrc alias file

We should read this file to obtain a set of aliases. This reduces the need
to create them in the ~/.patman file.

This feature did exist in some version of patman, and is mentioned in the
help but it did not find its way upstream.

Reported-by: Graeme Russ <gruss@tss-engineering.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a1dcee84 03-Dec-2012 Doug Anderson <dianders@chromium.org>

patman: Add the concept of multiple projects

There are cases that we want to support different settings (or maybe
even different aliases) for different projects. Add support for this
by:
* Adding detection for two big projects: U-Boot and Linux.
* Adding default settings for Linux (U-Boot is already good with the
standard patman defaults).
* Extend the new "settings" feature in .patman to specify per-project
settings.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 8568baed 03-Dec-2012 Doug Anderson <dianders@chromium.org>

patman: Add support for settings in .patman

This patch adds support for a [settings] section in the .patman file.
In this section you can add settings that will affect the default
values for command-line options.

Support is added in a generic way such that any setting can be updated
by just referring to the "dest" of the option that is passed to the
option parser. At the moment options that would make sense to put in
settings are "ignore_errors", "process_tags", and "verbose". You
could override them like:

[settings]
ignore_errors: True
process_tags: False
verbose: True

The settings functionality is also used in a future change which adds
support for per-project settings.

Signed-off-by: Doug Anderson <dianders@chromium.org>

# 87d65558 23-May-2012 Vikram Narayanan <vikram186@gmail.com>

patman: Handle creation of patman config file

patman shouts when it couldn't find a $(HOME)/.patman file.
Handle it in a sane way by creating a new one for the user.
It looks for a user.name and user.email in the global .gitconfig
file, waits for the user input if it can't find there. Update the
same in the README

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>

# 2b36c75d 23-May-2012 Vikram Narayanan <vikram186@gmail.com>

patman: Change the location of patman config file

Move the config file from ~/.config/patman to ~/.patman as it is
more appropriate to have it there. Update the same in the README.

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>

# 0d24de9d 14-Jan-2012 Simon Glass <sjg@chromium.org>

Add 'patman' patch generation, checking and submission script

What is this?

=============

This tool is a Python script which:
- Creates patch directly from your branch
- Cleans them up by removing unwanted tags
- Inserts a cover letter with change lists
- Runs the patches through checkpatch.pl and its own checks
- Optionally emails them out to selected people

It is intended to automate patch creation and make it a less
error-prone process. It is useful for U-Boot and Linux work so far,
since it uses the checkpatch.pl script.

It is configured almost entirely by tags it finds in your commits.
This means that you can work on a number of different branches at
once, and keep the settings with each branch rather than having to
git format-patch, git send-email, etc. with the correct parameters
each time. So for example if you put:

in one of your commits, the series will be sent there.

See the README file for full details.
END

Signed-off-by: Simon Glass <sjg@chromium.org>

# 32cc6ae2 11-Feb-2022 Simon Glass <sjg@chromium.org>

patman: Correct pylint errors

Fix pylint errors that can be fixed and mask those that seem to be
incorrect.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0157b187 29-Jan-2022 Simon Glass <sjg@chromium.org>

patman: Convert camel case in gitutil.py

Convert this file to snake case and update all files which use it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ddc44c2c 24-Nov-2020 Philipp Tomsich <philipp.tomsich@vrull.eu>

patman: Add project-default for 'gcc'

Add defaults for FSF/GNU projects, such as gcc, that provide sensible
settings for those projects.

Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Reviewed-by: Simon Glass <sjg@chromium.org>

# fc0056e8 08-Nov-2020 Simon Glass <sjg@chromium.org>

patman: Drop unicode helper functions

We don't need these now that everything uses Python 3. Remove them and
the extra code in GetBytes() and ToBytes() too.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3145b635 03-Nov-2020 Simon Glass <sjg@chromium.org>

patman: Update defaults in subparsers

At present values from the settings file are only applied to the main
parser. With the new parser structure this means that some settings are
ignored.

Update the implementation to set defaults across the main parser and all
subparsers. Also fix up the comments, since ArgumentParser is being used
now.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fda1e372 05-Jul-2020 Simon Glass <sjg@chromium.org>

patman: Convert to ArgumentParser

Convert from OptionParser to ArgumentParser to match binman. With this we
can easily add sub-commands.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7208396b 24-Jul-2020 Tom Rini <trini@konsulko.com>

Revert "Merge tag 'dm-pull-20jul20' of git://git.denx.de/u-boot-dm"

This reverts commit 5d3a21df6694ebd66d5c34c9d62a26edc7456fc7, reversing
changes made to 56d37f1c564107e27d873181d838571b7d7860e7.

Unfortunately this is causing CI failures:
https://travis-ci.org/github/trini/u-boot/jobs/711313649

Signed-off-by: Tom Rini <trini@konsulko.com>

# e676fab7 05-Jul-2020 Simon Glass <sjg@chromium.org>

patman: Convert to ArgumentParser

Convert from OptionParser to ArgumentParser to match binman. With this we
can easily add sub-commands.

Signed-off-by: Simon Glass <sjg@chromium.org>

# dd3dac2f 07-Jun-2020 Simon Glass <sjg@chromium.org>

patman: Avoid importing gitutil in settings

Pass this module in so that settings does not need to import it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Stefan Bosch <stefan_b@posteo.net>

# bf776679 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Move to absolute imports

At present patman sets the python path on startup so that it can access
the libraries it needs. If we convert to use absolute imports this is not
necessary.

Move patman to use absolute imports. This requires changes in tools which
use the patman libraries (which is most of them).

Signed-off-by: Simon Glass <sjg@chromium.org>

# c3a13cc3 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Drop Python 2 StringIO code

We can rely on Python 3 now, so drop the workaround for importing
StringIO.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 83a45187 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Drop references to __future__

We don't need these now that the tools using Python 3. Drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 272cd85d 31-Oct-2019 Simon Glass <sjg@chromium.org>

patman: Use unicode for file I/O

At present patman test fail in some environments which don't use utf-8
as the default file encoding. Add this explicitly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ebb45c7 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Avoid unicode type in settings unit tests

The unicode type does not exist in Python 3 and when displaying strings
they do not have the 'u' prefix. Adjusts the settings unit tests to deal
with this difference, by converting the comparison value to a string, thus
dropping the 'u'.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 513eace4 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Move unicode helpers to tools

Create helper functions in the tools module to deal with the differences
between unicode in Python 2 (where we use the 'unicode' type) and Python 3
(where we use the 'str' type).

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a4c5dd4 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Use items() instead of iteritems()

Python 3 requires this, and Python 2 allows it. Convert the code over to
ensure compatibility with Python 3.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ec9e0f47 01-Oct-2018 Simon Glass <sjg@chromium.org>

patman: Handle unicode in _ProjectConfigParser tests

With Python 2.7.15rc1, ConfigParser.SafeConfigParser has unfortunately
started returning unicode, for unknown reasons. Adjust the code to handle
this by converting everything to unicode. We cannot convert things to
ASCII since email addresses may be encoded with UTF-8.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b8a48fbc 27-Jun-2018 Adam Sampson <ats@offog.org>

patman: Split alias entries on arbitrary whitespace

Previously the first three words in a git-mailrc alias entry could only
be separated by spaces. git-send-email and Mutt both allow arbitrary
whitespace here.

Signed-off-by: Adam Sampson <ats@offog.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# ad893140 12-Sep-2017 Simon Glass <sjg@chromium.org>

patman: Fix error when the email blacklist is missing

This section of the settings file may be missing. Handle that gracefully
rather than emitting an error.

Also update patman to write this section when a new settings file is
created.

Fixes: e11aa602 (patman: add support for omitting bouncing addresses)

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Chris Packham <judge.pckham@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>

# e11aa602 01-Sep-2017 Chris Packham <judge.packham@gmail.com>

patman: add support for omitting bouncing addresses

Add support for reading a list of bouncing addresses from a in-tree file
(doc/bounces) and from the ~/.patman config file. These addresses are
stripped from the Cc list.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com <mailto:philipp.tomsich@theobroma-systems.com>>

# f5d44b9b 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Fix doctest StringIO import for python 3.x

In python 3.x StringIO is no longer a module, and the class can instead
be found in the io module. Adjust the code in the doctest input to
account for both.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# c9eac38a 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Use items() to iterate over dictionaries

In python 3.x the iteritems() method has been removed from dictionaries,
and the items() method does effectively the same thing. On python 2.x
using items() is a little less efficient since it involves copying data,
but as speed isn't a concern in this code switch to using items() anyway
for simplicity.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2ce7b21e 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Import 'configparser' lower case to be python 3.x safe

In python 3.x module names used in import statements are case sensitive,
and the configparser module is named in all lower-case. Import it as such
in order to avoid errors when running with python 3.x.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# a920a17b 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Make print statements python 3.x safe

In python 3.x, print must be used as a function call. Convert all print
statements to the function call style, importing from __future__ where
we print with no trailing newline or print to a file object.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 8895b3e1 29-Jan-2015 Simon Glass <sjg@chromium.org>

patman: Read in the git-mailrc alias file

We should read this file to obtain a set of aliases. This reduces the need
to create them in the ~/.patman file.

This feature did exist in some version of patman, and is mentioned in the
help but it did not find its way upstream.

Reported-by: Graeme Russ <gruss@tss-engineering.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a1dcee84 03-Dec-2012 Doug Anderson <dianders@chromium.org>

patman: Add the concept of multiple projects

There are cases that we want to support different settings (or maybe
even different aliases) for different projects. Add support for this
by:
* Adding detection for two big projects: U-Boot and Linux.
* Adding default settings for Linux (U-Boot is already good with the
standard patman defaults).
* Extend the new "settings" feature in .patman to specify per-project
settings.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 8568baed 03-Dec-2012 Doug Anderson <dianders@chromium.org>

patman: Add support for settings in .patman

This patch adds support for a [settings] section in the .patman file.
In this section you can add settings that will affect the default
values for command-line options.

Support is added in a generic way such that any setting can be updated
by just referring to the "dest" of the option that is passed to the
option parser. At the moment options that would make sense to put in
settings are "ignore_errors", "process_tags", and "verbose". You
could override them like:

[settings]
ignore_errors: True
process_tags: False
verbose: True

The settings functionality is also used in a future change which adds
support for per-project settings.

Signed-off-by: Doug Anderson <dianders@chromium.org>

# 87d65558 23-May-2012 Vikram Narayanan <vikram186@gmail.com>

patman: Handle creation of patman config file

patman shouts when it couldn't find a $(HOME)/.patman file.
Handle it in a sane way by creating a new one for the user.
It looks for a user.name and user.email in the global .gitconfig
file, waits for the user input if it can't find there. Update the
same in the README

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>

# 2b36c75d 23-May-2012 Vikram Narayanan <vikram186@gmail.com>

patman: Change the location of patman config file

Move the config file from ~/.config/patman to ~/.patman as it is
more appropriate to have it there. Update the same in the README.

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>

# 0d24de9d 14-Jan-2012 Simon Glass <sjg@chromium.org>

Add 'patman' patch generation, checking and submission script

What is this?

=============

This tool is a Python script which:
- Creates patch directly from your branch
- Cleans them up by removing unwanted tags
- Inserts a cover letter with change lists
- Runs the patches through checkpatch.pl and its own checks
- Optionally emails them out to selected people

It is intended to automate patch creation and make it a less
error-prone process. It is useful for U-Boot and Linux work so far,
since it uses the checkpatch.pl script.

It is configured almost entirely by tags it finds in your commits.
This means that you can work on a number of different branches at
once, and keep the settings with each branch rather than having to
git format-patch, git send-email, etc. with the correct parameters
each time. So for example if you put:

in one of your commits, the series will be sent there.

See the README file for full details.
END

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0157b187 29-Jan-2022 Simon Glass <sjg@chromium.org>

patman: Convert camel case in gitutil.py

Convert this file to snake case and update all files which use it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ddc44c2c 24-Nov-2020 Philipp Tomsich <philipp.tomsich@vrull.eu>

patman: Add project-default for 'gcc'

Add defaults for FSF/GNU projects, such as gcc, that provide sensible
settings for those projects.

Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Reviewed-by: Simon Glass <sjg@chromium.org>

# fc0056e8 08-Nov-2020 Simon Glass <sjg@chromium.org>

patman: Drop unicode helper functions

We don't need these now that everything uses Python 3. Remove them and
the extra code in GetBytes() and ToBytes() too.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3145b635 03-Nov-2020 Simon Glass <sjg@chromium.org>

patman: Update defaults in subparsers

At present values from the settings file are only applied to the main
parser. With the new parser structure this means that some settings are
ignored.

Update the implementation to set defaults across the main parser and all
subparsers. Also fix up the comments, since ArgumentParser is being used
now.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fda1e372 05-Jul-2020 Simon Glass <sjg@chromium.org>

patman: Convert to ArgumentParser

Convert from OptionParser to ArgumentParser to match binman. With this we
can easily add sub-commands.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7208396b 24-Jul-2020 Tom Rini <trini@konsulko.com>

Revert "Merge tag 'dm-pull-20jul20' of git://git.denx.de/u-boot-dm"

This reverts commit 5d3a21df6694ebd66d5c34c9d62a26edc7456fc7, reversing
changes made to 56d37f1c564107e27d873181d838571b7d7860e7.

Unfortunately this is causing CI failures:
https://travis-ci.org/github/trini/u-boot/jobs/711313649

Signed-off-by: Tom Rini <trini@konsulko.com>

# e676fab7 05-Jul-2020 Simon Glass <sjg@chromium.org>

patman: Convert to ArgumentParser

Convert from OptionParser to ArgumentParser to match binman. With this we
can easily add sub-commands.

Signed-off-by: Simon Glass <sjg@chromium.org>

# dd3dac2f 07-Jun-2020 Simon Glass <sjg@chromium.org>

patman: Avoid importing gitutil in settings

Pass this module in so that settings does not need to import it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Stefan Bosch <stefan_b@posteo.net>

# bf776679 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Move to absolute imports

At present patman sets the python path on startup so that it can access
the libraries it needs. If we convert to use absolute imports this is not
necessary.

Move patman to use absolute imports. This requires changes in tools which
use the patman libraries (which is most of them).

Signed-off-by: Simon Glass <sjg@chromium.org>

# c3a13cc3 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Drop Python 2 StringIO code

We can rely on Python 3 now, so drop the workaround for importing
StringIO.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 83a45187 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Drop references to __future__

We don't need these now that the tools using Python 3. Drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 272cd85d 31-Oct-2019 Simon Glass <sjg@chromium.org>

patman: Use unicode for file I/O

At present patman test fail in some environments which don't use utf-8
as the default file encoding. Add this explicitly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ebb45c7 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Avoid unicode type in settings unit tests

The unicode type does not exist in Python 3 and when displaying strings
they do not have the 'u' prefix. Adjusts the settings unit tests to deal
with this difference, by converting the comparison value to a string, thus
dropping the 'u'.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 513eace4 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Move unicode helpers to tools

Create helper functions in the tools module to deal with the differences
between unicode in Python 2 (where we use the 'unicode' type) and Python 3
(where we use the 'str' type).

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a4c5dd4 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Use items() instead of iteritems()

Python 3 requires this, and Python 2 allows it. Convert the code over to
ensure compatibility with Python 3.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ec9e0f47 01-Oct-2018 Simon Glass <sjg@chromium.org>

patman: Handle unicode in _ProjectConfigParser tests

With Python 2.7.15rc1, ConfigParser.SafeConfigParser has unfortunately
started returning unicode, for unknown reasons. Adjust the code to handle
this by converting everything to unicode. We cannot convert things to
ASCII since email addresses may be encoded with UTF-8.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b8a48fbc 27-Jun-2018 Adam Sampson <ats@offog.org>

patman: Split alias entries on arbitrary whitespace

Previously the first three words in a git-mailrc alias entry could only
be separated by spaces. git-send-email and Mutt both allow arbitrary
whitespace here.

Signed-off-by: Adam Sampson <ats@offog.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# ad893140 12-Sep-2017 Simon Glass <sjg@chromium.org>

patman: Fix error when the email blacklist is missing

This section of the settings file may be missing. Handle that gracefully
rather than emitting an error.

Also update patman to write this section when a new settings file is
created.

Fixes: e11aa602 (patman: add support for omitting bouncing addresses)

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Chris Packham <judge.pckham@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>

# e11aa602 01-Sep-2017 Chris Packham <judge.packham@gmail.com>

patman: add support for omitting bouncing addresses

Add support for reading a list of bouncing addresses from a in-tree file
(doc/bounces) and from the ~/.patman config file. These addresses are
stripped from the Cc list.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com <mailto:philipp.tomsich@theobroma-systems.com>>

# f5d44b9b 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Fix doctest StringIO import for python 3.x

In python 3.x StringIO is no longer a module, and the class can instead
be found in the io module. Adjust the code in the doctest input to
account for both.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# c9eac38a 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Use items() to iterate over dictionaries

In python 3.x the iteritems() method has been removed from dictionaries,
and the items() method does effectively the same thing. On python 2.x
using items() is a little less efficient since it involves copying data,
but as speed isn't a concern in this code switch to using items() anyway
for simplicity.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2ce7b21e 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Import 'configparser' lower case to be python 3.x safe

In python 3.x module names used in import statements are case sensitive,
and the configparser module is named in all lower-case. Import it as such
in order to avoid errors when running with python 3.x.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# a920a17b 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Make print statements python 3.x safe

In python 3.x, print must be used as a function call. Convert all print
statements to the function call style, importing from __future__ where
we print with no trailing newline or print to a file object.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 8895b3e1 29-Jan-2015 Simon Glass <sjg@chromium.org>

patman: Read in the git-mailrc alias file

We should read this file to obtain a set of aliases. This reduces the need
to create them in the ~/.patman file.

This feature did exist in some version of patman, and is mentioned in the
help but it did not find its way upstream.

Reported-by: Graeme Russ <gruss@tss-engineering.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a1dcee84 03-Dec-2012 Doug Anderson <dianders@chromium.org>

patman: Add the concept of multiple projects

There are cases that we want to support different settings (or maybe
even different aliases) for different projects. Add support for this
by:
* Adding detection for two big projects: U-Boot and Linux.
* Adding default settings for Linux (U-Boot is already good with the
standard patman defaults).
* Extend the new "settings" feature in .patman to specify per-project
settings.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 8568baed 03-Dec-2012 Doug Anderson <dianders@chromium.org>

patman: Add support for settings in .patman

This patch adds support for a [settings] section in the .patman file.
In this section you can add settings that will affect the default
values for command-line options.

Support is added in a generic way such that any setting can be updated
by just referring to the "dest" of the option that is passed to the
option parser. At the moment options that would make sense to put in
settings are "ignore_errors", "process_tags", and "verbose". You
could override them like:

[settings]
ignore_errors: True
process_tags: False
verbose: True

The settings functionality is also used in a future change which adds
support for per-project settings.

Signed-off-by: Doug Anderson <dianders@chromium.org>

# 87d65558 23-May-2012 Vikram Narayanan <vikram186@gmail.com>

patman: Handle creation of patman config file

patman shouts when it couldn't find a $(HOME)/.patman file.
Handle it in a sane way by creating a new one for the user.
It looks for a user.name and user.email in the global .gitconfig
file, waits for the user input if it can't find there. Update the
same in the README

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>

# 2b36c75d 23-May-2012 Vikram Narayanan <vikram186@gmail.com>

patman: Change the location of patman config file

Move the config file from ~/.config/patman to ~/.patman as it is
more appropriate to have it there. Update the same in the README.

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>

# 0d24de9d 14-Jan-2012 Simon Glass <sjg@chromium.org>

Add 'patman' patch generation, checking and submission script

What is this?

=============

This tool is a Python script which:
- Creates patch directly from your branch
- Cleans them up by removing unwanted tags
- Inserts a cover letter with change lists
- Runs the patches through checkpatch.pl and its own checks
- Optionally emails them out to selected people

It is intended to automate patch creation and make it a less
error-prone process. It is useful for U-Boot and Linux work so far,
since it uses the checkpatch.pl script.

It is configured almost entirely by tags it finds in your commits.
This means that you can work on a number of different branches at
once, and keep the settings with each branch rather than having to
git format-patch, git send-email, etc. with the correct parameters
each time. So for example if you put:

in one of your commits, the series will be sent there.

See the README file for full details.
END

Signed-off-by: Simon Glass <sjg@chromium.org>

# ddc44c2c 24-Nov-2020 Philipp Tomsich <philipp.tomsich@vrull.eu>

patman: Add project-default for 'gcc'

Add defaults for FSF/GNU projects, such as gcc, that provide sensible
settings for those projects.

Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Reviewed-by: Simon Glass <sjg@chromium.org>

# fc0056e8 08-Nov-2020 Simon Glass <sjg@chromium.org>

patman: Drop unicode helper functions

We don't need these now that everything uses Python 3. Remove them and
the extra code in GetBytes() and ToBytes() too.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3145b635 03-Nov-2020 Simon Glass <sjg@chromium.org>

patman: Update defaults in subparsers

At present values from the settings file are only applied to the main
parser. With the new parser structure this means that some settings are
ignored.

Update the implementation to set defaults across the main parser and all
subparsers. Also fix up the comments, since ArgumentParser is being used
now.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fda1e372 05-Jul-2020 Simon Glass <sjg@chromium.org>

patman: Convert to ArgumentParser

Convert from OptionParser to ArgumentParser to match binman. With this we
can easily add sub-commands.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7208396b 24-Jul-2020 Tom Rini <trini@konsulko.com>

Revert "Merge tag 'dm-pull-20jul20' of git://git.denx.de/u-boot-dm"

This reverts commit 5d3a21df6694ebd66d5c34c9d62a26edc7456fc7, reversing
changes made to 56d37f1c564107e27d873181d838571b7d7860e7.

Unfortunately this is causing CI failures:
https://travis-ci.org/github/trini/u-boot/jobs/711313649

Signed-off-by: Tom Rini <trini@konsulko.com>

# e676fab7 05-Jul-2020 Simon Glass <sjg@chromium.org>

patman: Convert to ArgumentParser

Convert from OptionParser to ArgumentParser to match binman. With this we
can easily add sub-commands.

Signed-off-by: Simon Glass <sjg@chromium.org>

# dd3dac2f 07-Jun-2020 Simon Glass <sjg@chromium.org>

patman: Avoid importing gitutil in settings

Pass this module in so that settings does not need to import it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Stefan Bosch <stefan_b@posteo.net>

# bf776679 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Move to absolute imports

At present patman sets the python path on startup so that it can access
the libraries it needs. If we convert to use absolute imports this is not
necessary.

Move patman to use absolute imports. This requires changes in tools which
use the patman libraries (which is most of them).

Signed-off-by: Simon Glass <sjg@chromium.org>

# c3a13cc3 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Drop Python 2 StringIO code

We can rely on Python 3 now, so drop the workaround for importing
StringIO.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 83a45187 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Drop references to __future__

We don't need these now that the tools using Python 3. Drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 272cd85d 31-Oct-2019 Simon Glass <sjg@chromium.org>

patman: Use unicode for file I/O

At present patman test fail in some environments which don't use utf-8
as the default file encoding. Add this explicitly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ebb45c7 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Avoid unicode type in settings unit tests

The unicode type does not exist in Python 3 and when displaying strings
they do not have the 'u' prefix. Adjusts the settings unit tests to deal
with this difference, by converting the comparison value to a string, thus
dropping the 'u'.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 513eace4 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Move unicode helpers to tools

Create helper functions in the tools module to deal with the differences
between unicode in Python 2 (where we use the 'unicode' type) and Python 3
(where we use the 'str' type).

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a4c5dd4 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Use items() instead of iteritems()

Python 3 requires this, and Python 2 allows it. Convert the code over to
ensure compatibility with Python 3.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ec9e0f47 01-Oct-2018 Simon Glass <sjg@chromium.org>

patman: Handle unicode in _ProjectConfigParser tests

With Python 2.7.15rc1, ConfigParser.SafeConfigParser has unfortunately
started returning unicode, for unknown reasons. Adjust the code to handle
this by converting everything to unicode. We cannot convert things to
ASCII since email addresses may be encoded with UTF-8.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b8a48fbc 27-Jun-2018 Adam Sampson <ats@offog.org>

patman: Split alias entries on arbitrary whitespace

Previously the first three words in a git-mailrc alias entry could only
be separated by spaces. git-send-email and Mutt both allow arbitrary
whitespace here.

Signed-off-by: Adam Sampson <ats@offog.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# ad893140 12-Sep-2017 Simon Glass <sjg@chromium.org>

patman: Fix error when the email blacklist is missing

This section of the settings file may be missing. Handle that gracefully
rather than emitting an error.

Also update patman to write this section when a new settings file is
created.

Fixes: e11aa602 (patman: add support for omitting bouncing addresses)

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Chris Packham <judge.pckham@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>

# e11aa602 01-Sep-2017 Chris Packham <judge.packham@gmail.com>

patman: add support for omitting bouncing addresses

Add support for reading a list of bouncing addresses from a in-tree file
(doc/bounces) and from the ~/.patman config file. These addresses are
stripped from the Cc list.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com <mailto:philipp.tomsich@theobroma-systems.com>>

# f5d44b9b 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Fix doctest StringIO import for python 3.x

In python 3.x StringIO is no longer a module, and the class can instead
be found in the io module. Adjust the code in the doctest input to
account for both.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# c9eac38a 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Use items() to iterate over dictionaries

In python 3.x the iteritems() method has been removed from dictionaries,
and the items() method does effectively the same thing. On python 2.x
using items() is a little less efficient since it involves copying data,
but as speed isn't a concern in this code switch to using items() anyway
for simplicity.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2ce7b21e 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Import 'configparser' lower case to be python 3.x safe

In python 3.x module names used in import statements are case sensitive,
and the configparser module is named in all lower-case. Import it as such
in order to avoid errors when running with python 3.x.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# a920a17b 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Make print statements python 3.x safe

In python 3.x, print must be used as a function call. Convert all print
statements to the function call style, importing from __future__ where
we print with no trailing newline or print to a file object.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 8895b3e1 29-Jan-2015 Simon Glass <sjg@chromium.org>

patman: Read in the git-mailrc alias file

We should read this file to obtain a set of aliases. This reduces the need
to create them in the ~/.patman file.

This feature did exist in some version of patman, and is mentioned in the
help but it did not find its way upstream.

Reported-by: Graeme Russ <gruss@tss-engineering.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a1dcee84 03-Dec-2012 Doug Anderson <dianders@chromium.org>

patman: Add the concept of multiple projects

There are cases that we want to support different settings (or maybe
even different aliases) for different projects. Add support for this
by:
* Adding detection for two big projects: U-Boot and Linux.
* Adding default settings for Linux (U-Boot is already good with the
standard patman defaults).
* Extend the new "settings" feature in .patman to specify per-project
settings.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 8568baed 03-Dec-2012 Doug Anderson <dianders@chromium.org>

patman: Add support for settings in .patman

This patch adds support for a [settings] section in the .patman file.
In this section you can add settings that will affect the default
values for command-line options.

Support is added in a generic way such that any setting can be updated
by just referring to the "dest" of the option that is passed to the
option parser. At the moment options that would make sense to put in
settings are "ignore_errors", "process_tags", and "verbose". You
could override them like:

[settings]
ignore_errors: True
process_tags: False
verbose: True

The settings functionality is also used in a future change which adds
support for per-project settings.

Signed-off-by: Doug Anderson <dianders@chromium.org>

# 87d65558 23-May-2012 Vikram Narayanan <vikram186@gmail.com>

patman: Handle creation of patman config file

patman shouts when it couldn't find a $(HOME)/.patman file.
Handle it in a sane way by creating a new one for the user.
It looks for a user.name and user.email in the global .gitconfig
file, waits for the user input if it can't find there. Update the
same in the README

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>

# 2b36c75d 23-May-2012 Vikram Narayanan <vikram186@gmail.com>

patman: Change the location of patman config file

Move the config file from ~/.config/patman to ~/.patman as it is
more appropriate to have it there. Update the same in the README.

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>

# 0d24de9d 14-Jan-2012 Simon Glass <sjg@chromium.org>

Add 'patman' patch generation, checking and submission script

What is this?

=============

This tool is a Python script which:
- Creates patch directly from your branch
- Cleans them up by removing unwanted tags
- Inserts a cover letter with change lists
- Runs the patches through checkpatch.pl and its own checks
- Optionally emails them out to selected people

It is intended to automate patch creation and make it a less
error-prone process. It is useful for U-Boot and Linux work so far,
since it uses the checkpatch.pl script.

It is configured almost entirely by tags it finds in your commits.
This means that you can work on a number of different branches at
once, and keep the settings with each branch rather than having to
git format-patch, git send-email, etc. with the correct parameters
each time. So for example if you put:

in one of your commits, the series will be sent there.

See the README file for full details.
END

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3145b635 03-Nov-2020 Simon Glass <sjg@chromium.org>

patman: Update defaults in subparsers

At present values from the settings file are only applied to the main
parser. With the new parser structure this means that some settings are
ignored.

Update the implementation to set defaults across the main parser and all
subparsers. Also fix up the comments, since ArgumentParser is being used
now.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fda1e372 05-Jul-2020 Simon Glass <sjg@chromium.org>

patman: Convert to ArgumentParser

Convert from OptionParser to ArgumentParser to match binman. With this we
can easily add sub-commands.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7208396b 24-Jul-2020 Tom Rini <trini@konsulko.com>

Revert "Merge tag 'dm-pull-20jul20' of git://git.denx.de/u-boot-dm"

This reverts commit 5d3a21df6694ebd66d5c34c9d62a26edc7456fc7, reversing
changes made to 56d37f1c564107e27d873181d838571b7d7860e7.

Unfortunately this is causing CI failures:
https://travis-ci.org/github/trini/u-boot/jobs/711313649

Signed-off-by: Tom Rini <trini@konsulko.com>

# e676fab7 05-Jul-2020 Simon Glass <sjg@chromium.org>

patman: Convert to ArgumentParser

Convert from OptionParser to ArgumentParser to match binman. With this we
can easily add sub-commands.

Signed-off-by: Simon Glass <sjg@chromium.org>

# dd3dac2f 07-Jun-2020 Simon Glass <sjg@chromium.org>

patman: Avoid importing gitutil in settings

Pass this module in so that settings does not need to import it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Stefan Bosch <stefan_b@posteo.net>

# bf776679 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Move to absolute imports

At present patman sets the python path on startup so that it can access
the libraries it needs. If we convert to use absolute imports this is not
necessary.

Move patman to use absolute imports. This requires changes in tools which
use the patman libraries (which is most of them).

Signed-off-by: Simon Glass <sjg@chromium.org>

# c3a13cc3 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Drop Python 2 StringIO code

We can rely on Python 3 now, so drop the workaround for importing
StringIO.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 83a45187 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Drop references to __future__

We don't need these now that the tools using Python 3. Drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 272cd85d 31-Oct-2019 Simon Glass <sjg@chromium.org>

patman: Use unicode for file I/O

At present patman test fail in some environments which don't use utf-8
as the default file encoding. Add this explicitly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ebb45c7 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Avoid unicode type in settings unit tests

The unicode type does not exist in Python 3 and when displaying strings
they do not have the 'u' prefix. Adjusts the settings unit tests to deal
with this difference, by converting the comparison value to a string, thus
dropping the 'u'.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 513eace4 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Move unicode helpers to tools

Create helper functions in the tools module to deal with the differences
between unicode in Python 2 (where we use the 'unicode' type) and Python 3
(where we use the 'str' type).

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a4c5dd4 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Use items() instead of iteritems()

Python 3 requires this, and Python 2 allows it. Convert the code over to
ensure compatibility with Python 3.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ec9e0f47 01-Oct-2018 Simon Glass <sjg@chromium.org>

patman: Handle unicode in _ProjectConfigParser tests

With Python 2.7.15rc1, ConfigParser.SafeConfigParser has unfortunately
started returning unicode, for unknown reasons. Adjust the code to handle
this by converting everything to unicode. We cannot convert things to
ASCII since email addresses may be encoded with UTF-8.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b8a48fbc 27-Jun-2018 Adam Sampson <ats@offog.org>

patman: Split alias entries on arbitrary whitespace

Previously the first three words in a git-mailrc alias entry could only
be separated by spaces. git-send-email and Mutt both allow arbitrary
whitespace here.

Signed-off-by: Adam Sampson <ats@offog.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# ad893140 12-Sep-2017 Simon Glass <sjg@chromium.org>

patman: Fix error when the email blacklist is missing

This section of the settings file may be missing. Handle that gracefully
rather than emitting an error.

Also update patman to write this section when a new settings file is
created.

Fixes: e11aa602 (patman: add support for omitting bouncing addresses)

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Chris Packham <judge.pckham@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>

# e11aa602 01-Sep-2017 Chris Packham <judge.packham@gmail.com>

patman: add support for omitting bouncing addresses

Add support for reading a list of bouncing addresses from a in-tree file
(doc/bounces) and from the ~/.patman config file. These addresses are
stripped from the Cc list.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com <mailto:philipp.tomsich@theobroma-systems.com>>

# f5d44b9b 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Fix doctest StringIO import for python 3.x

In python 3.x StringIO is no longer a module, and the class can instead
be found in the io module. Adjust the code in the doctest input to
account for both.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# c9eac38a 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Use items() to iterate over dictionaries

In python 3.x the iteritems() method has been removed from dictionaries,
and the items() method does effectively the same thing. On python 2.x
using items() is a little less efficient since it involves copying data,
but as speed isn't a concern in this code switch to using items() anyway
for simplicity.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2ce7b21e 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Import 'configparser' lower case to be python 3.x safe

In python 3.x module names used in import statements are case sensitive,
and the configparser module is named in all lower-case. Import it as such
in order to avoid errors when running with python 3.x.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# a920a17b 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Make print statements python 3.x safe

In python 3.x, print must be used as a function call. Convert all print
statements to the function call style, importing from __future__ where
we print with no trailing newline or print to a file object.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 8895b3e1 29-Jan-2015 Simon Glass <sjg@chromium.org>

patman: Read in the git-mailrc alias file

We should read this file to obtain a set of aliases. This reduces the need
to create them in the ~/.patman file.

This feature did exist in some version of patman, and is mentioned in the
help but it did not find its way upstream.

Reported-by: Graeme Russ <gruss@tss-engineering.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a1dcee84 03-Dec-2012 Doug Anderson <dianders@chromium.org>

patman: Add the concept of multiple projects

There are cases that we want to support different settings (or maybe
even different aliases) for different projects. Add support for this
by:
* Adding detection for two big projects: U-Boot and Linux.
* Adding default settings for Linux (U-Boot is already good with the
standard patman defaults).
* Extend the new "settings" feature in .patman to specify per-project
settings.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 8568baed 03-Dec-2012 Doug Anderson <dianders@chromium.org>

patman: Add support for settings in .patman

This patch adds support for a [settings] section in the .patman file.
In this section you can add settings that will affect the default
values for command-line options.

Support is added in a generic way such that any setting can be updated
by just referring to the "dest" of the option that is passed to the
option parser. At the moment options that would make sense to put in
settings are "ignore_errors", "process_tags", and "verbose". You
could override them like:

[settings]
ignore_errors: True
process_tags: False
verbose: True

The settings functionality is also used in a future change which adds
support for per-project settings.

Signed-off-by: Doug Anderson <dianders@chromium.org>

# 87d65558 23-May-2012 Vikram Narayanan <vikram186@gmail.com>

patman: Handle creation of patman config file

patman shouts when it couldn't find a $(HOME)/.patman file.
Handle it in a sane way by creating a new one for the user.
It looks for a user.name and user.email in the global .gitconfig
file, waits for the user input if it can't find there. Update the
same in the README

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>

# 2b36c75d 23-May-2012 Vikram Narayanan <vikram186@gmail.com>

patman: Change the location of patman config file

Move the config file from ~/.config/patman to ~/.patman as it is
more appropriate to have it there. Update the same in the README.

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>

# 0d24de9d 14-Jan-2012 Simon Glass <sjg@chromium.org>

Add 'patman' patch generation, checking and submission script

What is this?

=============

This tool is a Python script which:
- Creates patch directly from your branch
- Cleans them up by removing unwanted tags
- Inserts a cover letter with change lists
- Runs the patches through checkpatch.pl and its own checks
- Optionally emails them out to selected people

It is intended to automate patch creation and make it a less
error-prone process. It is useful for U-Boot and Linux work so far,
since it uses the checkpatch.pl script.

It is configured almost entirely by tags it finds in your commits.
This means that you can work on a number of different branches at
once, and keep the settings with each branch rather than having to
git format-patch, git send-email, etc. with the correct parameters
each time. So for example if you put:

in one of your commits, the series will be sent there.

See the README file for full details.
END

Signed-off-by: Simon Glass <sjg@chromium.org>

# fda1e372 05-Jul-2020 Simon Glass <sjg@chromium.org>

patman: Convert to ArgumentParser

Convert from OptionParser to ArgumentParser to match binman. With this we
can easily add sub-commands.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7208396b 24-Jul-2020 Tom Rini <trini@konsulko.com>

Revert "Merge tag 'dm-pull-20jul20' of git://git.denx.de/u-boot-dm"

This reverts commit 5d3a21df6694ebd66d5c34c9d62a26edc7456fc7, reversing
changes made to 56d37f1c564107e27d873181d838571b7d7860e7.

Unfortunately this is causing CI failures:
https://travis-ci.org/github/trini/u-boot/jobs/711313649

Signed-off-by: Tom Rini <trini@konsulko.com>

# e676fab7 05-Jul-2020 Simon Glass <sjg@chromium.org>

patman: Convert to ArgumentParser

Convert from OptionParser to ArgumentParser to match binman. With this we
can easily add sub-commands.

Signed-off-by: Simon Glass <sjg@chromium.org>

# dd3dac2f 07-Jun-2020 Simon Glass <sjg@chromium.org>

patman: Avoid importing gitutil in settings

Pass this module in so that settings does not need to import it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Stefan Bosch <stefan_b@posteo.net>

# bf776679 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Move to absolute imports

At present patman sets the python path on startup so that it can access
the libraries it needs. If we convert to use absolute imports this is not
necessary.

Move patman to use absolute imports. This requires changes in tools which
use the patman libraries (which is most of them).

Signed-off-by: Simon Glass <sjg@chromium.org>

# c3a13cc3 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Drop Python 2 StringIO code

We can rely on Python 3 now, so drop the workaround for importing
StringIO.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 83a45187 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Drop references to __future__

We don't need these now that the tools using Python 3. Drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 272cd85d 31-Oct-2019 Simon Glass <sjg@chromium.org>

patman: Use unicode for file I/O

At present patman test fail in some environments which don't use utf-8
as the default file encoding. Add this explicitly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ebb45c7 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Avoid unicode type in settings unit tests

The unicode type does not exist in Python 3 and when displaying strings
they do not have the 'u' prefix. Adjusts the settings unit tests to deal
with this difference, by converting the comparison value to a string, thus
dropping the 'u'.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 513eace4 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Move unicode helpers to tools

Create helper functions in the tools module to deal with the differences
between unicode in Python 2 (where we use the 'unicode' type) and Python 3
(where we use the 'str' type).

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a4c5dd4 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Use items() instead of iteritems()

Python 3 requires this, and Python 2 allows it. Convert the code over to
ensure compatibility with Python 3.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ec9e0f47 01-Oct-2018 Simon Glass <sjg@chromium.org>

patman: Handle unicode in _ProjectConfigParser tests

With Python 2.7.15rc1, ConfigParser.SafeConfigParser has unfortunately
started returning unicode, for unknown reasons. Adjust the code to handle
this by converting everything to unicode. We cannot convert things to
ASCII since email addresses may be encoded with UTF-8.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b8a48fbc 27-Jun-2018 Adam Sampson <ats@offog.org>

patman: Split alias entries on arbitrary whitespace

Previously the first three words in a git-mailrc alias entry could only
be separated by spaces. git-send-email and Mutt both allow arbitrary
whitespace here.

Signed-off-by: Adam Sampson <ats@offog.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# ad893140 12-Sep-2017 Simon Glass <sjg@chromium.org>

patman: Fix error when the email blacklist is missing

This section of the settings file may be missing. Handle that gracefully
rather than emitting an error.

Also update patman to write this section when a new settings file is
created.

Fixes: e11aa602 (patman: add support for omitting bouncing addresses)

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Chris Packham <judge.pckham@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>

# e11aa602 01-Sep-2017 Chris Packham <judge.packham@gmail.com>

patman: add support for omitting bouncing addresses

Add support for reading a list of bouncing addresses from a in-tree file
(doc/bounces) and from the ~/.patman config file. These addresses are
stripped from the Cc list.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com <mailto:philipp.tomsich@theobroma-systems.com>>

# f5d44b9b 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Fix doctest StringIO import for python 3.x

In python 3.x StringIO is no longer a module, and the class can instead
be found in the io module. Adjust the code in the doctest input to
account for both.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# c9eac38a 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Use items() to iterate over dictionaries

In python 3.x the iteritems() method has been removed from dictionaries,
and the items() method does effectively the same thing. On python 2.x
using items() is a little less efficient since it involves copying data,
but as speed isn't a concern in this code switch to using items() anyway
for simplicity.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2ce7b21e 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Import 'configparser' lower case to be python 3.x safe

In python 3.x module names used in import statements are case sensitive,
and the configparser module is named in all lower-case. Import it as such
in order to avoid errors when running with python 3.x.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# a920a17b 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Make print statements python 3.x safe

In python 3.x, print must be used as a function call. Convert all print
statements to the function call style, importing from __future__ where
we print with no trailing newline or print to a file object.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 8895b3e1 29-Jan-2015 Simon Glass <sjg@chromium.org>

patman: Read in the git-mailrc alias file

We should read this file to obtain a set of aliases. This reduces the need
to create them in the ~/.patman file.

This feature did exist in some version of patman, and is mentioned in the
help but it did not find its way upstream.

Reported-by: Graeme Russ <gruss@tss-engineering.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a1dcee84 03-Dec-2012 Doug Anderson <dianders@chromium.org>

patman: Add the concept of multiple projects

There are cases that we want to support different settings (or maybe
even different aliases) for different projects. Add support for this
by:
* Adding detection for two big projects: U-Boot and Linux.
* Adding default settings for Linux (U-Boot is already good with the
standard patman defaults).
* Extend the new "settings" feature in .patman to specify per-project
settings.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 8568baed 03-Dec-2012 Doug Anderson <dianders@chromium.org>

patman: Add support for settings in .patman

This patch adds support for a [settings] section in the .patman file.
In this section you can add settings that will affect the default
values for command-line options.

Support is added in a generic way such that any setting can be updated
by just referring to the "dest" of the option that is passed to the
option parser. At the moment options that would make sense to put in
settings are "ignore_errors", "process_tags", and "verbose". You
could override them like:

[settings]
ignore_errors: True
process_tags: False
verbose: True

The settings functionality is also used in a future change which adds
support for per-project settings.

Signed-off-by: Doug Anderson <dianders@chromium.org>

# 87d65558 23-May-2012 Vikram Narayanan <vikram186@gmail.com>

patman: Handle creation of patman config file

patman shouts when it couldn't find a $(HOME)/.patman file.
Handle it in a sane way by creating a new one for the user.
It looks for a user.name and user.email in the global .gitconfig
file, waits for the user input if it can't find there. Update the
same in the README

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>

# 2b36c75d 23-May-2012 Vikram Narayanan <vikram186@gmail.com>

patman: Change the location of patman config file

Move the config file from ~/.config/patman to ~/.patman as it is
more appropriate to have it there. Update the same in the README.

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>

# 0d24de9d 14-Jan-2012 Simon Glass <sjg@chromium.org>

Add 'patman' patch generation, checking and submission script

What is this?

=============

This tool is a Python script which:
- Creates patch directly from your branch
- Cleans them up by removing unwanted tags
- Inserts a cover letter with change lists
- Runs the patches through checkpatch.pl and its own checks
- Optionally emails them out to selected people

It is intended to automate patch creation and make it a less
error-prone process. It is useful for U-Boot and Linux work so far,
since it uses the checkpatch.pl script.

It is configured almost entirely by tags it finds in your commits.
This means that you can work on a number of different branches at
once, and keep the settings with each branch rather than having to
git format-patch, git send-email, etc. with the correct parameters
each time. So for example if you put:

in one of your commits, the series will be sent there.

See the README file for full details.
END

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7208396b 24-Jul-2020 Tom Rini <trini@konsulko.com>

Revert "Merge tag 'dm-pull-20jul20' of git://git.denx.de/u-boot-dm"

This reverts commit 5d3a21df6694ebd66d5c34c9d62a26edc7456fc7, reversing
changes made to 56d37f1c564107e27d873181d838571b7d7860e7.

Unfortunately this is causing CI failures:
https://travis-ci.org/github/trini/u-boot/jobs/711313649

Signed-off-by: Tom Rini <trini@konsulko.com>

# e676fab7 05-Jul-2020 Simon Glass <sjg@chromium.org>

patman: Convert to ArgumentParser

Convert from OptionParser to ArgumentParser to match binman. With this we
can easily add sub-commands.

Signed-off-by: Simon Glass <sjg@chromium.org>

# dd3dac2f 07-Jun-2020 Simon Glass <sjg@chromium.org>

patman: Avoid importing gitutil in settings

Pass this module in so that settings does not need to import it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Stefan Bosch <stefan_b@posteo.net>

# bf776679 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Move to absolute imports

At present patman sets the python path on startup so that it can access
the libraries it needs. If we convert to use absolute imports this is not
necessary.

Move patman to use absolute imports. This requires changes in tools which
use the patman libraries (which is most of them).

Signed-off-by: Simon Glass <sjg@chromium.org>

# c3a13cc3 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Drop Python 2 StringIO code

We can rely on Python 3 now, so drop the workaround for importing
StringIO.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 83a45187 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Drop references to __future__

We don't need these now that the tools using Python 3. Drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 272cd85d 31-Oct-2019 Simon Glass <sjg@chromium.org>

patman: Use unicode for file I/O

At present patman test fail in some environments which don't use utf-8
as the default file encoding. Add this explicitly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ebb45c7 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Avoid unicode type in settings unit tests

The unicode type does not exist in Python 3 and when displaying strings
they do not have the 'u' prefix. Adjusts the settings unit tests to deal
with this difference, by converting the comparison value to a string, thus
dropping the 'u'.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 513eace4 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Move unicode helpers to tools

Create helper functions in the tools module to deal with the differences
between unicode in Python 2 (where we use the 'unicode' type) and Python 3
(where we use the 'str' type).

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a4c5dd4 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Use items() instead of iteritems()

Python 3 requires this, and Python 2 allows it. Convert the code over to
ensure compatibility with Python 3.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ec9e0f47 01-Oct-2018 Simon Glass <sjg@chromium.org>

patman: Handle unicode in _ProjectConfigParser tests

With Python 2.7.15rc1, ConfigParser.SafeConfigParser has unfortunately
started returning unicode, for unknown reasons. Adjust the code to handle
this by converting everything to unicode. We cannot convert things to
ASCII since email addresses may be encoded with UTF-8.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b8a48fbc 27-Jun-2018 Adam Sampson <ats@offog.org>

patman: Split alias entries on arbitrary whitespace

Previously the first three words in a git-mailrc alias entry could only
be separated by spaces. git-send-email and Mutt both allow arbitrary
whitespace here.

Signed-off-by: Adam Sampson <ats@offog.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# ad893140 12-Sep-2017 Simon Glass <sjg@chromium.org>

patman: Fix error when the email blacklist is missing

This section of the settings file may be missing. Handle that gracefully
rather than emitting an error.

Also update patman to write this section when a new settings file is
created.

Fixes: e11aa602 (patman: add support for omitting bouncing addresses)

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Chris Packham <judge.pckham@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>

# e11aa602 01-Sep-2017 Chris Packham <judge.packham@gmail.com>

patman: add support for omitting bouncing addresses

Add support for reading a list of bouncing addresses from a in-tree file
(doc/bounces) and from the ~/.patman config file. These addresses are
stripped from the Cc list.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com <mailto:philipp.tomsich@theobroma-systems.com>>

# f5d44b9b 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Fix doctest StringIO import for python 3.x

In python 3.x StringIO is no longer a module, and the class can instead
be found in the io module. Adjust the code in the doctest input to
account for both.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# c9eac38a 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Use items() to iterate over dictionaries

In python 3.x the iteritems() method has been removed from dictionaries,
and the items() method does effectively the same thing. On python 2.x
using items() is a little less efficient since it involves copying data,
but as speed isn't a concern in this code switch to using items() anyway
for simplicity.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2ce7b21e 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Import 'configparser' lower case to be python 3.x safe

In python 3.x module names used in import statements are case sensitive,
and the configparser module is named in all lower-case. Import it as such
in order to avoid errors when running with python 3.x.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# a920a17b 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Make print statements python 3.x safe

In python 3.x, print must be used as a function call. Convert all print
statements to the function call style, importing from __future__ where
we print with no trailing newline or print to a file object.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 8895b3e1 29-Jan-2015 Simon Glass <sjg@chromium.org>

patman: Read in the git-mailrc alias file

We should read this file to obtain a set of aliases. This reduces the need
to create them in the ~/.patman file.

This feature did exist in some version of patman, and is mentioned in the
help but it did not find its way upstream.

Reported-by: Graeme Russ <gruss@tss-engineering.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a1dcee84 03-Dec-2012 Doug Anderson <dianders@chromium.org>

patman: Add the concept of multiple projects

There are cases that we want to support different settings (or maybe
even different aliases) for different projects. Add support for this
by:
* Adding detection for two big projects: U-Boot and Linux.
* Adding default settings for Linux (U-Boot is already good with the
standard patman defaults).
* Extend the new "settings" feature in .patman to specify per-project
settings.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 8568baed 03-Dec-2012 Doug Anderson <dianders@chromium.org>

patman: Add support for settings in .patman

This patch adds support for a [settings] section in the .patman file.
In this section you can add settings that will affect the default
values for command-line options.

Support is added in a generic way such that any setting can be updated
by just referring to the "dest" of the option that is passed to the
option parser. At the moment options that would make sense to put in
settings are "ignore_errors", "process_tags", and "verbose". You
could override them like:

[settings]
ignore_errors: True
process_tags: False
verbose: True

The settings functionality is also used in a future change which adds
support for per-project settings.

Signed-off-by: Doug Anderson <dianders@chromium.org>

# 87d65558 23-May-2012 Vikram Narayanan <vikram186@gmail.com>

patman: Handle creation of patman config file

patman shouts when it couldn't find a $(HOME)/.patman file.
Handle it in a sane way by creating a new one for the user.
It looks for a user.name and user.email in the global .gitconfig
file, waits for the user input if it can't find there. Update the
same in the README

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>

# 2b36c75d 23-May-2012 Vikram Narayanan <vikram186@gmail.com>

patman: Change the location of patman config file

Move the config file from ~/.config/patman to ~/.patman as it is
more appropriate to have it there. Update the same in the README.

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>

# 0d24de9d 14-Jan-2012 Simon Glass <sjg@chromium.org>

Add 'patman' patch generation, checking and submission script

What is this?

=============

This tool is a Python script which:
- Creates patch directly from your branch
- Cleans them up by removing unwanted tags
- Inserts a cover letter with change lists
- Runs the patches through checkpatch.pl and its own checks
- Optionally emails them out to selected people

It is intended to automate patch creation and make it a less
error-prone process. It is useful for U-Boot and Linux work so far,
since it uses the checkpatch.pl script.

It is configured almost entirely by tags it finds in your commits.
This means that you can work on a number of different branches at
once, and keep the settings with each branch rather than having to
git format-patch, git send-email, etc. with the correct parameters
each time. So for example if you put:

in one of your commits, the series will be sent there.

See the README file for full details.
END

Signed-off-by: Simon Glass <sjg@chromium.org>

# dd3dac2f 07-Jun-2020 Simon Glass <sjg@chromium.org>

patman: Avoid importing gitutil in settings

Pass this module in so that settings does not need to import it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Stefan Bosch <stefan_b@posteo.net>

# bf776679 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Move to absolute imports

At present patman sets the python path on startup so that it can access
the libraries it needs. If we convert to use absolute imports this is not
necessary.

Move patman to use absolute imports. This requires changes in tools which
use the patman libraries (which is most of them).

Signed-off-by: Simon Glass <sjg@chromium.org>

# c3a13cc3 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Drop Python 2 StringIO code

We can rely on Python 3 now, so drop the workaround for importing
StringIO.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 83a45187 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Drop references to __future__

We don't need these now that the tools using Python 3. Drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 272cd85d 31-Oct-2019 Simon Glass <sjg@chromium.org>

patman: Use unicode for file I/O

At present patman test fail in some environments which don't use utf-8
as the default file encoding. Add this explicitly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ebb45c7 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Avoid unicode type in settings unit tests

The unicode type does not exist in Python 3 and when displaying strings
they do not have the 'u' prefix. Adjusts the settings unit tests to deal
with this difference, by converting the comparison value to a string, thus
dropping the 'u'.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 513eace4 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Move unicode helpers to tools

Create helper functions in the tools module to deal with the differences
between unicode in Python 2 (where we use the 'unicode' type) and Python 3
(where we use the 'str' type).

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a4c5dd4 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Use items() instead of iteritems()

Python 3 requires this, and Python 2 allows it. Convert the code over to
ensure compatibility with Python 3.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ec9e0f47 01-Oct-2018 Simon Glass <sjg@chromium.org>

patman: Handle unicode in _ProjectConfigParser tests

With Python 2.7.15rc1, ConfigParser.SafeConfigParser has unfortunately
started returning unicode, for unknown reasons. Adjust the code to handle
this by converting everything to unicode. We cannot convert things to
ASCII since email addresses may be encoded with UTF-8.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b8a48fbc 27-Jun-2018 Adam Sampson <ats@offog.org>

patman: Split alias entries on arbitrary whitespace

Previously the first three words in a git-mailrc alias entry could only
be separated by spaces. git-send-email and Mutt both allow arbitrary
whitespace here.

Signed-off-by: Adam Sampson <ats@offog.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# ad893140 12-Sep-2017 Simon Glass <sjg@chromium.org>

patman: Fix error when the email blacklist is missing

This section of the settings file may be missing. Handle that gracefully
rather than emitting an error.

Also update patman to write this section when a new settings file is
created.

Fixes: e11aa602 (patman: add support for omitting bouncing addresses)

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Chris Packham <judge.pckham@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>

# e11aa602 01-Sep-2017 Chris Packham <judge.packham@gmail.com>

patman: add support for omitting bouncing addresses

Add support for reading a list of bouncing addresses from a in-tree file
(doc/bounces) and from the ~/.patman config file. These addresses are
stripped from the Cc list.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com <mailto:philipp.tomsich@theobroma-systems.com>>

# f5d44b9b 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Fix doctest StringIO import for python 3.x

In python 3.x StringIO is no longer a module, and the class can instead
be found in the io module. Adjust the code in the doctest input to
account for both.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# c9eac38a 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Use items() to iterate over dictionaries

In python 3.x the iteritems() method has been removed from dictionaries,
and the items() method does effectively the same thing. On python 2.x
using items() is a little less efficient since it involves copying data,
but as speed isn't a concern in this code switch to using items() anyway
for simplicity.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2ce7b21e 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Import 'configparser' lower case to be python 3.x safe

In python 3.x module names used in import statements are case sensitive,
and the configparser module is named in all lower-case. Import it as such
in order to avoid errors when running with python 3.x.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# a920a17b 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Make print statements python 3.x safe

In python 3.x, print must be used as a function call. Convert all print
statements to the function call style, importing from __future__ where
we print with no trailing newline or print to a file object.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 8895b3e1 29-Jan-2015 Simon Glass <sjg@chromium.org>

patman: Read in the git-mailrc alias file

We should read this file to obtain a set of aliases. This reduces the need
to create them in the ~/.patman file.

This feature did exist in some version of patman, and is mentioned in the
help but it did not find its way upstream.

Reported-by: Graeme Russ <gruss@tss-engineering.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a1dcee84 03-Dec-2012 Doug Anderson <dianders@chromium.org>

patman: Add the concept of multiple projects

There are cases that we want to support different settings (or maybe
even different aliases) for different projects. Add support for this
by:
* Adding detection for two big projects: U-Boot and Linux.
* Adding default settings for Linux (U-Boot is already good with the
standard patman defaults).
* Extend the new "settings" feature in .patman to specify per-project
settings.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 8568baed 03-Dec-2012 Doug Anderson <dianders@chromium.org>

patman: Add support for settings in .patman

This patch adds support for a [settings] section in the .patman file.
In this section you can add settings that will affect the default
values for command-line options.

Support is added in a generic way such that any setting can be updated
by just referring to the "dest" of the option that is passed to the
option parser. At the moment options that would make sense to put in
settings are "ignore_errors", "process_tags", and "verbose". You
could override them like:

[settings]
ignore_errors: True
process_tags: False
verbose: True

The settings functionality is also used in a future change which adds
support for per-project settings.

Signed-off-by: Doug Anderson <dianders@chromium.org>

# 87d65558 23-May-2012 Vikram Narayanan <vikram186@gmail.com>

patman: Handle creation of patman config file

patman shouts when it couldn't find a $(HOME)/.patman file.
Handle it in a sane way by creating a new one for the user.
It looks for a user.name and user.email in the global .gitconfig
file, waits for the user input if it can't find there. Update the
same in the README

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>

# 2b36c75d 23-May-2012 Vikram Narayanan <vikram186@gmail.com>

patman: Change the location of patman config file

Move the config file from ~/.config/patman to ~/.patman as it is
more appropriate to have it there. Update the same in the README.

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>

# 0d24de9d 14-Jan-2012 Simon Glass <sjg@chromium.org>

Add 'patman' patch generation, checking and submission script

What is this?

=============

This tool is a Python script which:
- Creates patch directly from your branch
- Cleans them up by removing unwanted tags
- Inserts a cover letter with change lists
- Runs the patches through checkpatch.pl and its own checks
- Optionally emails them out to selected people

It is intended to automate patch creation and make it a less
error-prone process. It is useful for U-Boot and Linux work so far,
since it uses the checkpatch.pl script.

It is configured almost entirely by tags it finds in your commits.
This means that you can work on a number of different branches at
once, and keep the settings with each branch rather than having to
git format-patch, git send-email, etc. with the correct parameters
each time. So for example if you put:

in one of your commits, the series will be sent there.

See the README file for full details.
END

Signed-off-by: Simon Glass <sjg@chromium.org>

# bf776679 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Move to absolute imports

At present patman sets the python path on startup so that it can access
the libraries it needs. If we convert to use absolute imports this is not
necessary.

Move patman to use absolute imports. This requires changes in tools which
use the patman libraries (which is most of them).

Signed-off-by: Simon Glass <sjg@chromium.org>

# c3a13cc3 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Drop Python 2 StringIO code

We can rely on Python 3 now, so drop the workaround for importing
StringIO.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 83a45187 17-Apr-2020 Simon Glass <sjg@chromium.org>

patman: Drop references to __future__

We don't need these now that the tools using Python 3. Drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 272cd85d 31-Oct-2019 Simon Glass <sjg@chromium.org>

patman: Use unicode for file I/O

At present patman test fail in some environments which don't use utf-8
as the default file encoding. Add this explicitly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ebb45c7 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Avoid unicode type in settings unit tests

The unicode type does not exist in Python 3 and when displaying strings
they do not have the 'u' prefix. Adjusts the settings unit tests to deal
with this difference, by converting the comparison value to a string, thus
dropping the 'u'.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 513eace4 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Move unicode helpers to tools

Create helper functions in the tools module to deal with the differences
between unicode in Python 2 (where we use the 'unicode' type) and Python 3
(where we use the 'str' type).

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a4c5dd4 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Use items() instead of iteritems()

Python 3 requires this, and Python 2 allows it. Convert the code over to
ensure compatibility with Python 3.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ec9e0f47 01-Oct-2018 Simon Glass <sjg@chromium.org>

patman: Handle unicode in _ProjectConfigParser tests

With Python 2.7.15rc1, ConfigParser.SafeConfigParser has unfortunately
started returning unicode, for unknown reasons. Adjust the code to handle
this by converting everything to unicode. We cannot convert things to
ASCII since email addresses may be encoded with UTF-8.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b8a48fbc 27-Jun-2018 Adam Sampson <ats@offog.org>

patman: Split alias entries on arbitrary whitespace

Previously the first three words in a git-mailrc alias entry could only
be separated by spaces. git-send-email and Mutt both allow arbitrary
whitespace here.

Signed-off-by: Adam Sampson <ats@offog.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# ad893140 12-Sep-2017 Simon Glass <sjg@chromium.org>

patman: Fix error when the email blacklist is missing

This section of the settings file may be missing. Handle that gracefully
rather than emitting an error.

Also update patman to write this section when a new settings file is
created.

Fixes: e11aa602 (patman: add support for omitting bouncing addresses)

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Chris Packham <judge.pckham@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>

# e11aa602 01-Sep-2017 Chris Packham <judge.packham@gmail.com>

patman: add support for omitting bouncing addresses

Add support for reading a list of bouncing addresses from a in-tree file
(doc/bounces) and from the ~/.patman config file. These addresses are
stripped from the Cc list.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com <mailto:philipp.tomsich@theobroma-systems.com>>

# f5d44b9b 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Fix doctest StringIO import for python 3.x

In python 3.x StringIO is no longer a module, and the class can instead
be found in the io module. Adjust the code in the doctest input to
account for both.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# c9eac38a 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Use items() to iterate over dictionaries

In python 3.x the iteritems() method has been removed from dictionaries,
and the items() method does effectively the same thing. On python 2.x
using items() is a little less efficient since it involves copying data,
but as speed isn't a concern in this code switch to using items() anyway
for simplicity.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2ce7b21e 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Import 'configparser' lower case to be python 3.x safe

In python 3.x module names used in import statements are case sensitive,
and the configparser module is named in all lower-case. Import it as such
in order to avoid errors when running with python 3.x.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# a920a17b 27-Sep-2016 Paul Burton <paul.burton@mips.com>

patman: Make print statements python 3.x safe

In python 3.x, print must be used as a function call. Convert all print
statements to the function call style, importing from __future__ where
we print with no trailing newline or print to a file object.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 8895b3e1 29-Jan-2015 Simon Glass <sjg@chromium.org>

patman: Read in the git-mailrc alias file

We should read this file to obtain a set of aliases. This reduces the need
to create them in the ~/.patman file.

This feature did exist in some version of patman, and is mentioned in the
help but it did not find its way upstream.

Reported-by: Graeme Russ <gruss@tss-engineering.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a1dcee84 03-Dec-2012 Doug Anderson <dianders@chromium.org>

patman: Add the concept of multiple projects

There are cases that we want to support different settings (or maybe
even different aliases) for different projects. Add support for this
by:
* Adding detection for two big projects: U-Boot and Linux.
* Adding default settings for Linux (U-Boot is already good with the
standard patman defaults).
* Extend the new "settings" feature in .patman to specify per-project
settings.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 8568baed 03-Dec-2012 Doug Anderson <dianders@chromium.org>

patman: Add support for settings in .patman

This patch adds support for a [settings] section in the .patman file.
In this section you can add settings that will affect the default
values for command-line options.

Support is added in a generic way such that any setting can be updated
by just referring to the "dest" of the option that is passed to the
option parser. At the moment options that would make sense to put in
settings are "ignore_errors", "process_tags", and "verbose". You
could override them like:

[settings]
ignore_errors: True
process_tags: False
verbose: True

The settings functionality is also used in a future change which adds
support for per-project settings.

Signed-off-by: Doug Anderson <dianders@chromium.org>

# 87d65558 23-May-2012 Vikram Narayanan <vikram186@gmail.com>

patman: Handle creation of patman config file

patman shouts when it couldn't find a $(HOME)/.patman file.
Handle it in a sane way by creating a new one for the user.
It looks for a user.name and user.email in the global .gitconfig
file, waits for the user input if it can't find there. Update the
same in the README

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>

# 2b36c75d 23-May-2012 Vikram Narayanan <vikram186@gmail.com>

patman: Change the location of patman config file

Move the config file from ~/.config/patman to ~/.patman as it is
more appropriate to have it there. Update the same in the README.

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>

# 0d24de9d 14-Jan-2012 Simon Glass <sjg@chromium.org>

Add 'patman' patch generation, checking and submission script

What is this?

=============

This tool is a Python script which:
- Creates patch directly from your branch
- Cleans them up by removing unwanted tags
- Inserts a cover letter with change lists
- Runs the patches through checkpatch.pl and its own checks
- Optionally emails them out to selected people

It is intended to automate patch creation and make it a less
error-prone process. It is useful for U-Boot and Linux work so far,
since it uses the checkpatch.pl script.

It is configured almost entirely by tags it finds in your commits.
This means that you can work on a number of different branches at
once, and keep the settings with each branch rather than having to
git format-patch, git send-email, etc. with the correct parameters
each time. So for example if you put:

in one of your commits, the series will be sent there.

See the README file for full details.
END

Signed-off-by: Simon Glass <sjg@chromium.org>

# 272cd85d 31-Oct-2019 Simon Glass <sjg@chromium.org>

patman: Use unicode for file I/O

At present patman test fail in some environments which don't use utf-8
as the default file encoding. Add this explicitly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ebb45c7 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Avoid unicode type in settings unit tests

The unicode type does not exist in Python 3 and when displaying strings
they do not have the 'u' prefix. Adjusts the settings unit tests to deal
with this difference, by converting the comparison value to a string, thus
dropping the 'u'.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 513eace4 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Move unicode helpers to tools

Create helper functions in the tools module to deal with the differences
between unicode in Python 2 (where we use the 'unicode' type) and Python 3
(where we use the 'str' type).

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a4c5dd4 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Use items() instead of iteritems()

Python 3 requires this, and Python 2 allows it. Convert the code over to
ensure compatibility with Python 3.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ec9e0f47 01-Oct-2018 Simon Glass <sjg@chromium.org>

patman: Handle unicode in _ProjectConfigParser tests

With Python 2.7.15rc1, ConfigParser.SafeConfigParser has unfortunately
started returning unicode, for unknown reasons. Adjust the code to handle
this by converting everything to unicode. We cannot convert things to
ASCII since email addresses may be encoded with UTF-8.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b8a48fbc 27-Jun-2018 Adam Sampson <ats@offog.org>

patman: Split alias entries on arbitrary whitespace

Previously the first three words in a git-mailrc alias entry could only
be separated by spaces. git-send-email and Mutt both allow arbitrary
whitespace here.

Signed-off-by: Adam Sampson <ats@offog.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# ad893140 12-Sep-2017 Simon Glass <sjg@chromium.org>

patman: Fix error when the email blacklist is missing

This section of the settings file may be missing. Handle that gracefully
rather than emitting an error.

Also update patman to write this section when a new settings file is
created.

Fixes: e11aa602 (patman: add support for omitting bouncing addresses)

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Chris Packham <judge.pckham@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>

# e11aa602 01-Sep-2017 Chris Packham <judge.packham@gmail.com>

patman: add support for omitting bouncing addresses

Add support for reading a list of bouncing addresses from a in-tree file
(doc/bounces) and from the ~/.patman config file. These addresses are
stripped from the Cc list.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com <mailto:philipp.tomsich@theobroma-systems.com>>

# f5d44b9b 27-Sep-2016 Paul Burton <paul.burton@imgtec.com>

patman: Fix doctest StringIO import for python 3.x

In python 3.x StringIO is no longer a module, and the class can instead
be found in the io module. Adjust the code in the doctest input to
account for both.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# c9eac38a 27-Sep-2016 Paul Burton <paul.burton@imgtec.com>

patman: Use items() to iterate over dictionaries

In python 3.x the iteritems() method has been removed from dictionaries,
and the items() method does effectively the same thing. On python 2.x
using items() is a little less efficient since it involves copying data,
but as speed isn't a concern in this code switch to using items() anyway
for simplicity.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2ce7b21e 27-Sep-2016 Paul Burton <paul.burton@imgtec.com>

patman: Import 'configparser' lower case to be python 3.x safe

In python 3.x module names used in import statements are case sensitive,
and the configparser module is named in all lower-case. Import it as such
in order to avoid errors when running with python 3.x.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# a920a17b 27-Sep-2016 Paul Burton <paul.burton@imgtec.com>

patman: Make print statements python 3.x safe

In python 3.x, print must be used as a function call. Convert all print
statements to the function call style, importing from __future__ where
we print with no trailing newline or print to a file object.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 8895b3e1 29-Jan-2015 Simon Glass <sjg@chromium.org>

patman: Read in the git-mailrc alias file

We should read this file to obtain a set of aliases. This reduces the need
to create them in the ~/.patman file.

This feature did exist in some version of patman, and is mentioned in the
help but it did not find its way upstream.

Reported-by: Graeme Russ <gruss@tss-engineering.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a1dcee84 03-Dec-2012 Doug Anderson <dianders@chromium.org>

patman: Add the concept of multiple projects

There are cases that we want to support different settings (or maybe
even different aliases) for different projects. Add support for this
by:
* Adding detection for two big projects: U-Boot and Linux.
* Adding default settings for Linux (U-Boot is already good with the
standard patman defaults).
* Extend the new "settings" feature in .patman to specify per-project
settings.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 8568baed 03-Dec-2012 Doug Anderson <dianders@chromium.org>

patman: Add support for settings in .patman

This patch adds support for a [settings] section in the .patman file.
In this section you can add settings that will affect the default
values for command-line options.

Support is added in a generic way such that any setting can be updated
by just referring to the "dest" of the option that is passed to the
option parser. At the moment options that would make sense to put in
settings are "ignore_errors", "process_tags", and "verbose". You
could override them like:

[settings]
ignore_errors: True
process_tags: False
verbose: True

The settings functionality is also used in a future change which adds
support for per-project settings.

Signed-off-by: Doug Anderson <dianders@chromium.org>

# 87d65558 23-May-2012 Vikram Narayanan <vikram186@gmail.com>

patman: Handle creation of patman config file

patman shouts when it couldn't find a $(HOME)/.patman file.
Handle it in a sane way by creating a new one for the user.
It looks for a user.name and user.email in the global .gitconfig
file, waits for the user input if it can't find there. Update the
same in the README

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>

# 2b36c75d 23-May-2012 Vikram Narayanan <vikram186@gmail.com>

patman: Change the location of patman config file

Move the config file from ~/.config/patman to ~/.patman as it is
more appropriate to have it there. Update the same in the README.

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>

# 0d24de9d 14-Jan-2012 Simon Glass <sjg@chromium.org>

Add 'patman' patch generation, checking and submission script

What is this?

=============

This tool is a Python script which:
- Creates patch directly from your branch
- Cleans them up by removing unwanted tags
- Inserts a cover letter with change lists
- Runs the patches through checkpatch.pl and its own checks
- Optionally emails them out to selected people

It is intended to automate patch creation and make it a less
error-prone process. It is useful for U-Boot and Linux work so far,
since it uses the checkpatch.pl script.

It is configured almost entirely by tags it finds in your commits.
This means that you can work on a number of different branches at
once, and keep the settings with each branch rather than having to
git format-patch, git send-email, etc. with the correct parameters
each time. So for example if you put:

in one of your commits, the series will be sent there.

See the README file for full details.
END

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ebb45c7 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Avoid unicode type in settings unit tests

The unicode type does not exist in Python 3 and when displaying strings
they do not have the 'u' prefix. Adjusts the settings unit tests to deal
with this difference, by converting the comparison value to a string, thus
dropping the 'u'.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 513eace4 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Move unicode helpers to tools

Create helper functions in the tools module to deal with the differences
between unicode in Python 2 (where we use the 'unicode' type) and Python 3
(where we use the 'str' type).

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a4c5dd4 14-May-2019 Simon Glass <sjg@chromium.org>

patman: Use items() instead of iteritems()

Python 3 requires this, and Python 2 allows it. Convert the code over to
ensure compatibility with Python 3.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ec9e0f47 01-Oct-2018 Simon Glass <sjg@chromium.org>

patman: Handle unicode in _ProjectConfigParser tests

With Python 2.7.15rc1, ConfigParser.SafeConfigParser has unfortunately
started returning unicode, for unknown reasons. Adjust the code to handle
this by converting everything to unicode. We cannot convert things to
ASCII since email addresses may be encoded with UTF-8.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b8a48fbc 27-Jun-2018 Adam Sampson <ats@offog.org>

patman: Split alias entries on arbitrary whitespace

Previously the first three words in a git-mailrc alias entry could only
be separated by spaces. git-send-email and Mutt both allow arbitrary
whitespace here.

Signed-off-by: Adam Sampson <ats@offog.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# ad893140 12-Sep-2017 Simon Glass <sjg@chromium.org>

patman: Fix error when the email blacklist is missing

This section of the settings file may be missing. Handle that gracefully
rather than emitting an error.

Also update patman to write this section when a new settings file is
created.

Fixes: e11aa602 (patman: add support for omitting bouncing addresses)

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Chris Packham <judge.pckham@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>

# e11aa602 01-Sep-2017 Chris Packham <judge.packham@gmail.com>

patman: add support for omitting bouncing addresses

Add support for reading a list of bouncing addresses from a in-tree file
(doc/bounces) and from the ~/.patman config file. These addresses are
stripped from the Cc list.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com <mailto:philipp.tomsich@theobroma-systems.com>>

# f5d44b9b 27-Sep-2016 Paul Burton <paul.burton@imgtec.com>

patman: Fix doctest StringIO import for python 3.x

In python 3.x StringIO is no longer a module, and the class can instead
be found in the io module. Adjust the code in the doctest input to
account for both.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# c9eac38a 27-Sep-2016 Paul Burton <paul.burton@imgtec.com>

patman: Use items() to iterate over dictionaries

In python 3.x the iteritems() method has been removed from dictionaries,
and the items() method does effectively the same thing. On python 2.x
using items() is a little less efficient since it involves copying data,
but as speed isn't a concern in this code switch to using items() anyway
for simplicity.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2ce7b21e 27-Sep-2016 Paul Burton <paul.burton@imgtec.com>

patman: Import 'configparser' lower case to be python 3.x safe

In python 3.x module names used in import statements are case sensitive,
and the configparser module is named in all lower-case. Import it as such
in order to avoid errors when running with python 3.x.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# a920a17b 27-Sep-2016 Paul Burton <paul.burton@imgtec.com>

patman: Make print statements python 3.x safe

In python 3.x, print must be used as a function call. Convert all print
statements to the function call style, importing from __future__ where
we print with no trailing newline or print to a file object.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 8895b3e1 29-Jan-2015 Simon Glass <sjg@chromium.org>

patman: Read in the git-mailrc alias file

We should read this file to obtain a set of aliases. This reduces the need
to create them in the ~/.patman file.

This feature did exist in some version of patman, and is mentioned in the
help but it did not find its way upstream.

Reported-by: Graeme Russ <gruss@tss-engineering.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a1dcee84 03-Dec-2012 Doug Anderson <dianders@chromium.org>

patman: Add the concept of multiple projects

There are cases that we want to support different settings (or maybe
even different aliases) for different projects. Add support for this
by:
* Adding detection for two big projects: U-Boot and Linux.
* Adding default settings for Linux (U-Boot is already good with the
standard patman defaults).
* Extend the new "settings" feature in .patman to specify per-project
settings.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 8568baed 03-Dec-2012 Doug Anderson <dianders@chromium.org>

patman: Add support for settings in .patman

This patch adds support for a [settings] section in the .patman file.
In this section you can add settings that will affect the default
values for command-line options.

Support is added in a generic way such that any setting can be updated
by just referring to the "dest" of the option that is passed to the
option parser. At the moment options that would make sense to put in
settings are "ignore_errors", "process_tags", and "verbose". You
could override them like:

[settings]
ignore_errors: True
process_tags: False
verbose: True

The settings functionality is also used in a future change which adds
support for per-project settings.

Signed-off-by: Doug Anderson <dianders@chromium.org>

# 87d65558 23-May-2012 Vikram Narayanan <vikram186@gmail.com>

patman: Handle creation of patman config file

patman shouts when it couldn't find a $(HOME)/.patman file.
Handle it in a sane way by creating a new one for the user.
It looks for a user.name and user.email in the global .gitconfig
file, waits for the user input if it can't find there. Update the
same in the README

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>

# 2b36c75d 23-May-2012 Vikram Narayanan <vikram186@gmail.com>

patman: Change the location of patman config file

Move the config file from ~/.config/patman to ~/.patman as it is
more appropriate to have it there. Update the same in the README.

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>

# 0d24de9d 14-Jan-2012 Simon Glass <sjg@chromium.org>

Add 'patman' patch generation, checking and submission script

What is this?

=============

This tool is a Python script which:
- Creates patch directly from your branch
- Cleans them up by removing unwanted tags
- Inserts a cover letter with change lists
- Runs the patches through checkpatch.pl and its own checks
- Optionally emails them out to selected people

It is intended to automate patch creation and make it a less
error-prone process. It is useful for U-Boot and Linux work so far,
since it uses the checkpatch.pl script.

It is configured almost entirely by tags it finds in your commits.
This means that you can work on a number of different branches at
once, and keep the settings with each branch rather than having to
git format-patch, git send-email, etc. with the correct parameters
each time. So for example if you put:

in one of your commits, the series will be sent there.

See the README file for full details.
END

Signed-off-by: Simon Glass <sjg@chromium.org>

# ec9e0f47 01-Oct-2018 Simon Glass <sjg@chromium.org>

patman: Handle unicode in _ProjectConfigParser tests

With Python 2.7.15rc1, ConfigParser.SafeConfigParser has unfortunately
started returning unicode, for unknown reasons. Adjust the code to handle
this by converting everything to unicode. We cannot convert things to
ASCII since email addresses may be encoded with UTF-8.

Signed-off-by: Simon Glass <sjg@chromium.org>


# b8a48fbc 27-Jun-2018 Adam Sampson <ats@offog.org>

patman: Split alias entries on arbitrary whitespace

Previously the first three words in a git-mailrc alias entry could only
be separated by spaces. git-send-email and Mutt both allow arbitrary
whitespace here.

Signed-off-by: Adam Sampson <ats@offog.org>
Reviewed-by: Simon Glass <sjg@chromium.org>


# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>


# ad893140 12-Sep-2017 Simon Glass <sjg@chromium.org>

patman: Fix error when the email blacklist is missing

This section of the settings file may be missing. Handle that gracefully
rather than emitting an error.

Also update patman to write this section when a new settings file is
created.

Fixes: e11aa602 (patman: add support for omitting bouncing addresses)

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Chris Packham <judge.pckham@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>


# e11aa602 01-Sep-2017 Chris Packham <judge.packham@gmail.com>

patman: add support for omitting bouncing addresses

Add support for reading a list of bouncing addresses from a in-tree file
(doc/bounces) and from the ~/.patman config file. These addresses are
stripped from the Cc list.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com <mailto:philipp.tomsich@theobroma-systems.com>>


# f5d44b9b 27-Sep-2016 Paul Burton <paul.burton@imgtec.com>

patman: Fix doctest StringIO import for python 3.x

In python 3.x StringIO is no longer a module, and the class can instead
be found in the io module. Adjust the code in the doctest input to
account for both.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>


# c9eac38a 27-Sep-2016 Paul Burton <paul.burton@imgtec.com>

patman: Use items() to iterate over dictionaries

In python 3.x the iteritems() method has been removed from dictionaries,
and the items() method does effectively the same thing. On python 2.x
using items() is a little less efficient since it involves copying data,
but as speed isn't a concern in this code switch to using items() anyway
for simplicity.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>


# 2ce7b21e 27-Sep-2016 Paul Burton <paul.burton@imgtec.com>

patman: Import 'configparser' lower case to be python 3.x safe

In python 3.x module names used in import statements are case sensitive,
and the configparser module is named in all lower-case. Import it as such
in order to avoid errors when running with python 3.x.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>


# a920a17b 27-Sep-2016 Paul Burton <paul.burton@imgtec.com>

patman: Make print statements python 3.x safe

In python 3.x, print must be used as a function call. Convert all print
statements to the function call style, importing from __future__ where
we print with no trailing newline or print to a file object.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Simon Glass <sjg@chromium.org>


# 8895b3e1 29-Jan-2015 Simon Glass <sjg@chromium.org>

patman: Read in the git-mailrc alias file

We should read this file to obtain a set of aliases. This reduces the need
to create them in the ~/.patman file.

This feature did exist in some version of patman, and is mentioned in the
help but it did not find its way upstream.

Reported-by: Graeme Russ <gruss@tss-engineering.com>
Signed-off-by: Simon Glass <sjg@chromium.org>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>


# a1dcee84 03-Dec-2012 Doug Anderson <dianders@chromium.org>

patman: Add the concept of multiple projects

There are cases that we want to support different settings (or maybe
even different aliases) for different projects. Add support for this
by:
* Adding detection for two big projects: U-Boot and Linux.
* Adding default settings for Linux (U-Boot is already good with the
standard patman defaults).
* Extend the new "settings" feature in .patman to specify per-project
settings.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>


# 8568baed 03-Dec-2012 Doug Anderson <dianders@chromium.org>

patman: Add support for settings in .patman

This patch adds support for a [settings] section in the .patman file.
In this section you can add settings that will affect the default
values for command-line options.

Support is added in a generic way such that any setting can be updated
by just referring to the "dest" of the option that is passed to the
option parser. At the moment options that would make sense to put in
settings are "ignore_errors", "process_tags", and "verbose". You
could override them like:

[settings]
ignore_errors: True
process_tags: False
verbose: True

The settings functionality is also used in a future change which adds
support for per-project settings.

Signed-off-by: Doug Anderson <dianders@chromium.org>


# 87d65558 23-May-2012 Vikram Narayanan <vikram186@gmail.com>

patman: Handle creation of patman config file

patman shouts when it couldn't find a $(HOME)/.patman file.
Handle it in a sane way by creating a new one for the user.
It looks for a user.name and user.email in the global .gitconfig
file, waits for the user input if it can't find there. Update the
same in the README

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>


# 2b36c75d 23-May-2012 Vikram Narayanan <vikram186@gmail.com>

patman: Change the location of patman config file

Move the config file from ~/.config/patman to ~/.patman as it is
more appropriate to have it there. Update the same in the README.

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>


# 0d24de9d 14-Jan-2012 Simon Glass <sjg@chromium.org>

Add 'patman' patch generation, checking and submission script

What is this?

=============

This tool is a Python script which:
- Creates patch directly from your branch
- Cleans them up by removing unwanted tags
- Inserts a cover letter with change lists
- Runs the patches through checkpatch.pl and its own checks
- Optionally emails them out to selected people

It is intended to automate patch creation and make it a less
error-prone process. It is useful for U-Boot and Linux work so far,
since it uses the checkpatch.pl script.

It is configured almost entirely by tags it finds in your commits.
This means that you can work on a number of different branches at
once, and keep the settings with each branch rather than having to
git format-patch, git send-email, etc. with the correct parameters
each time. So for example if you put:

in one of your commits, the series will be sent there.

See the README file for full details.
END

Signed-off-by: Simon Glass <sjg@chromium.org>