From: Karl Hasselström <hidden> Date: 2016-08-11 20:44:31
StGIT's default patch email template has both "From: %(maintainer)s"
in the e-mail header, and "From: %(authname)s <%(authemail)s>" in the
e-mail body. Why?
--
Karl Hasselström, kha@treskal.com
From: Karl Hasselström <hidden> Date: 2016-08-11 19:27:35
On 2006-11-11 23:02:04 +0000, Catalin Marinas wrote:
On 11/11/06, Karl Hasselström [off-list ref] wrote:
quoted
Is there any particular reason to have the author and committer
names in ~/.stgitrc? Simply taking them from the same place git
does would probably be a usability enhancement (unless they're
specified on the command line, of course).
At the time I added these to .stgitrc, the only place git was taking
them from was the environment variables and I wanted to put them in a
single place. I also didn't like the idea of having the committer
e-mail address be some username@local-machine as I don't think the
name of the machine where I create patches is relevant. I also define
the committer/author per repository in the .git/stgitrc file (i.e. I
use @arm.com for Linux patches and @gmail.com for StGIT).
Well, this should all be sorted out now; git has both per-repository
and per-user config files.
I use StGIT almost exclusively, even in "maintainer" mode and I
would like not to spread the configuration options over many files.
It is on my todo list to use the same configuration file as git
(with a [stgit] section) since it has a format that should be
understood by the Python config module.
The last patch in this series deprecates name and email config in
stgitrc by not mentioning them in the example stgitrc, because
teaching newbies to use yet another layer of identity configuration on
top of what git already provides is madness. Old-timers may continue
using stgitrc for that purpose for now (but as you say, integrating
the configuration with git is on the TODO list).
--
Karl Hasselström, kha@treskal.com
From: Karl Hasselström <hidden> Date: 2016-08-11 19:29:26
From: Karl Hasselström <redacted>
There are two distinct disadvantages to having author and committer
names in stgitrc:
* They override GIT_AUTHOR_NAME and friends, not the other way
around as one might imagine.
* They cause stgit and plain git to use different names (unless one
manages to keep them in sync manually), which can't possibly be a
good idea.
This patch removes the description of these variables in the example
stgitrc, so that new users aren't tempted to use them. They will still
continue to function, however.
Signed-off-by: Karl Hasselström <redacted>
---
examples/stgitrc | 5 -----
stgit/git.py | 3 +++
2 files changed, 3 insertions(+), 5 deletions(-)
@@ -452,6 +452,9 @@ def __git_person(p):__cached_stgit_persons={}def__stgit_person(p,name_key,email_key):+"""Calls __git_person to get the details for a person, but allows+thedeprecatedauthorandcommittervariablesinstgitrcoverride+theresult."""ifnotpin__cached_stgit_persons:person=__git_person(p)
From: Karl Hasselström <hidden> Date: 2016-08-11 19:29:48
On 2006-11-11 23:02:04 +0000, Catalin Marinas wrote:
I use StGIT almost exclusively, even in "maintainer" mode
It used to be the case that I did almost all my comitting with stgit
(while still using other git tools, such as gitk, reset, bisect, fetch
etc.). But then I discovered the extremely handy git emacs modes, and
started using them to commit stuff. Thus the need for "stg
assimilate". :-)
--
Karl Hasselström, kha@treskal.com
From: Karl Hasselström <hidden> Date: 2016-08-11 19:31:11
On 2006-11-11 21:26:31 +0100, Robin Rosenberg wrote:
lördag 11 november 2006 15:57 skrev Karl Hasselström:
quoted
But I haven't gotten the impression that specifying them in
~/.stgitrc is deprecated. The example stgitrc has a section with
author name and committer name, for example.
The only docs I know of that mentions stgitrc also states that it
isn't required, so why use it unless you have to (or for some reason
want to)? Just because there are many ways, doesn't mean all but one
have to be deprecated.
No, but having a config option for something that git already provides
several ways to specify can't possibly be a good idea, especially
usability-wise. The only use I can think of is if you _want_ to have
different identities for git and stgit in the same repository, and
that's just mad.
I'm preparing a patch to fix this. Stay tuned. :-)
--
Karl Hasselström, kha@treskal.com
From: Karl Hasselström <hidden> Date: 2016-08-11 19:39:06
On 2006-11-11 15:31:15 +0100, Robin Rosenberg wrote:
lördag 11 november 2006 15:15 skrev Karl Hasselström:
quoted
Is there any particular reason to have the author and committer
names in ~/.stgitrc? Simply taking them from the same place git
does would probably be a usability enhancement (unless they're
specified on the command line, of course).
AFAIK StGit already does that, at least if you (like me) do not have
a .stgitrc.
But I haven't gotten the impression that specifying them in ~/.stgitrc
is deprecated. The example stgitrc has a section with author name and
committer name, for example.
--
Karl Hasselström, kha@treskal.com
From: Karl Hasselström <hidden> Date: 2016-08-11 19:39:13
From: Karl Hasselström <redacted>
Consistently do the following to get hold of default user and
committer:
1. Use the value specified on the command line, if any.
1. Otherwise, use the value from stgitrc, if available.
2. Otherwise, ask git for the value. git will produce the value from
on of its config files, from environment variables, or make it
up. It might be asking the spirits of the dead for all we care.
Signed-off-by: Karl Hasselström <redacted>
---
stgit/commands/mail.py | 19 ++------------
stgit/git.py | 63 ++++++++++++++++++++++++++++++++++++++++++++++++
stgit/stack.py | 32 ++++--------------------
3 files changed, 70 insertions(+), 44 deletions(-)
@@ -127,17 +127,6 @@ options = [make_option('-a', '--all',action='store_true')]-def__get_maintainer():-"""Return the 'authname <authemail>' string as read from the-configurationfile-"""-ifconfig.has_option('stgit','authname') \-andconfig.has_option('stgit','authemail'):-return'%s <%s>'%(config.get('stgit','authname'),-config.get('stgit','authemail'))-else:-returnNone-def__parse_addresses(addresses):"""Return a two elements tuple: (from, [to])"""
@@ -301,9 +290,7 @@ def edit_message(msg):def__build_cover(tmpl,total_nr,msg_id,options):"""Build the cover message (series description) to be sent via SMTP"""-maintainer=__get_maintainer()-ifnotmaintainer:-maintainer=''+maintainer=git.user()ifoptions.version:version_str=' %s'%options.version
@@ -33,6 +33,35 @@ class GitException(Exception):## Classes#++classPerson:+"""An author, committer, etc."""+def__init__(self,name=None,email=None,date=None,+desc=None):+ifnameoremailordate:+assertnotdesc+self.name=name+self.email=email+self.date=date+elifdesc:+assertnot(nameoremailordate)+defparse_desc(s):+m=re.match(r'^(.+)<(.+)>(.*)$',s)+assertm+return[x.strip()orNoneforxinm.groups()]+self.name,self.email,self.date=parse_desc(desc)+defset_name(self,val):+ifval:+self.name=val+defset_email(self,val):+ifval:+self.email=val+def__str__(self):+ifself.nameandself.email:+return'%s <%s>'%(self.name,self.email)+else:+raiseException,'not enough identity data'+classCommit:"""Handle the commit objects"""
@@ -402,6 +431,40 @@ def rm(files, force = False):iffiles:__run('git-update-index --force-remove --',files)+defvar(key):+"""Ask git-var for the value of a variable."""+return_output_one_line(['git-var',key])++defrepo_config(key):+"""Ask git-repo-config for the value of a variable."""+return_output_one_line(['git-repo-config',key])++__cached_git_persons={}+def__git_person(p):+ifnotpin__cached_git_persons:+__cached_git_persons[p]={+'author':lambda:Person(desc=var('GIT_AUTHOR_IDENT')),+'committer':lambda:Person(desc=var('GIT_COMMITTER_IDENT')),+'user':lambda:Person(repo_config('user.name'),+repo_config('user.email')),+}[p]()+return__cached_git_persons[p]++__cached_stgit_persons={}+def__stgit_person(p,name_key,email_key):+ifnotpin__cached_stgit_persons:+person=__git_person(p)+ifconfig.has_option('stgit',name_key):+person.set_name(config.get('stgit',name_key))+ifconfig.has_option('stgit',email_key):+person.set_email(config.get('stgit',email_key))+__cached_stgit_persons[p]=person+return__cached_stgit_persons[p]++defauthor():return__stgit_person('author','authname','authemail')+defcommitter():return__stgit_person('committer','commname','commemail')+defuser():return__stgit_person('user','authname','authemail')+defupdate_cache(files=None,force=False):"""Update the cache information for the given files"""
On 11/11/06, Karl Hasselström [off-list ref] wrote:
Consistently do the following to get hold of default user and
committer:
1. Use the value specified on the command line, if any.
1. Otherwise, use the value from stgitrc, if available.
2. Otherwise, ask git for the value. git will produce the value from
on of its config files, from environment variables, or make it
up. It might be asking the spirits of the dead for all we care.
I haven't forgot about this patch. I switched StGIT to the gitconfig
files and there won't be a need to invoke "git repo-config". I'll try
to modify your patch.
--
From: Robin Rosenberg <hidden> Date: 2016-08-11 19:40:16
lördag 11 november 2006 15:15 skrev Karl Hasselström:
Is there any particular reason to have the author and committer names
in ~/.stgitrc? Simply taking them from the same place git does would
probably be a usability enhancement (unless they're specified on the
command line, of course).
AFAIK StGit already does that, at least if you (like me) do not have
a .stgitrc.
From: Karl Hasselström <hidden> Date: 2016-08-11 19:46:42
From: Karl Hasselström <redacted>
%(endofheaders)s and %(date)s are deprecated and expand to the empty
string, so don't mention them in the help text.
Signed-off-by: Karl Hasselström <redacted>
---
stgit/commands/mail.py | 13 ++++---------
1 files changed, 4 insertions(+), 9 deletions(-)
@@ -52,19 +52,14 @@ SMTP authentication is also possible wit'--smtp-password'options,alsoavailableasconfigurationsettings:'smtpuser'and'smtppassword'.-Thetemplatee-mailheadersandbodymustbeseparatedby-'%(endofheaders)s'variable,whichisreplacedbyStGITwith-additionalheadersandablankline.Thepatche-mailtemplateaccepts-thefollowingvariables:+Thepatche-mailtemplateacceptsthefollowingvariables:%(patch)s-patchname%(maintainer)s-'authname <authemail>'asreadfromtheconfigfile%(shortdescr)s-thefirstlineofthepatchdescription%(longdescr)s-therestofthepatchdescription,afterthefirstline-%(endofheaders)s-delimiterbetweene-mailheadersandbody%(diff)s-unifieddiffofthepatch%(diffstat)s-diffstatistics-%(date)s-currentdate/time%(version)s-' version'stringpassedonthecommandline(orempty)%(prefix)s-'prefix 'stringpassedonthecommandline%(patchnr)s-patchnumber
@@ -76,9 +71,9 @@ the following variables:%(commname)s-committer's name%(commemail)s-committer's e-mail-Forthepreamblee-mailtemplate,onlythe%(maintainer)s,%(date)s,-%(endofheaders)s,%(version)s,%(patchnr)s,%(totalnr)sand%(number)s-variablesaresupported."""+Forthepreamblee-mailtemplate,onlythe%(maintainer)s,+%(version)s,%(patchnr)s,%(totalnr)sand%(number)svariablesare+supported."""options=[make_option('-a','--all',
From: Karl Hasselström <hidden> Date: 2016-08-11 19:49:00
Is there any particular reason to have the author and committer names
in ~/.stgitrc? Simply taking them from the same place git does would
probably be a usability enhancement (unless they're specified on the
command line, of course).
--
Karl Hasselström, kha@treskal.com
From: Karl Hasselström <hidden> Date: 2016-08-11 19:50:35
On 2006-11-11 12:35:53 +0100, Karl Hasselström wrote:
StGIT's default patch email template has both "From: %(maintainer)s"
in the e-mail header, and "From: %(authname)s <%(authemail)s>" in
the e-mail body. Why?
Ah, I just figured it out. "maintainer" is the person sending the
mail, and "author" is the person who wrote the patch. In general, they
are not the same.
Hmm. It would be nice to omit the second From: in case they really are
the same.
--
Karl Hasselström, kha@treskal.com
From: Karl Hasselström <hidden> Date: 2016-08-11 20:10:31
On 2006-11-12 00:30:46 +0100, Karl Hasselström wrote:
1. Use the value specified on the command line, if any.
1. Otherwise, use the value from stgitrc, if available.
2. Otherwise, ask git for the value. git will produce the value
from on of its config files, from environment variables, or
make it up. It might be asking the spirits of the dead for all
we care.
Oops. Feel free to renumber these points as you see fit. :-)
--
Karl Hasselström, kha@treskal.com
On 05/12/06, Karl Hasselström [off-list ref] wrote:
On 2006-12-04 22:24:52 +0000, Catalin Marinas wrote:
quoted
I haven't forgot about this patch. I switched StGIT to the gitconfig
files and there won't be a need to invoke "git repo-config". I'll
try to modify your patch.
Ah, nice. But will you still honor the git author and committer
environment variables that way?
Yes. My understanding is that the environment variables would override
the config options. I would also keep the [stgit] user information for
backward compatibility (there are people who use StGIT exclusively and
don't want to dig into GIT configs).
--
From: Karl Hasselström <hidden> Date: 2016-08-11 20:16:07
On 2006-12-04 22:24:52 +0000, Catalin Marinas wrote:
On 11/11/06, Karl Hasselström [off-list ref] wrote:
quoted
Consistently do the following to get hold of default user and
committer:
1. Use the value specified on the command line, if any.
1. Otherwise, use the value from stgitrc, if available.
2. Otherwise, ask git for the value. git will produce the value
from on of its config files, from environment variables, or
make it up. It might be asking the spirits of the dead for
all we care.
I haven't forgot about this patch. I switched StGIT to the gitconfig
files and there won't be a need to invoke "git repo-config". I'll
try to modify your patch.
Ah, nice. But will you still honor the git author and committer
environment variables that way?
--
Karl Hasselström, kha@treskal.com
On 11/11/06, Karl Hasselström [off-list ref] wrote:
Is there any particular reason to have the author and committer names
in ~/.stgitrc? Simply taking them from the same place git does would
probably be a usability enhancement (unless they're specified on the
command line, of course).
At the time I added these to .stgitrc, the only place git was taking
them from was the environment variables and I wanted to put them in a
single place. I also didn't like the idea of having the committer
e-mail address be some username@local-machine as I don't think the
name of the machine where I create patches is relevant. I also define
the committer/author per repository in the .git/stgitrc file (i.e. I
use @arm.com for Linux patches and @gmail.com for StGIT).
I use StGIT almost exclusively, even in "maintainer" mode and I would
like not to spread the configuration options over many files. It is on
my todo list to use the same configuration file as git (with a [stgit]
section) since it has a format that should be understood by the Python
config module.
--
From: Robin Rosenberg <hidden> Date: 2016-08-11 20:47:31
lördag 11 november 2006 15:57 skrev Karl Hasselström:
On 2006-11-11 15:31:15 +0100, Robin Rosenberg wrote:
quoted
lördag 11 november 2006 15:15 skrev Karl Hasselström:
quoted
Is there any particular reason to have the author and committer
names in ~/.stgitrc? Simply taking them from the same place git
does would probably be a usability enhancement (unless they're
specified on the command line, of course).
AFAIK StGit already does that, at least if you (like me) do not have
a .stgitrc.
But I haven't gotten the impression that specifying them in ~/.stgitrc
is deprecated. The example stgitrc has a section with author name and
committer name, for example.
The only docs I know of that mentions stgitrc also states that it isn't
required, so why use it unless you have to (or for some reason want to)? Just
because there are many ways, doesn't mean all but one have to be deprecated.