patman: Add --no-signoff to suppress adding signoffs
To enable use of patman with FSF/GNU projects, such as GCC or Binutils, no Signed-off-by may be added. This adds a command line flag '--no-signoff' to suppress adding signoffs in patman when processing commits. Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu> Reviewed-by: Simon Glass <sjg@chromium.org> Fix patman testBranch() test: Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
5e66338bab
commit
b3aff15ee4
|
@ -20,7 +20,7 @@ def setup():
|
||||||
"""Do required setup before doing anything"""
|
"""Do required setup before doing anything"""
|
||||||
gitutil.Setup()
|
gitutil.Setup()
|
||||||
|
|
||||||
def prepare_patches(col, branch, count, start, end, ignore_binary):
|
def prepare_patches(col, branch, count, start, end, ignore_binary, signoff):
|
||||||
"""Figure out what patches to generate, then generate them
|
"""Figure out what patches to generate, then generate them
|
||||||
|
|
||||||
The patch files are written to the current directory, e.g. 0001_xxx.patch
|
The patch files are written to the current directory, e.g. 0001_xxx.patch
|
||||||
|
@ -56,7 +56,7 @@ def prepare_patches(col, branch, count, start, end, ignore_binary):
|
||||||
to_do = count - end
|
to_do = count - end
|
||||||
series = patchstream.get_metadata(branch, start, to_do)
|
series = patchstream.get_metadata(branch, start, to_do)
|
||||||
cover_fname, patch_files = gitutil.CreatePatches(
|
cover_fname, patch_files = gitutil.CreatePatches(
|
||||||
branch, start, to_do, ignore_binary, series)
|
branch, start, to_do, ignore_binary, series, signoff)
|
||||||
|
|
||||||
# Fix up the patch files to our liking, and insert the cover letter
|
# Fix up the patch files to our liking, and insert the cover letter
|
||||||
patchstream.fix_patches(series, patch_files)
|
patchstream.fix_patches(series, patch_files)
|
||||||
|
@ -163,7 +163,7 @@ def send(args):
|
||||||
col = terminal.Color()
|
col = terminal.Color()
|
||||||
series, cover_fname, patch_files = prepare_patches(
|
series, cover_fname, patch_files = prepare_patches(
|
||||||
col, args.branch, args.count, args.start, args.end,
|
col, args.branch, args.count, args.start, args.end,
|
||||||
args.ignore_binary)
|
args.ignore_binary, args.add_signoff)
|
||||||
ok = check_patches(series, patch_files, args.check_patch,
|
ok = check_patches(series, patch_files, args.check_patch,
|
||||||
args.verbose)
|
args.verbose)
|
||||||
|
|
||||||
|
|
|
@ -475,7 +475,7 @@ complicated as possible''')
|
||||||
with capture_sys_output() as _:
|
with capture_sys_output() as _:
|
||||||
_, cover_fname, patch_files = control.prepare_patches(
|
_, cover_fname, patch_files = control.prepare_patches(
|
||||||
col, branch=None, count=-1, start=0, end=0,
|
col, branch=None, count=-1, start=0, end=0,
|
||||||
ignore_binary=False)
|
ignore_binary=False, signoff=True)
|
||||||
self.assertIsNone(cover_fname)
|
self.assertIsNone(cover_fname)
|
||||||
self.assertEqual(2, len(patch_files))
|
self.assertEqual(2, len(patch_files))
|
||||||
|
|
||||||
|
@ -484,7 +484,7 @@ complicated as possible''')
|
||||||
with capture_sys_output() as _:
|
with capture_sys_output() as _:
|
||||||
_, cover_fname, patch_files = control.prepare_patches(
|
_, cover_fname, patch_files = control.prepare_patches(
|
||||||
col, branch='second', count=-1, start=0, end=0,
|
col, branch='second', count=-1, start=0, end=0,
|
||||||
ignore_binary=False)
|
ignore_binary=False, signoff=True)
|
||||||
self.assertIsNotNone(cover_fname)
|
self.assertIsNotNone(cover_fname)
|
||||||
self.assertEqual(3, len(patch_files))
|
self.assertEqual(3, len(patch_files))
|
||||||
|
|
||||||
|
@ -492,7 +492,7 @@ complicated as possible''')
|
||||||
with capture_sys_output() as _:
|
with capture_sys_output() as _:
|
||||||
_, cover_fname, patch_files = control.prepare_patches(
|
_, cover_fname, patch_files = control.prepare_patches(
|
||||||
col, branch='second', count=-1, start=0, end=1,
|
col, branch='second', count=-1, start=0, end=1,
|
||||||
ignore_binary=False)
|
ignore_binary=False, signoff=True)
|
||||||
self.assertIsNotNone(cover_fname)
|
self.assertIsNotNone(cover_fname)
|
||||||
self.assertEqual(2, len(patch_files))
|
self.assertEqual(2, len(patch_files))
|
||||||
finally:
|
finally:
|
||||||
|
|
|
@ -305,7 +305,7 @@ def PruneWorktrees(git_dir):
|
||||||
if result.return_code != 0:
|
if result.return_code != 0:
|
||||||
raise OSError('git worktree prune: %s' % result.stderr)
|
raise OSError('git worktree prune: %s' % result.stderr)
|
||||||
|
|
||||||
def CreatePatches(branch, start, count, ignore_binary, series):
|
def CreatePatches(branch, start, count, ignore_binary, series, signoff = True):
|
||||||
"""Create a series of patches from the top of the current branch.
|
"""Create a series of patches from the top of the current branch.
|
||||||
|
|
||||||
The patch files are written to the current directory using
|
The patch files are written to the current directory using
|
||||||
|
@ -323,7 +323,9 @@ def CreatePatches(branch, start, count, ignore_binary, series):
|
||||||
"""
|
"""
|
||||||
if series.get('version'):
|
if series.get('version'):
|
||||||
version = '%s ' % series['version']
|
version = '%s ' % series['version']
|
||||||
cmd = ['git', 'format-patch', '-M', '--signoff']
|
cmd = ['git', 'format-patch', '-M' ]
|
||||||
|
if signoff:
|
||||||
|
cmd.append('--signoff')
|
||||||
if ignore_binary:
|
if ignore_binary:
|
||||||
cmd.append('--no-binary')
|
cmd.append('--no-binary')
|
||||||
if series.get('cover'):
|
if series.get('cover'):
|
||||||
|
|
|
@ -81,6 +81,8 @@ send.add_argument('--no-check', action='store_false', dest='check_patch',
|
||||||
help="Don't check for patch compliance")
|
help="Don't check for patch compliance")
|
||||||
send.add_argument('--no-tags', action='store_false', dest='process_tags',
|
send.add_argument('--no-tags', action='store_false', dest='process_tags',
|
||||||
default=True, help="Don't process subject tags as aliases")
|
default=True, help="Don't process subject tags as aliases")
|
||||||
|
send.add_argument('--no-signoff', action='store_false', dest='add_signoff',
|
||||||
|
default=True, help="Don't add Signed-off-by to patches")
|
||||||
send.add_argument('--smtp-server', type=str,
|
send.add_argument('--smtp-server', type=str,
|
||||||
help="Specify the SMTP server to 'git send-email'")
|
help="Specify the SMTP server to 'git send-email'")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue