Skip to contentSkip to conversation

patman: Add a call to get_maintainer.pl if it exists

PATCH Superseded Doug Anderson 2 participants 18 messages Dec 1, 2012 – Jan 31, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 patman: Add a call to get_maintainer.pl if it exists

For Linux the best way to figure out where to send a patch is with the "get_maintainer.pl" script. Add support for calling it from patman. Support is added unconditionally for "scripts/get_maintainer.pl" in case it is helpful for any other projects.

---
 tools/patman/README            |   11 ++++++-
 tools/patman/get_maintainer.py |   63 ++++++++++++++++++++++++++++++++++++++++
 tools/patman/series.py         |    2 +
 3 files changed, 74 insertions(+), 2 deletions(-)
 create mode 100644 tools/patman/get_maintainer.py
tools/patman/README +9 -2
index dc3957c..903d02f 100644
@@ -43,6 +43,9 @@ Series-to: fred.blogs at napier.co.nz
 
 in one of your commits, the series will be sent there.
 
+In Linux this will also call get_maintainer.pl on each of your
+patches automatically.
+
 
 How to use this tool
 ====================
@@ -65,8 +68,12 @@ will get a consistent result each time.
 How to configure it
 ===================
 
-For most cases patman will locate and use the file 'doc/git-mailrc' in
-your U-Boot directory. This contains most of the aliases you will need.
+For most cases of using patman for U-Boot developement patman will
+locate and use the file 'doc/git-mailrc' in your U-Boot directory.
+This contains most of the aliases you will need.
+
+For Linux the 'scripts/get_maintainer.pl' handles figuring out where
+to send patches pretty well.
 
 During the first run patman creates a config file for you by taking the default
 user name and email address from the global .gitconfig file.
tools/patman/get_maintainer.py new file +63 -0

63 lines not on this page · raw message

tools/patman/series.py +2 -0
index 083af0f..6c5c570 100644
@@ -22,6 +22,7 @@
 import itertools
 import os
 
+import get_maintainer
 import gitutil
 import terminal
 
@@ -225,6 +226,7 @@ class Series(dict):
             if process_tags:
                 list += gitutil.BuildEmailList(commit.tags)
             list += gitutil.BuildEmailList(commit.cc_list)
+            list += get_maintainer.GetMaintainer(commit.patch)
             all_ccs += list
             print >>fd, commit.patch, ', '.join(list)
             self._generated_cc[commit.patch] = list
Signature · 1 line
1.7.7.3
#1 lore raw

PATCH 2/4 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.

---
 tools/patman/README      |   16 ++++++++++++++++
 tools/patman/gitutil.py  |    2 --
 tools/patman/patman.py   |    3 +++
 tools/patman/settings.py |   39 +++++++++++++++++++++++++++++++++++----
 4 files changed, 54 insertions(+), 6 deletions(-)
tools/patman/README +16 -0
index 903d02f..6ca5b5b 100644
@@ -98,6 +98,22 @@ The checkpatch.pl in the U-Boot tools/ subdirectory will be located and
 used. Failing that you can put it into your path or ~/bin/checkpatch.pl
 
 
+If you want to change the defaults for patman's command-line arguments,
+you can add a [settings] section to your .patman file.  This can be used
+for any command line option by referring to the "dest" for the option in
+patman.py.  For reference, the useful ones (at the moment) shown below
+(all with the non-default setting):
+
+>>>
+
+[settings]
+ignore_errors: True
+process_tags: False
+verbose: True
+
+<<<
+
+
 How to run it
 =============
 
tools/patman/gitutil.py +0 -2
index 72d37a0..e7753cf 100644
@@ -377,8 +377,6 @@ def GetDefaultUserEmail():
 
 def Setup():
     """Set up git utils, by reading the alias files."""
-    settings.Setup('')
-
     # Check for a git alias file also
     alias_fname = GetAliasFile()
     if alias_fname:
tools/patman/patman.py +3 -0
index 4181d80..b327c67 100755
@@ -34,6 +34,7 @@ import checkpatch
 import command
 import gitutil
 import patchstream
+import settings
 import terminal
 import test
 
@@ -64,6 +65,8 @@ parser.usage = """patman [options]
 Create patches from commits in a branch, check them and email them as
 specified by tags you place in the commits. Use -n to """
 
+
+settings.Setup(parser, '')
 (options, args) = parser.parse_args()
 
 # Run our meagre tests
