aboutsummaryrefslogtreecommitdiff
path: root/tools/patman
diff options
context:
space:
mode:
Diffstat (limited to 'tools/patman')
-rwxr-xr-xtools/patman/main.py12
-rw-r--r--tools/patman/test/test01.txt20
-rw-r--r--tools/patman/tools.py15
3 files changed, 29 insertions, 18 deletions
diff --git a/tools/patman/main.py b/tools/patman/main.py
index 04e37a5..e5be28e 100755
--- a/tools/patman/main.py
+++ b/tools/patman/main.py
@@ -28,6 +28,7 @@ from patman import settings
from patman import terminal
from patman import test_util
from patman import test_checkpatch
+from patman import tools
epilog = '''Create patches from commits in a branch, check them and email them
as specified by tags you place in the commits. Use -n to do a dry run first.'''
@@ -170,14 +171,9 @@ elif args.cmd == 'send':
fd.close()
elif args.full_help:
- pager = os.getenv('PAGER')
- if not pager:
- pager = shutil.which('less')
- if not pager:
- pager = 'more'
- fname = os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])),
- 'README')
- command.Run(pager, fname)
+ tools.PrintFullHelp(
+ os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), 'README')
+ )
else:
# If we are not processing tags, no need to warning about bad ones
diff --git a/tools/patman/test/test01.txt b/tools/patman/test/test01.txt
index b238a8b..de2d9e4 100644
--- a/tools/patman/test/test01.txt
+++ b/tools/patman/test/test01.txt
@@ -3,15 +3,15 @@ Author: Simon Glass <sjg@chromium.org>
Date: Sat Apr 15 15:39:08 2017 -0600
pci: Correct cast for sandbox
-
+
This gives a warning with some native compilers:
-
+
cmd/pci.c:152:11: warning: format ‘%llx’ expects argument of type
‘long long unsigned int’, but argument 3 has type
‘u64 {aka long unsigned int}’ [-Wformat=]
-
+
Fix it with a cast.
-
+
Signed-off-by: Simon Glass <sjg@chromium.org>
Commit-changes: 2
- second revision change
@@ -21,7 +21,7 @@ Date: Sat Apr 15 15:39:08 2017 -0600
about some things
from the first commit
END
-
+
Commit-notes:
Some notes about
the first commit
@@ -32,15 +32,15 @@ Author: Simon Glass <sjg@chromium.org>
Date: Sat Apr 15 15:39:08 2017 -0600
fdt: Correct cast for sandbox in fdtdec_setup_mem_size_base()
-
+
This gives a warning with some native compilers:
-
+
lib/fdtdec.c:1203:8: warning: format ‘%llx’ expects argument of type
‘long long unsigned int’, but argument 3 has type
‘long unsigned int’ [-Wformat=]
-
+
Fix it with a cast.
-
+
Signed-off-by: Simon Glass <sjg@chromium.org>
Series-to: u-boot
Series-prefix: RFC
@@ -60,7 +60,7 @@ Date: Sat Apr 15 15:39:08 2017 -0600
Cover-changes: 4
- Some notes for the cover letter
-
+
Cover-letter:
test: A test patch series
This is a test of how the cover
diff --git a/tools/patman/tools.py b/tools/patman/tools.py
index 877e37c..710f1fd 100644
--- a/tools/patman/tools.py
+++ b/tools/patman/tools.py
@@ -5,6 +5,7 @@
import glob
import os
+import shlex
import shutil
import struct
import sys
@@ -581,3 +582,17 @@ def ToHexSize(val):
hex value of size, or 'None' if the value is None
"""
return 'None' if val is None else '%#x' % len(val)
+
+def PrintFullHelp(fname):
+ """Print the full help message for a tool using an appropriate pager.
+
+ Args:
+ fname: Path to a file containing the full help message
+ """
+ pager = shlex.split(os.getenv('PAGER', ''))
+ if not pager:
+ lesspath = shutil.which('less')
+ pager = [lesspath] if lesspath else None
+ if not pager:
+ pager = ['more']
+ command.Run(*pager, fname)