patman: Allow skipping patches at the end
The -s option allows skipping patches at the top of the branch. Sometimes
there are commits at the bottom that need to be skipped. At present it is
necessary to count the number of commits and then use -c to tell patman
how many to process.
Add a -e option to easily skip a number of commits at the bottom of the
branch.
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py
index 588be73e..810af9c 100644
--- a/tools/patman/func_test.py
+++ b/tools/patman/func_test.py
@@ -430,7 +430,8 @@
col = terminal.Color()
with capture_sys_output() as _:
_, cover_fname, patch_files = control.prepare_patches(
- col, branch=None, count=-1, start=0, ignore_binary=False)
+ col, branch=None, count=-1, start=0, end=0,
+ ignore_binary=False)
self.assertIsNone(cover_fname)
self.assertEqual(2, len(patch_files))
@@ -438,9 +439,17 @@
self.assertEqual(3, gitutil.CountCommitsToBranch('second'))
with capture_sys_output() as _:
_, cover_fname, patch_files = control.prepare_patches(
- col, branch='second', count=-1, start=0,
+ col, branch='second', count=-1, start=0, end=0,
ignore_binary=False)
self.assertIsNotNone(cover_fname)
self.assertEqual(3, len(patch_files))
+
+ # Check that it can skip patches at the end
+ with capture_sys_output() as _:
+ _, cover_fname, patch_files = control.prepare_patches(
+ col, branch='second', count=-1, start=0, end=1,
+ ignore_binary=False)
+ self.assertIsNotNone(cover_fname)
+ self.assertEqual(2, len(patch_files))
finally:
os.chdir(orig_dir)