tools/patman/settings.py +35 -4
index 4dda17b..5208f7d 100644
@@ -88,13 +88,43 @@ def CreatePatmanConfigFile(config_fname):
     print >>f, "[alias]\nme: %s <%s>" % (name, email)
     f.close();
 
-def Setup(config_fname=''):
+def _UpdateDefaults(parser, config):
+    """Update the given OptionParser defaults based on config.
+
+    We'll walk through all of the settings from the parser
+    For each setting we'll look for a default in the option parser.
+    If it's found we'll update the option parser default.
+
+    The idea here is that the .patman file should be able to update
+    defaults but that command line flags should still have the final
+    say.
+
+    Args:
+        parser: An instance of an OptionParser whose defaults will be
+            updated.
+        config: An instance of SafeConfigParser that we will query
+            for settings.
+    """
+    defaults = parser.get_default_values()
+    for name, val in config.items('settings'):
+        if hasattr(defaults, name):
+            default_val = getattr(defaults, name)
+            if isinstance(default_val, bool):
+                val = config.getboolean('settings', name)
+            elif isinstance(default_val, int):
+                val = config.getint('settings', name)
+            parser.set_default(name, val)
+        else:
+            print "WARNING: Unknown setting %s" % name
+
+def Setup(parser, config_fname=''):
     """Set up the settings module by reading config files.
 
     Args:
+        parser:         The parser to update
         config_fname:   Config filename to read ('' for default)
     """
-    settings = ConfigParser.SafeConfigParser()
+    config = ConfigParser.SafeConfigParser()
     if config_fname == '':
         config_fname = '%s/.patman' % os.getenv('HOME')
 
@@ -102,11 +132,12 @@ def Setup(config_fname=''):
         print "No config file found ~/.patman\nCreating one...\n"
         CreatePatmanConfigFile(config_fname)
 
-    settings.read(config_fname)
+    config.read(config_fname)
 
-    for name, value in settings.items('alias'):
+    for name, value in config.items('alias'):
         alias[name] = value.split(',')
 
+    _UpdateDefaults(parser, config)
 
 # These are the aliases we understand, indexed by alias. Each member is a list.
 alias = {}
Signature · 1 line
1.7.7.3
#2 lore raw

PATCH 2/4 patman: Add support for settings in .patman

Quoted 15 lines · Doug Anderson

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

Quoted 5 lines

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

---

Quoted 6 lines
 tools/patman/README      |   16 ++++++++++++++++
 tools/patman/gitutil.py  |    2 --
 tools/patman/patman.py   |    3 +++
 tools/patman/settings.py |   39 +++++++++++++++++++++++++++++++++++----
 4 files changed, 54 insertions(+), 6 deletions(-)
#3 lore raw

PATCH 3/4 patman: Add the concept of multiple projects

In reply to Doug Anderson

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.

---
 tools/patman/README      |   13 ++++
 tools/patman/patman.py   |    9 +++-
 tools/patman/project.py  |   43 +++++++++++++
 tools/patman/settings.py |  147 +++++++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 208 insertions(+), 4 deletions(-)
 create mode 100644 tools/patman/project.py
tools/patman/README +13 -0
index 6ca5b5b..d294f3d 100644
@@ -114,6 +114,19 @@ verbose: True
 <<<
 
 
+If you want to adjust settings (or aliases) that affect just a single
+project you can add a section that looks like [project_settings] or
+[project_alias].  If you want to use tags for your linux work, you could
+do:
+
+>>>
+
+[linux_settings]
+process_tags: True
+
+<<<
+
+
 How to run it
 =============
 
tools/patman/patman.py +8 -1
index b327c67..54a252e 100755
@@ -34,6 +34,7 @@ import checkpatch
 import command
 import gitutil
 import patchstream
+import project
 import settings
 import terminal
 import test
@@ -59,6 +60,9 @@ parser.add_option('--cc-cmd', dest='cc_cmd', type='string', action='store',
        default=None, help='Output cc list for patch file (used by git)')
 parser.add_option('--no-tags', action='store_false', dest='process_tags',
                   default=True, help="Don't process subject tags as aliaes")
+parser.add_option('--project', default=project.DetectProject(),
+                  help="Project name; affects default option values and "
+                  "aliases [default: %default]")
 
 parser.usage = """patman [options]
 
@@ -66,7 +70,10 @@ Create patches from commits in a branch, check them and email them as
 specified by tags you place in the commits. Use -n to """
 
 
