patch-manager 0.0.5__tar.gz → 0.0.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {patch-manager-0.0.5 → patch-manager-0.0.6}/PKG-INFO +2 -2
- {patch-manager-0.0.5 → patch-manager-0.0.6}/pyproject.toml +3 -3
- {patch-manager-0.0.5 → patch-manager-0.0.6}/src/patch_manager.egg-info/PKG-INFO +2 -2
- {patch-manager-0.0.5 → patch-manager-0.0.6}/src/patch_manager.egg-info/SOURCES.txt +1 -0
- patch-manager-0.0.6/src/patch_manager.egg-info/entry_points.txt +2 -0
- patch-manager-0.0.6/src/patch_manager.egg-info/requires.txt +1 -0
- patch-manager-0.0.6/src/patman/__main__.py +98 -0
- patch-manager-0.0.6/src/patman/cmdline.py +147 -0
- patch-manager-0.0.5/src/patch_manager.egg-info/entry_points.txt +0 -2
- patch-manager-0.0.5/src/patch_manager.egg-info/requires.txt +0 -1
- patch-manager-0.0.5/src/patman/__main__.py +0 -202
- {patch-manager-0.0.5 → patch-manager-0.0.6}/LICENSE +0 -0
- {patch-manager-0.0.5 → patch-manager-0.0.6}/README.rst +0 -0
- {patch-manager-0.0.5 → patch-manager-0.0.6}/setup.cfg +0 -0
- {patch-manager-0.0.5 → patch-manager-0.0.6}/src/patch_manager.egg-info/dependency_links.txt +0 -0
- {patch-manager-0.0.5 → patch-manager-0.0.6}/src/patch_manager.egg-info/top_level.txt +0 -0
- {patch-manager-0.0.5 → patch-manager-0.0.6}/src/patman/README.rst +0 -0
- {patch-manager-0.0.5 → patch-manager-0.0.6}/src/patman/__init__.py +0 -0
- {patch-manager-0.0.5 → patch-manager-0.0.6}/src/patman/checkpatch.py +0 -0
- {patch-manager-0.0.5 → patch-manager-0.0.6}/src/patman/commit.py +0 -0
- {patch-manager-0.0.5 → patch-manager-0.0.6}/src/patman/control.py +0 -0
- {patch-manager-0.0.5 → patch-manager-0.0.6}/src/patman/func_test.py +0 -0
- {patch-manager-0.0.5 → patch-manager-0.0.6}/src/patman/get_maintainer.py +0 -0
- {patch-manager-0.0.5 → patch-manager-0.0.6}/src/patman/gitutil.py +0 -0
- {patch-manager-0.0.5 → patch-manager-0.0.6}/src/patman/patchstream.py +0 -0
- {patch-manager-0.0.5 → patch-manager-0.0.6}/src/patman/patman.rst +0 -0
- {patch-manager-0.0.5 → patch-manager-0.0.6}/src/patman/project.py +0 -0
- {patch-manager-0.0.5 → patch-manager-0.0.6}/src/patman/series.py +0 -0
- {patch-manager-0.0.5 → patch-manager-0.0.6}/src/patman/settings.py +0 -0
- {patch-manager-0.0.5 → patch-manager-0.0.6}/src/patman/setup.py +0 -0
- {patch-manager-0.0.5 → patch-manager-0.0.6}/src/patman/status.py +0 -0
- {patch-manager-0.0.5 → patch-manager-0.0.6}/src/patman/test_checkpatch.py +0 -0
- {patch-manager-0.0.5 → patch-manager-0.0.6}/src/patman/test_settings.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: patch-manager
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.6
|
|
4
4
|
Summary: Patman patch manager
|
|
5
5
|
Author-email: Simon Glass <sjg@chromium.org>
|
|
6
6
|
Project-URL: Homepage, https://docs.u-boot.org/en/latest/develop/patman.html
|
|
@@ -11,7 +11,7 @@ Classifier: Operating System :: OS Independent
|
|
|
11
11
|
Requires-Python: >=3.7
|
|
12
12
|
Description-Content-Type: text/x-rst
|
|
13
13
|
License-File: LICENSE
|
|
14
|
-
Requires-Dist: u_boot_pylib>=0.0.
|
|
14
|
+
Requires-Dist: u_boot_pylib>=0.0.6
|
|
15
15
|
|
|
16
16
|
.. SPDX-License-Identifier: GPL-2.0+
|
|
17
17
|
.. Copyright (c) 2011 The Chromium OS Authors
|
|
@@ -4,11 +4,11 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "patch-manager"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.6"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name="Simon Glass", email="sjg@chromium.org" },
|
|
10
10
|
]
|
|
11
|
-
dependencies = ["u_boot_pylib >= 0.0.
|
|
11
|
+
dependencies = ["u_boot_pylib >= 0.0.6"]
|
|
12
12
|
description = "Patman patch manager"
|
|
13
13
|
readme = "README.rst"
|
|
14
14
|
requires-python = ">=3.7"
|
|
@@ -23,7 +23,7 @@ classifiers = [
|
|
|
23
23
|
"Bug Tracker" = "https://source.denx.de/groups/u-boot/-/issues"
|
|
24
24
|
|
|
25
25
|
[project.scripts]
|
|
26
|
-
patman = "patman.__main__"
|
|
26
|
+
patman = "patman.__main__:run_patman"
|
|
27
27
|
|
|
28
28
|
[tool.setuptools.package-data]
|
|
29
29
|
patman = ["*.rst"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: patch-manager
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.6
|
|
4
4
|
Summary: Patman patch manager
|
|
5
5
|
Author-email: Simon Glass <sjg@chromium.org>
|
|
6
6
|
Project-URL: Homepage, https://docs.u-boot.org/en/latest/develop/patman.html
|
|
@@ -11,7 +11,7 @@ Classifier: Operating System :: OS Independent
|
|
|
11
11
|
Requires-Python: >=3.7
|
|
12
12
|
Description-Content-Type: text/x-rst
|
|
13
13
|
License-File: LICENSE
|
|
14
|
-
Requires-Dist: u_boot_pylib>=0.0.
|
|
14
|
+
Requires-Dist: u_boot_pylib>=0.0.6
|
|
15
15
|
|
|
16
16
|
.. SPDX-License-Identifier: GPL-2.0+
|
|
17
17
|
.. Copyright (c) 2011 The Chromium OS Authors
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
u_boot_pylib>=0.0.6
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-License-Identifier: GPL-2.0+
|
|
3
|
+
#
|
|
4
|
+
# Copyright (c) 2011 The Chromium OS Authors.
|
|
5
|
+
#
|
|
6
|
+
|
|
7
|
+
"""See README for more information"""
|
|
8
|
+
|
|
9
|
+
try:
|
|
10
|
+
from importlib import resources
|
|
11
|
+
except ImportError:
|
|
12
|
+
# for Python 3.6
|
|
13
|
+
import importlib_resources as resources
|
|
14
|
+
import os
|
|
15
|
+
import re
|
|
16
|
+
import sys
|
|
17
|
+
import traceback
|
|
18
|
+
|
|
19
|
+
# Allow 'from patman import xxx to work'
|
|
20
|
+
# pylint: disable=C0413
|
|
21
|
+
our_path = os.path.dirname(os.path.realpath(__file__))
|
|
22
|
+
sys.path.append(os.path.join(our_path, '..'))
|
|
23
|
+
|
|
24
|
+
# Our modules
|
|
25
|
+
from patman import cmdline
|
|
26
|
+
from patman import control
|
|
27
|
+
from u_boot_pylib import terminal
|
|
28
|
+
from u_boot_pylib import test_util
|
|
29
|
+
from u_boot_pylib import tools
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def run_patman():
|
|
33
|
+
"""Run patamn
|
|
34
|
+
|
|
35
|
+
This is the main program. It collects arguments and runs either the tests or
|
|
36
|
+
the control module.
|
|
37
|
+
"""
|
|
38
|
+
args = cmdline.parse_args()
|
|
39
|
+
|
|
40
|
+
if not args.debug:
|
|
41
|
+
sys.tracebacklimit = 0
|
|
42
|
+
|
|
43
|
+
# Run our meagre tests
|
|
44
|
+
if args.cmd == 'test':
|
|
45
|
+
# pylint: disable=C0415
|
|
46
|
+
from patman import func_test
|
|
47
|
+
from patman import test_checkpatch
|
|
48
|
+
|
|
49
|
+
result = test_util.run_test_suites(
|
|
50
|
+
'patman', False, False, False, None, None, None,
|
|
51
|
+
[test_checkpatch.TestPatch, func_test.TestFunctional,
|
|
52
|
+
'gitutil', 'settings'])
|
|
53
|
+
|
|
54
|
+
sys.exit(0 if result.wasSuccessful() else 1)
|
|
55
|
+
|
|
56
|
+
# Process commits, produce patches files, check them, email them
|
|
57
|
+
elif args.cmd == 'send':
|
|
58
|
+
# Called from git with a patch filename as argument
|
|
59
|
+
# Printout a list of additional CC recipients for this patch
|
|
60
|
+
if args.cc_cmd:
|
|
61
|
+
re_line = re.compile(r'(\S*) (.*)')
|
|
62
|
+
with open(args.cc_cmd, 'r', encoding='utf-8') as inf:
|
|
63
|
+
for line in inf.readlines():
|
|
64
|
+
match = re_line.match(line)
|
|
65
|
+
if match and match.group(1) == args.patchfiles[0]:
|
|
66
|
+
for cca in match.group(2).split('\0'):
|
|
67
|
+
cca = cca.strip()
|
|
68
|
+
if cca:
|
|
69
|
+
print(cca)
|
|
70
|
+
|
|
71
|
+
elif args.full_help:
|
|
72
|
+
with resources.path('patman', 'README.rst') as readme:
|
|
73
|
+
tools.print_full_help(str(readme))
|
|
74
|
+
else:
|
|
75
|
+
# If we are not processing tags, no need to warning about bad ones
|
|
76
|
+
if not args.process_tags:
|
|
77
|
+
args.ignore_bad_tags = True
|
|
78
|
+
control.send(args)
|
|
79
|
+
|
|
80
|
+
# Check status of patches in patchwork
|
|
81
|
+
elif args.cmd == 'status':
|
|
82
|
+
ret_code = 0
|
|
83
|
+
try:
|
|
84
|
+
control.patchwork_status(args.branch, args.count, args.start, args.end,
|
|
85
|
+
args.dest_branch, args.force,
|
|
86
|
+
args.show_comments, args.patchwork_url)
|
|
87
|
+
except Exception as exc:
|
|
88
|
+
terminal.tprint(f'patman: {type(exc).__name__}: {exc}',
|
|
89
|
+
colour=terminal.Color.RED)
|
|
90
|
+
if args.debug:
|
|
91
|
+
print()
|
|
92
|
+
traceback.print_exc()
|
|
93
|
+
ret_code = 1
|
|
94
|
+
sys.exit(ret_code)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
if __name__ == "__main__":
|
|
98
|
+
sys.exit(run_patman())
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# SPDX-License-Identifier: GPL-2.0+
|
|
2
|
+
#
|
|
3
|
+
# Copyright 2023 Google LLC
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
"""Handles parsing of buildman arguments
|
|
7
|
+
|
|
8
|
+
This creates the argument parser and uses it to parse the arguments passed in
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import argparse
|
|
12
|
+
import os
|
|
13
|
+
import pathlib
|
|
14
|
+
import sys
|
|
15
|
+
|
|
16
|
+
from patman import gitutil
|
|
17
|
+
from patman import project
|
|
18
|
+
from patman import settings
|
|
19
|
+
|
|
20
|
+
PATMAN_DIR = pathlib.Path(__file__).parent
|
|
21
|
+
HAS_TESTS = os.path.exists(PATMAN_DIR / "func_test.py")
|
|
22
|
+
|
|
23
|
+
def parse_args():
|
|
24
|
+
"""Parse command line arguments from sys.argv[]
|
|
25
|
+
|
|
26
|
+
Returns:
|
|
27
|
+
tuple containing:
|
|
28
|
+
options: command line options
|
|
29
|
+
args: command lin arguments
|
|
30
|
+
"""
|
|
31
|
+
epilog = '''Create patches from commits in a branch, check them and email
|
|
32
|
+
them as specified by tags you place in the commits. Use -n to do a dry
|
|
33
|
+
run first.'''
|
|
34
|
+
|
|
35
|
+
parser = argparse.ArgumentParser(epilog=epilog)
|
|
36
|
+
parser.add_argument('-b', '--branch', type=str,
|
|
37
|
+
help="Branch to process (by default, the current branch)")
|
|
38
|
+
parser.add_argument('-c', '--count', dest='count', type=int,
|
|
39
|
+
default=-1, help='Automatically create patches from top n commits')
|
|
40
|
+
parser.add_argument('-e', '--end', type=int, default=0,
|
|
41
|
+
help='Commits to skip at end of patch list')
|
|
42
|
+
parser.add_argument('-D', '--debug', action='store_true',
|
|
43
|
+
help='Enabling debugging (provides a full traceback on error)')
|
|
44
|
+
parser.add_argument('-p', '--project', default=project.detect_project(),
|
|
45
|
+
help="Project name; affects default option values and "
|
|
46
|
+
"aliases [default: %(default)s]")
|
|
47
|
+
parser.add_argument('-P', '--patchwork-url',
|
|
48
|
+
default='https://patchwork.ozlabs.org',
|
|
49
|
+
help='URL of patchwork server [default: %(default)s]')
|
|
50
|
+
parser.add_argument('-s', '--start', dest='start', type=int,
|
|
51
|
+
default=0, help='Commit to start creating patches from (0 = HEAD)')
|
|
52
|
+
parser.add_argument(
|
|
53
|
+
'-v', '--verbose', action='store_true', dest='verbose', default=False,
|
|
54
|
+
help='Verbose output of errors and warnings')
|
|
55
|
+
parser.add_argument(
|
|
56
|
+
'-H', '--full-help', action='store_true', dest='full_help',
|
|
57
|
+
default=False, help='Display the README file')
|
|
58
|
+
|
|
59
|
+
subparsers = parser.add_subparsers(dest='cmd')
|
|
60
|
+
send = subparsers.add_parser(
|
|
61
|
+
'send', help='Format, check and email patches (default command)')
|
|
62
|
+
send.add_argument('-i', '--ignore-errors', action='store_true',
|
|
63
|
+
dest='ignore_errors', default=False,
|
|
64
|
+
help='Send patches email even if patch errors are found')
|
|
65
|
+
send.add_argument('-l', '--limit-cc', dest='limit', type=int, default=None,
|
|
66
|
+
help='Limit the cc list to LIMIT entries [default: %(default)s]')
|
|
67
|
+
send.add_argument('-m', '--no-maintainers', action='store_false',
|
|
68
|
+
dest='add_maintainers', default=True,
|
|
69
|
+
help="Don't cc the file maintainers automatically")
|
|
70
|
+
send.add_argument(
|
|
71
|
+
'--get-maintainer-script', dest='get_maintainer_script', type=str,
|
|
72
|
+
action='store',
|
|
73
|
+
default=os.path.join(gitutil.get_top_level(), 'scripts',
|
|
74
|
+
'get_maintainer.pl') + ' --norolestats',
|
|
75
|
+
help='File name of the get_maintainer.pl (or compatible) script.')
|
|
76
|
+
send.add_argument('-n', '--dry-run', action='store_true', dest='dry_run',
|
|
77
|
+
default=False, help="Do a dry run (create but don't email patches)")
|
|
78
|
+
send.add_argument('-r', '--in-reply-to', type=str, action='store',
|
|
79
|
+
help="Message ID that this series is in reply to")
|
|
80
|
+
send.add_argument('-t', '--ignore-bad-tags', action='store_true',
|
|
81
|
+
default=False,
|
|
82
|
+
help='Ignore bad tags / aliases (default=warn)')
|
|
83
|
+
send.add_argument('-T', '--thread', action='store_true', dest='thread',
|
|
84
|
+
default=False, help='Create patches as a single thread')
|
|
85
|
+
send.add_argument('--cc-cmd', dest='cc_cmd', type=str, action='store',
|
|
86
|
+
default=None, help='Output cc list for patch file (used by git)')
|
|
87
|
+
send.add_argument('--no-binary', action='store_true', dest='ignore_binary',
|
|
88
|
+
default=False,
|
|
89
|
+
help="Do not output contents of changes in binary files")
|
|
90
|
+
send.add_argument('--no-check', action='store_false', dest='check_patch',
|
|
91
|
+
default=True,
|
|
92
|
+
help="Don't check for patch compliance")
|
|
93
|
+
send.add_argument(
|
|
94
|
+
'--tree', dest='check_patch_use_tree', default=False,
|
|
95
|
+
action='store_true',
|
|
96
|
+
help=("Set `tree` to True. If `tree` is False then we'll pass "
|
|
97
|
+
"'--no-tree' to checkpatch (default: tree=%(default)s)"))
|
|
98
|
+
send.add_argument('--no-tree', dest='check_patch_use_tree',
|
|
99
|
+
action='store_false', help="Set `tree` to False")
|
|
100
|
+
send.add_argument(
|
|
101
|
+
'--no-tags', action='store_false', dest='process_tags', default=True,
|
|
102
|
+
help="Don't process subject tags as aliases")
|
|
103
|
+
send.add_argument('--no-signoff', action='store_false', dest='add_signoff',
|
|
104
|
+
default=True, help="Don't add Signed-off-by to patches")
|
|
105
|
+
send.add_argument('--smtp-server', type=str,
|
|
106
|
+
help="Specify the SMTP server to 'git send-email'")
|
|
107
|
+
send.add_argument('--keep-change-id', action='store_true',
|
|
108
|
+
help='Preserve Change-Id tags in patches to send.')
|
|
109
|
+
|
|
110
|
+
send.add_argument('patchfiles', nargs='*')
|
|
111
|
+
|
|
112
|
+
# Only add the 'test' action if the test data files are available.
|
|
113
|
+
if HAS_TESTS:
|
|
114
|
+
test_parser = subparsers.add_parser('test', help='Run tests')
|
|
115
|
+
test_parser.add_argument('testname', type=str, default=None, nargs='?',
|
|
116
|
+
help="Specify the test to run")
|
|
117
|
+
|
|
118
|
+
status = subparsers.add_parser('status',
|
|
119
|
+
help='Check status of patches in patchwork')
|
|
120
|
+
status.add_argument('-C', '--show-comments', action='store_true',
|
|
121
|
+
help='Show comments from each patch')
|
|
122
|
+
status.add_argument(
|
|
123
|
+
'-d', '--dest-branch', type=str,
|
|
124
|
+
help='Name of branch to create with collected responses')
|
|
125
|
+
status.add_argument('-f', '--force', action='store_true',
|
|
126
|
+
help='Force overwriting an existing branch')
|
|
127
|
+
|
|
128
|
+
# Parse options twice: first to get the project and second to handle
|
|
129
|
+
# defaults properly (which depends on project)
|
|
130
|
+
# Use parse_known_args() in case 'cmd' is omitted
|
|
131
|
+
argv = sys.argv[1:]
|
|
132
|
+
args, rest = parser.parse_known_args(argv)
|
|
133
|
+
if hasattr(args, 'project'):
|
|
134
|
+
settings.Setup(parser, args.project)
|
|
135
|
+
args, rest = parser.parse_known_args(argv)
|
|
136
|
+
|
|
137
|
+
# If we have a command, it is safe to parse all arguments
|
|
138
|
+
if args.cmd:
|
|
139
|
+
args = parser.parse_args(argv)
|
|
140
|
+
else:
|
|
141
|
+
# No command, so insert it after the known arguments and before the ones
|
|
142
|
+
# that presumably relate to the 'send' subcommand
|
|
143
|
+
nargs = len(rest)
|
|
144
|
+
argv = argv[:-nargs] + ['send'] + rest
|
|
145
|
+
args = parser.parse_args(argv)
|
|
146
|
+
|
|
147
|
+
return args
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
u_boot_pylib>=0.0.5
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# SPDX-License-Identifier: GPL-2.0+
|
|
3
|
-
#
|
|
4
|
-
# Copyright (c) 2011 The Chromium OS Authors.
|
|
5
|
-
#
|
|
6
|
-
|
|
7
|
-
"""See README for more information"""
|
|
8
|
-
|
|
9
|
-
from argparse import ArgumentParser
|
|
10
|
-
try:
|
|
11
|
-
import importlib.resources
|
|
12
|
-
except ImportError:
|
|
13
|
-
# for Python 3.6
|
|
14
|
-
import importlib_resources
|
|
15
|
-
import os
|
|
16
|
-
import re
|
|
17
|
-
import sys
|
|
18
|
-
import traceback
|
|
19
|
-
|
|
20
|
-
if __name__ == "__main__":
|
|
21
|
-
# Allow 'from patman import xxx to work'
|
|
22
|
-
our_path = os.path.dirname(os.path.realpath(__file__))
|
|
23
|
-
sys.path.append(os.path.join(our_path, '..'))
|
|
24
|
-
|
|
25
|
-
# Our modules
|
|
26
|
-
from patman import control
|
|
27
|
-
from patman import func_test
|
|
28
|
-
from patman import gitutil
|
|
29
|
-
from patman import project
|
|
30
|
-
from patman import settings
|
|
31
|
-
from u_boot_pylib import terminal
|
|
32
|
-
from u_boot_pylib import test_util
|
|
33
|
-
from u_boot_pylib import tools
|
|
34
|
-
|
|
35
|
-
epilog = '''Create patches from commits in a branch, check them and email them
|
|
36
|
-
as specified by tags you place in the commits. Use -n to do a dry run first.'''
|
|
37
|
-
|
|
38
|
-
parser = ArgumentParser(epilog=epilog)
|
|
39
|
-
parser.add_argument('-b', '--branch', type=str,
|
|
40
|
-
help="Branch to process (by default, the current branch)")
|
|
41
|
-
parser.add_argument('-c', '--count', dest='count', type=int,
|
|
42
|
-
default=-1, help='Automatically create patches from top n commits')
|
|
43
|
-
parser.add_argument('-e', '--end', type=int, default=0,
|
|
44
|
-
help='Commits to skip at end of patch list')
|
|
45
|
-
parser.add_argument('-D', '--debug', action='store_true',
|
|
46
|
-
help='Enabling debugging (provides a full traceback on error)')
|
|
47
|
-
parser.add_argument('-p', '--project', default=project.detect_project(),
|
|
48
|
-
help="Project name; affects default option values and "
|
|
49
|
-
"aliases [default: %(default)s]")
|
|
50
|
-
parser.add_argument('-P', '--patchwork-url',
|
|
51
|
-
default='https://patchwork.ozlabs.org',
|
|
52
|
-
help='URL of patchwork server [default: %(default)s]')
|
|
53
|
-
parser.add_argument('-s', '--start', dest='start', type=int,
|
|
54
|
-
default=0, help='Commit to start creating patches from (0 = HEAD)')
|
|
55
|
-
parser.add_argument('-v', '--verbose', action='store_true', dest='verbose',
|
|
56
|
-
default=False, help='Verbose output of errors and warnings')
|
|
57
|
-
parser.add_argument('-H', '--full-help', action='store_true', dest='full_help',
|
|
58
|
-
default=False, help='Display the README file')
|
|
59
|
-
|
|
60
|
-
subparsers = parser.add_subparsers(dest='cmd')
|
|
61
|
-
send = subparsers.add_parser(
|
|
62
|
-
'send', help='Format, check and email patches (default command)')
|
|
63
|
-
send.add_argument('-i', '--ignore-errors', action='store_true',
|
|
64
|
-
dest='ignore_errors', default=False,
|
|
65
|
-
help='Send patches email even if patch errors are found')
|
|
66
|
-
send.add_argument('-l', '--limit-cc', dest='limit', type=int, default=None,
|
|
67
|
-
help='Limit the cc list to LIMIT entries [default: %(default)s]')
|
|
68
|
-
send.add_argument('-m', '--no-maintainers', action='store_false',
|
|
69
|
-
dest='add_maintainers', default=True,
|
|
70
|
-
help="Don't cc the file maintainers automatically")
|
|
71
|
-
send.add_argument(
|
|
72
|
-
'--get-maintainer-script', dest='get_maintainer_script', type=str,
|
|
73
|
-
action='store',
|
|
74
|
-
default=os.path.join(gitutil.get_top_level(), 'scripts',
|
|
75
|
-
'get_maintainer.pl') + ' --norolestats',
|
|
76
|
-
help='File name of the get_maintainer.pl (or compatible) script.')
|
|
77
|
-
send.add_argument('-n', '--dry-run', action='store_true', dest='dry_run',
|
|
78
|
-
default=False, help="Do a dry run (create but don't email patches)")
|
|
79
|
-
send.add_argument('-r', '--in-reply-to', type=str, action='store',
|
|
80
|
-
help="Message ID that this series is in reply to")
|
|
81
|
-
send.add_argument('-t', '--ignore-bad-tags', action='store_true',
|
|
82
|
-
default=False,
|
|
83
|
-
help='Ignore bad tags / aliases (default=warn)')
|
|
84
|
-
send.add_argument('-T', '--thread', action='store_true', dest='thread',
|
|
85
|
-
default=False, help='Create patches as a single thread')
|
|
86
|
-
send.add_argument('--cc-cmd', dest='cc_cmd', type=str, action='store',
|
|
87
|
-
default=None, help='Output cc list for patch file (used by git)')
|
|
88
|
-
send.add_argument('--no-binary', action='store_true', dest='ignore_binary',
|
|
89
|
-
default=False,
|
|
90
|
-
help="Do not output contents of changes in binary files")
|
|
91
|
-
send.add_argument('--no-check', action='store_false', dest='check_patch',
|
|
92
|
-
default=True,
|
|
93
|
-
help="Don't check for patch compliance")
|
|
94
|
-
send.add_argument('--tree', dest='check_patch_use_tree', default=False,
|
|
95
|
-
action='store_true',
|
|
96
|
-
help=("Set `tree` to True. If `tree` is False then we'll "
|
|
97
|
-
"pass '--no-tree' to checkpatch (default: tree=%(default)s)"))
|
|
98
|
-
send.add_argument('--no-tree', dest='check_patch_use_tree',
|
|
99
|
-
action='store_false', help="Set `tree` to False")
|
|
100
|
-
send.add_argument('--no-tags', action='store_false', dest='process_tags',
|
|
101
|
-
default=True, help="Don't process subject tags as aliases")
|
|
102
|
-
send.add_argument('--no-signoff', action='store_false', dest='add_signoff',
|
|
103
|
-
default=True, help="Don't add Signed-off-by to patches")
|
|
104
|
-
send.add_argument('--smtp-server', type=str,
|
|
105
|
-
help="Specify the SMTP server to 'git send-email'")
|
|
106
|
-
send.add_argument('--keep-change-id', action='store_true',
|
|
107
|
-
help='Preserve Change-Id tags in patches to send.')
|
|
108
|
-
|
|
109
|
-
send.add_argument('patchfiles', nargs='*')
|
|
110
|
-
|
|
111
|
-
# Only add the 'test' action if the test data files are available.
|
|
112
|
-
if os.path.exists(func_test.TEST_DATA_DIR):
|
|
113
|
-
test_parser = subparsers.add_parser('test', help='Run tests')
|
|
114
|
-
test_parser.add_argument('testname', type=str, default=None, nargs='?',
|
|
115
|
-
help="Specify the test to run")
|
|
116
|
-
|
|
117
|
-
status = subparsers.add_parser('status',
|
|
118
|
-
help='Check status of patches in patchwork')
|
|
119
|
-
status.add_argument('-C', '--show-comments', action='store_true',
|
|
120
|
-
help='Show comments from each patch')
|
|
121
|
-
status.add_argument('-d', '--dest-branch', type=str,
|
|
122
|
-
help='Name of branch to create with collected responses')
|
|
123
|
-
status.add_argument('-f', '--force', action='store_true',
|
|
124
|
-
help='Force overwriting an existing branch')
|
|
125
|
-
|
|
126
|
-
# Parse options twice: first to get the project and second to handle
|
|
127
|
-
# defaults properly (which depends on project)
|
|
128
|
-
# Use parse_known_args() in case 'cmd' is omitted
|
|
129
|
-
argv = sys.argv[1:]
|
|
130
|
-
args, rest = parser.parse_known_args(argv)
|
|
131
|
-
if hasattr(args, 'project'):
|
|
132
|
-
settings.Setup(parser, args.project)
|
|
133
|
-
args, rest = parser.parse_known_args(argv)
|
|
134
|
-
|
|
135
|
-
# If we have a command, it is safe to parse all arguments
|
|
136
|
-
if args.cmd:
|
|
137
|
-
args = parser.parse_args(argv)
|
|
138
|
-
else:
|
|
139
|
-
# No command, so insert it after the known arguments and before the ones
|
|
140
|
-
# that presumably relate to the 'send' subcommand
|
|
141
|
-
nargs = len(rest)
|
|
142
|
-
argv = argv[:-nargs] + ['send'] + rest
|
|
143
|
-
args = parser.parse_args(argv)
|
|
144
|
-
|
|
145
|
-
if __name__ != "__main__":
|
|
146
|
-
pass
|
|
147
|
-
|
|
148
|
-
if not args.debug:
|
|
149
|
-
sys.tracebacklimit = 0
|
|
150
|
-
|
|
151
|
-
# Run our meagre tests
|
|
152
|
-
if args.cmd == 'test':
|
|
153
|
-
from patman import func_test
|
|
154
|
-
from patman import test_checkpatch
|
|
155
|
-
|
|
156
|
-
result = test_util.run_test_suites(
|
|
157
|
-
'patman', False, False, False, None, None, None,
|
|
158
|
-
[test_checkpatch.TestPatch, func_test.TestFunctional,
|
|
159
|
-
'gitutil', 'settings'])
|
|
160
|
-
|
|
161
|
-
sys.exit(0 if result.wasSuccessful() else 1)
|
|
162
|
-
|
|
163
|
-
# Process commits, produce patches files, check them, email them
|
|
164
|
-
elif args.cmd == 'send':
|
|
165
|
-
# Called from git with a patch filename as argument
|
|
166
|
-
# Printout a list of additional CC recipients for this patch
|
|
167
|
-
if args.cc_cmd:
|
|
168
|
-
fd = open(args.cc_cmd, 'r')
|
|
169
|
-
re_line = re.compile('(\S*) (.*)')
|
|
170
|
-
for line in fd.readlines():
|
|
171
|
-
match = re_line.match(line)
|
|
172
|
-
if match and match.group(1) == args.patchfiles[0]:
|
|
173
|
-
for cc in match.group(2).split('\0'):
|
|
174
|
-
cc = cc.strip()
|
|
175
|
-
if cc:
|
|
176
|
-
print(cc)
|
|
177
|
-
fd.close()
|
|
178
|
-
|
|
179
|
-
elif args.full_help:
|
|
180
|
-
with importlib.resources.path('patman', 'README.rst') as readme:
|
|
181
|
-
tools.print_full_help(str(readme))
|
|
182
|
-
else:
|
|
183
|
-
# If we are not processing tags, no need to warning about bad ones
|
|
184
|
-
if not args.process_tags:
|
|
185
|
-
args.ignore_bad_tags = True
|
|
186
|
-
control.send(args)
|
|
187
|
-
|
|
188
|
-
# Check status of patches in patchwork
|
|
189
|
-
elif args.cmd == 'status':
|
|
190
|
-
ret_code = 0
|
|
191
|
-
try:
|
|
192
|
-
control.patchwork_status(args.branch, args.count, args.start, args.end,
|
|
193
|
-
args.dest_branch, args.force,
|
|
194
|
-
args.show_comments, args.patchwork_url)
|
|
195
|
-
except Exception as e:
|
|
196
|
-
terminal.tprint('patman: %s: %s' % (type(e).__name__, e),
|
|
197
|
-
colour=terminal.Color.RED)
|
|
198
|
-
if args.debug:
|
|
199
|
-
print()
|
|
200
|
-
traceback.print_exc()
|
|
201
|
-
ret_code = 1
|
|
202
|
-
sys.exit(ret_code)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|