-settings.Setup(parser, '')
+# Parse options twice: first to get the project and second to handle
+# defaults properly (which depends on project).
+(options, args) = parser.parse_args()
+settings.Setup(parser, options.project, '')
 (options, args) = parser.parse_args()
 
 # Run our meagre tests
tools/patman/project.py new file +43 -0

43 lines not on this page · raw message

tools/patman/settings.py +144 -3

174 lines not on this page · raw message

Signature · 1 line
1.7.7.3
#4 lore raw

PATCH 3/4 patman: Add the concept of multiple projects

Hi Doug,

Quoted 55 lines · Doug Anderson

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.

---
 tools/patman/README      |   13 ++++
 tools/patman/patman.py   |    9 +++-
 tools/patman/project.py  |   43 +++++++++++++
 tools/patman/settings.py |  147 +++++++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 208 insertions(+), 4 deletions(-)
 create mode 100644 tools/patman/project.py
tools/patman/README +13 -0
index 6ca5b5b..d294f3d 100644
@@ -114,6 +114,19 @@ verbose: True
 <<<
 
 
+If you want to adjust settings (or aliases) that affect just a single
+project you can add a section that looks like [project_settings] or
+[project_alias].  If you want to use tags for your linux work, you could
+do:
+
+>>>
+
+[linux_settings]
+process_tags: True
+
+<<<
+
+
 How to run it
 =============
 
tools/patman/patman.py +1 -0
index b327c67..54a252e 100755
@@ -34,6 +34,7 @@ import checkpatch
 import command
 import gitutil
 import patchstream
+import project
 import settings
 import terminal
 import test

tools/patman/patman.py parser.add_option('--cc-cmd', dest='cc_cmd', type='string', action='store', · line 65

Quoted 6 lines
tools/patman/patman.py +3 -0
@@ -59,6 +60,9 @@ parser.add_option('--cc-cmd', dest='cc_cmd', type='string', action='store',
        default=None, help='Output cc list for patch file (used by git)')
 parser.add_option('--no-tags', action='store_false', dest='process_tags',
                   default=True, help="Don't process subject tags as aliaes")
+parser.add_option('--project', default=project.DetectProject(),
+                  help="Project name; affects default option values and "
+                  "aliases [default: %default]")

Can you please add a short option also - perhaps -p?

[snip]

Regards,
Simon

#5 lore raw

PATCH 3/4 patman: Add the concept of multiple projects

Simon,

Thanks!

Quoted 58 lines · Simon Glass

Hi Doug,

Quoted 55 lines · Doug Anderson

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.

---
 tools/patman/README      |   13 ++++
 tools/patman/patman.py   |    9 +++-
 tools/patman/project.py  |   43 +++++++++++++
 tools/patman/settings.py |  147 +++++++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 208 insertions(+), 4 deletions(-)
 create mode 100644 tools/patman/project.py
tools/patman/README +13 -0
index 6ca5b5b..d294f3d 100644
@@ -114,6 +114,19 @@ verbose: True
 <<<
 
 
+If you want to adjust settings (or aliases) that affect just a single
+project you can add a section that looks like [project_settings] or
+[project_alias].  If you want to use tags for your linux work, you could
+do:
+
+>>>
+
+[linux_settings]
+process_tags: True
+
+<<<
+
+
 How to run it
 =============
 
tools/patman/patman.py +1 -0
index b327c67..54a252e 100755
@@ -34,6 +34,7 @@ import checkpatch
 import command
 import gitutil
 import patchstream
+import project
 import settings
 import terminal
 import test
@@ -59,6 +60,9 @@ parser.add_option('--cc-cmd', dest='cc_cmd', type='string', action='store',
Quoted 8 lines

tools/patman/patman.py parser.add_option('--cc-cmd', dest='cc_cmd', type='string', action='store', · line 65

Quoted 6 lines
tools/patman/patman.py +3 -0
        default=None, help='Output cc list for patch file (used by git)')
 parser.add_option('--no-tags', action='store_false', dest='process_tags',
                   default=True, help="Don't process subject tags as aliaes")
+parser.add_option('--project', default=project.DetectProject(),
+                  help="Project name; affects default option values and "
+                  "aliases [default: %default]")

Can you please add a short option also - perhaps -p?

Done.

Quoted 4 lines

[snip]

Regards,
Simon

#6 lore raw

PATCH 4/4 patman: Add settings to the list of modules to doctest

In reply to Doug Anderson

The settings modules now has doctests, so run them.

---
 tools/patman/patman.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
tools/patman/patman.py +3 -2
index 54a252e..6825de4 100755
@@ -85,8 +85,9 @@ if options.test:
     result = unittest.TestResult()
     suite.run(result)
 
-    suite = doctest.DocTestSuite('gitutil')
-    suite.run(result)
+    for module in ['gitutil', 'settings']:
+        suite = doctest.DocTestSuite(module)
+        suite.run(result)
 
     # TODO: Surely we can just 'print' result?
     print result
Signature · 1 line
1.7.7.3
#7 lore raw

PATCH 4/4 patman: Add settings to the list of modules to doctest

Quoted 3 lines · Doug Anderson

The settings modules now has doctests, so run them.

Quoted 23 lines
---
 tools/patman/patman.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
tools/patman/patman.py +3 -3
index 54a252e..6825de4 100755
@@ -85,8 +85,9 @@ if options.test:
     result = unittest.TestResult()
     suite.run(result)
 
-    suite = doctest.DocTestSuite('gitutil')
-    suite.run(result)
+    for module in ['gitutil', 'settings']:
+        suite = doctest.DocTestSuite(module)
+        suite.run(result)
 
     # TODO: Surely we can just 'print' result?
     print result
--

1.7.7.3

#8 lore raw

PATCH 1/4 patman: Add a call to get_maintainer.pl if it exists

In reply to Doug Anderson
Quoted 6 lines · Doug Anderson

For Linux the best way to figure out where to send a patch is with the "get_maintainer.pl" script. Add support for calling it from patman. Support is added unconditionally for "scripts/get_maintainer.pl" in case it is helpful for any other projects.

#9 lore raw

PATCH v2 1/4 patman: Add a call to get_maintainer.pl if it exists

In reply to Doug Anderson

For Linux the best way to figure out where to send a patch is with the "get_maintainer.pl" script. Add support for calling it from patman. Support is added unconditionally for "scripts/get_maintainer.pl" in case it is helpful for any other projects.

---
Changes in v2: None

 tools/patman/README            |   11 ++++++-
 tools/patman/get_maintainer.py |   63 ++++++++++++++++++++++++++++++++++++++++
 tools/patman/series.py         |    2 +
 3 files changed, 74 insertions(+), 2 deletions(-)
 create mode 100644 tools/patman/get_maintainer.py
tools/patman/README +9 -2
index 5b6eba0..16b51eb 100644
@@ -43,6 +43,9 @@ Series-to: fred.blogs at napier.co.nz
 
 in one of your commits, the series will be sent there.
 
+In Linux this will also call get_maintainer.pl on each of your
+patches automatically.
+
 
 How to use this tool
 ====================
@@ -65,8 +68,12 @@ will get a consistent result each time.
 How to configure it
 ===================
 
-For most cases patman will locate and use the file 'doc/git-mailrc' in
-your U-Boot directory. This contains most of the aliases you will need.
+For most cases of using patman for U-Boot developement patman will
+locate and use the file 'doc/git-mailrc' in your U-Boot directory.
+This contains most of the aliases you will need.
+
+For Linux the 'scripts/get_maintainer.pl' handles figuring out where
+to send patches pretty well.
 
 During the first run patman creates a config file for you by taking the default
 user name and email address from the global .gitconfig file.
tools/patman/get_maintainer.py new file +63 -0

63 lines not on this page · raw message

tools/patman/series.py +2 -0
index 083af0f..6c5c570 100644
@@ -22,6 +22,7 @@
 import itertools
 import os
 
+import get_maintainer
 import gitutil
 import terminal
 
@@ -225,6 +226,7 @@ class Series(dict):
             if process_tags:
                 list += gitutil.BuildEmailList(commit.tags)
             list += gitutil.BuildEmailList(commit.cc_list)
+            list += get_maintainer.GetMaintainer(commit.patch)
             all_ccs += list
             print >>fd, commit.patch, ', '.join(list)
             self._generated_cc[commit.patch] = list
Signature · 1 line
1.7.7.3
#10 lore raw

PATCH v2 2/4 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.

---
Changes in v2: None

 tools/patman/README      |   16 ++++++++++++++++
 tools/patman/gitutil.py  |    2 --
 tools/patman/patman.py   |    3 +++
 tools/patman/settings.py |   39 +++++++++++++++++++++++++++++++++++----
 4 files changed, 54 insertions(+), 6 deletions(-)
tools/patman/README +16 -0
index 16b51eb..2743da9 100644
@@ -98,6 +98,22 @@ The checkpatch.pl in the U-Boot tools/ subdirectory will be located and
 used. Failing that you can put it into your path or ~/bin/checkpatch.pl
 
 
+If you want to change the defaults for patman's command-line arguments,
+you can add a [settings] section to your .patman file.  This can be used
+for any command line option by referring to the "dest" for the option in
+patman.py.  For reference, the useful ones (at the moment) shown below
+(all with the non-default setting):
+
+>>>
+
+[settings]
+ignore_errors: True
+process_tags: False
+verbose: True
+
+<<<
+
+
 How to run it
 =============
 
tools/patman/gitutil.py +0 -2
index 72d37a0..e7753cf 100644
@@ -377,8 +377,6 @@ def GetDefaultUserEmail():
 
 def Setup():
     """Set up git utils, by reading the alias files."""
-    settings.Setup('')
-
     # Check for a git alias file also
     alias_fname = GetAliasFile()
     if alias_fname:
tools/patman/patman.py +3 -0
index 4181d80..b327c67 100755
@@ -34,6 +34,7 @@ import checkpatch
 import command
 import gitutil
 import patchstream
+import settings
 import terminal
 import test
 
@@ -64,6 +65,8 @@ parser.usage = """patman [options]
 Create patches from commits in a branch, check them and email them as
 specified by tags you place in the commits. Use -n to """
 
+
+settings.Setup(parser, '')
 (options, args) = parser.parse_args()
 
 # Run our meagre tests
tools/patman/settings.py +35 -4
index 4dda17b..5208f7d 100644
@@ -88,13 +88,43 @@ def CreatePatmanConfigFile(config_fname):
     print >>f, "[alias]\nme: %s <%s>" % (name, email)
     f.close();
 
-def Setup(config_fname=''):
+def _UpdateDefaults(parser, config):
+    """Update the given OptionParser defaults based on config.
+
+    We'll walk through all of the settings from the parser
+    For each setting we'll look for a default in the option parser.
+    If it's found we'll update the option parser default.
+
+    The idea here is that the .patman file should be able to update
+    defaults but that command line flags should still have the final
+    say.
+
+    Args:
+        parser: An instance of an OptionParser whose defaults will be
+            updated.
+        config: An instance of SafeConfigParser that we will query
+            for settings.
+    """
+    defaults = parser.get_default_values()
+    for name, val in config.items('settings'):
+        if hasattr(defaults, name):
+            default_val = getattr(defaults, name)
+            if isinstance(default_val, bool):
+                val = config.getboolean('settings', name)
+            elif isinstance(default_val, int):
+                val = config.getint('settings', name)
+            parser.set_default(name, val)
+        else:
+            print "WARNING: Unknown setting %s" % name
+
+def Setup(parser, config_fname=''):
     """Set up the settings module by reading config files.
 
     Args:
+        parser:         The parser to update
         config_fname:   Config filename to read ('' for default)
     """
-    settings = ConfigParser.SafeConfigParser()
+    config = ConfigParser.SafeConfigParser()
     if config_fname == '':
         config_fname = '%s/.patman' % os.getenv('HOME')
 
@@ -102,11 +132,12 @@ def Setup(config_fname=''):
         print "No config file found ~/.patman\nCreating one...\n"
         CreatePatmanConfigFile(config_fname)
 
-    settings.read(config_fname)
+    config.read(config_fname)
 
-    for name, value in settings.items('alias'):
+    for name, value in config.items('alias'):
         alias[name] = value.split(',')
 
+    _UpdateDefaults(parser, config)
 
 # These are the aliases we understand, indexed by alias. Each member is a list.
 alias = {}
Signature · 1 line
1.7.7.3
#11 lore raw

PATCH v2 2/4 patman: Add support for settings in .patman

Quoted 15 lines · Doug Anderson

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

Quoted 6 lines

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

---
Changes in v2: None

Applied to u-boot-x86, thanks.

#12 lore raw

PATCH v2 3/4 patman: Add the concept of multiple projects

In reply to Doug Anderson

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.

---
Changes in v2:
- Added requested short option: '-p'.

 tools/patman/README      |   13 ++++
 tools/patman/patman.py   |    9 +++-
 tools/patman/project.py  |   43 +++++++++++++
 tools/patman/settings.py |  147 +++++++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 208 insertions(+), 4 deletions(-)
 create mode 100644 tools/patman/project.py
tools/patman/README +13 -0
index 2743da9..1832ebd 100644
@@ -114,6 +114,19 @@ verbose: True
 <<<
 
 
+If you want to adjust settings (or aliases) that affect just a single
+project you can add a section that looks like [project_settings] or
+[project_alias].  If you want to use tags for your linux work, you could
+do:
+
+>>>
+
+[linux_settings]
+process_tags: True
+
+<<<
+
+
 How to run it
 =============
 
tools/patman/patman.py +8 -1
index b327c67..2e9e5dc 100755
@@ -34,6 +34,7 @@ import checkpatch
 import command
 import gitutil
 import patchstream
+import project
 import settings
 import terminal
 import test
@@ -59,6 +60,9 @@ parser.add_option('--cc-cmd', dest='cc_cmd', type='string', action='store',
        default=None, help='Output cc list for patch file (used by git)')
 parser.add_option('--no-tags', action='store_false', dest='process_tags',
                   default=True, help="Don't process subject tags as aliaes")
+parser.add_option('-p', '--project', default=project.DetectProject(),
+                  help="Project name; affects default option values and "
+                  "aliases [default: %default]")
 
 parser.usage = """patman [options]
 
@@ -66,7 +70,10 @@ Create patches from commits in a branch, check them and email them as
 specified by tags you place in the commits. Use -n to """
 
 
-settings.Setup(parser, '')
+# Parse options twice: first to get the project and second to handle
+# defaults properly (which depends on project).
+(options, args) = parser.parse_args()
+settings.Setup(parser, options.project, '')
 (options, args) = parser.parse_args()
 
 # Run our meagre tests
tools/patman/project.py new file +43 -0

43 lines not on this page · raw message

tools/patman/settings.py +144 -3

174 lines not on this page · raw message

Signature · 1 line
1.7.7.3
#13 lore raw

PATCH v2 3/4 patman: Add the concept of multiple projects

Quoted 9 lines · Doug Anderson

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.

Quoted 4 lines

---
Changes in v2:
- Added requested short option: '-p'.

Quoted 8 lines
 tools/patman/README      |   13 ++++
 tools/patman/patman.py   |    9 +++-
 tools/patman/project.py  |   43 +++++++++++++
 tools/patman/settings.py |  147 +++++++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 208 insertions(+), 4 deletions(-)
 create mode 100644 tools/patman/project.py
#14 lore raw

PATCH v2 3/4 patman: Add the concept of multiple projects

Quoted 10 lines · Simon Glass
Quoted 9 lines · Doug Anderson

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.

Quoted 7 lines
Quoted 4 lines

---
Changes in v2:
- Added requested short option: '-p'.

Applied to u-boot-x86, thanks.

Quoted 8 lines
Quoted 8 lines
 tools/patman/README      |   13 ++++
 tools/patman/patman.py   |    9 +++-
 tools/patman/project.py  |   43 +++++++++++++
 tools/patman/settings.py |  147 +++++++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 208 insertions(+), 4 deletions(-)
 create mode 100644 tools/patman/project.py
#15 lore raw

PATCH v2 4/4 patman: Add settings to the list of modules to doctest

In reply to Doug Anderson

The settings modules now has doctests, so run them.

---
Changes in v2: None

 tools/patman/patman.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
tools/patman/patman.py +3 -2
index 2e9e5dc..e56dd01 100755
@@ -85,8 +85,9 @@ if options.test:
     result = unittest.TestResult()
     suite.run(result)
 
-    suite = doctest.DocTestSuite('gitutil')
-    suite.run(result)
+    for module in ['gitutil', 'settings']:
+        suite = doctest.DocTestSuite(module)
+        suite.run(result)
 
     # TODO: Surely we can just 'print' result?
     print result
Signature · 1 line
1.7.7.3
#16 lore raw

PATCH v2 4/4 patman: Add settings to the list of modules to doctest

Quoted 5 lines · Doug Anderson

The settings modules now has doctests, so run them.

---
Changes in v2: None

Applied to u-boot-x86, thanks.

#17 lore raw

PATCH v2 1/4 patman: Add a call to get_maintainer.pl if it exists

In reply to Doug Anderson
Quoted 8 lines · Doug Anderson

For Linux the best way to figure out where to send a patch is with the "get_maintainer.pl" script. Add support for calling it from patman. Support is added unconditionally for "scripts/get_maintainer.pl" in case it is helpful for any other projects.

---
Changes in v2: None

Applied to u-boot-x86, thanks.