From: Paolo 'Blaisorblade' Giarrusso <hidden> Date: 2016-06-15 22:42:06
Found casually in commit.__init__, while profiling stg series.
And yes, I went checking that git has no typo.
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <redacted>
---
stgit/git.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
From: Paolo 'Blaisorblade' Giarrusso <hidden> Date: 2016-06-15 22:42:06
That's just too slow, and quilt doesn't do it, so user will live with it.
Don't know if there's a reason to allow dropping the fanciness here
entirely, but I think there's no user doing one-liner scripts with quilt
series. And anyway, for that you can do "stg applied; stg unapplied".
Actually, with this patch you must ask explicitly the checking.
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <redacted>
---
stgit/commands/series.py | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
@@ -31,7 +31,10 @@ Show all the patches in the series. The witha'+'andtheunappliedoneswitha'-'.Thecurrentpatchisprefixedwitha'>'.Emptypatchesareprefixedwitha'0'."""-options=[]+options=[make_option('-e','--empty',+help='check whether patches are empty '+'(much slower)',+action='store_true')]deffunc(parser,options,args):
From: Paolo 'Blaisorblade' Giarrusso <hidden> Date: 2016-06-15 22:42:06
For kernel patches, the "From" line from the email is often preserved in
the patch itself, and the one from the email is sometimes lost, so I add an
explicit one. And mail barfes on this.
Fix it up.
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <redacted>
---
stgit/commands/mail.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
From: Paolo 'Blaisorblade' Giarrusso <hidden> Date: 2016-06-15 22:42:06
Do git-update-cache only when diffing with the working tree, not otherwise.
Spending something like 1min for a stg files is bad - yes, my laptop
was really busy and the Linux tree was probably cache-cold, but that's just
not needed.
Also, in diffstat we currently do it both by hand and by calling git.diff.
And in files there's no need at all for that - even the comments says that
"files" has only to do with committed changes.
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <redacted>
---
stgit/git.py | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
From: Paolo 'Blaisorblade' Giarrusso <hidden> Date: 2016-06-15 22:42:06
From: Paolo 'Blaisorblade' Giarrusso <redacted>
The current logic imports the whole quilt patch as description - the changes
themselves are correctly applied, luckily, but the description must be fixed up
by hand.
So, detect "Index: " lines as patch start. I've heard rumors that also
Subversion generates this format, so we become compatible with it, too.
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <redacted>
---
stgit/commands/imprt.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
@@ -170,7 +170,11 @@ class Patch:defset_bottom(self,string,backup=False):ifbackup:-self.__set_field('bottom.old',self.__get_field('bottom'))+curr=self.__get_field('bottom')+ifcurr!=string:+self.__set_field('bottom.old',curr)+else:+self.__set_field('bottom.old',None)self.__set_field('bottom',string)defget_top(self):
@@ -178,7 +182,11 @@ class Patch:defset_top(self,string,backup=False):ifbackup:-self.__set_field('top.old',self.__get_field('top'))+curr=self.__get_field('top')+ifcurr!=string:+self.__set_field('top.old',curr)+else:+self.__set_field('top.old',None)self.__set_field('top',string)defrestore_old_boundaries(self):
@@ -188,8 +196,9 @@ class Patch:iftopandbottom:self.__set_field('bottom',bottom)self.__set_field('top',top)+returnTrueelse:-raiseStackException,'No patch undo information'+returnFalsedefget_description(self):returnself.__get_field('description',True)
@@ -571,7 +580,7 @@ class Series:patch=Patch(name,self.__patch_dir)git.reset()self.pop_patch(name)-patch.restore_old_boundaries()+returnpatch.restore_old_boundaries()defpop_patch(self,name):"""Pops the top patch from the stack
From: Paolo 'Blaisorblade' Giarrusso <hidden> Date: 2016-06-15 22:42:06
From: Paolo 'Blaisorblade' Giarrusso <redacted>
When the "bottom" commit and the HEAD don't match, but they refer to the
same tree (for instance after a refresh where only the description
changed), we can still fast-forward, by keeping the same top tree and
calling git-commit-tree (which only requires the tree object) with the new
parent. I've altered git.commit to allow this.
Btw, I've also avoided the use of .commitmsg and switched to piping the
description.
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <redacted>
---
stgit/git.py | 30 ++++++++++++++++--------------
stgit/stack.py | 35 +++++++++++++++++++++++++++++++----
2 files changed, 47 insertions(+), 18 deletions(-)
@@ -286,7 +290,7 @@ def update_cache(files = [], force = FalreturnTruedefcommit(message,files=[],parents=[],allowempty=False,-cache_update=True,+cache_update=True,tree_id=None,author_name=None,author_email=None,author_date=None,committer_name=None,committer_email=None):"""Commit the current tree to repository
@@ -298,15 +302,15 @@ def commit(message, files = [], parents raiseGitException,'No changes to commit'# get the commit message-f=file('.commitmsg','w+')-ifmessage[-1:]=='\n':-f.write(message)-else:-print>>f,message-f.close()+ifmessage[-1:]!='\n':+message+='\n'+must_switch=True# write the index to repository-tree_id=_output_one_line('git-write-tree')+iftree_id==None:+tree_id=_output_one_line('git-write-tree')+else:+must_switch=False# the commitcmd=''
@@ -495,13 +495,40 @@ class Series:# top != bottom always since we have a commit for each patchifhead==bottom:# reset the backup information-patch.set_bottom(bottom,backup=True)+patch.set_bottom(head,backup=True)patch.set_top(top,backup=True)else:-top=head-# stop the fast-forwarding, must do a real merge-break+head_tree=git.get_commit(head).get_tree()+bottom_tree=git.get_commit(bottom).get_tree()+ifhead_tree==bottom_tree:+# We must just reparent this patch and create a new commit+# for it+descr=patch.get_description()+author_name=patch.get_authname()+author_email=patch.get_authemail()+author_date=patch.get_authdate()+committer_name=patch.get_commname()+committer_email=patch.get_commemail()++top_tree=git.get_commit(top).get_tree()++top=git.commit(message=descr,parents=[head],+cache_update=False,+tree_id=top_tree,+allowempty=True,+author_name=author_name,+author_email=author_email,+author_date=author_date,+committer_name=committer_name,+committer_email=committer_email)++patch.set_bottom(head,backup=True)+patch.set_top(top,backup=True)+else:+top=head+# stop the fast-forwarding, must do a real merge+breakforwarded+=1unapplied.remove(name)
From: Paolo 'Blaisorblade' Giarrusso <hidden> Date: 2016-06-15 22:42:06
I'm used to doing vi $(quilt files), which is impossible with stgit.
Add an option (-b/--base) to request the normal behaviour, but make it
non-default as the current output is useful.
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <redacted>
---
stgit/commands/files.py | 5 +++++
stgit/git.py | 10 ++++++++++
2 files changed, 15 insertions(+), 0 deletions(-)
@@ -35,6 +35,9 @@ command. Use the 'diff' or 'status' commoptions=[make_option('-s','--stat',help='show the diff stat',+action='store_true'),+make_option('-b','--bare',+help='bare file names (useful for scripting)',action='store_true')]
@@ -410,6 +410,16 @@ def files(rev1, rev2):returnstr.rstrip()+defbarefiles(rev1,rev2):+"""Return the files modified between rev1 and rev2, without status info+"""++str=''+forlinein_output_lines('git-diff-tree -r %s%s'%(rev1,rev2)):+str+='%s\n'%line.rstrip().split(' ',4)[-1].split('\t',1)[-1]++returnstr.rstrip()+defcheckout(files=[],tree_id=None,force=False):"""Check out the given or all files"""
From: Paolo 'Blaisorblade' Giarrusso <hidden> Date: 2016-06-15 22:42:06
From: Paolo 'Blaisorblade' Giarrusso <redacted>
It crashes on accessing 1st element of an empty array.
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <redacted>
---
stgit/commands/clean.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
From: Paolo 'Blaisorblade' Giarrusso <hidden> Date: 2016-06-15 22:42:06
From: Paolo 'Blaisorblade' Giarrusso <redacted>
I tried to mail a cherry-picked subset of my series and that didn't work - using
stg export and quilt was even worse, so I had to code something.
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <redacted>
---
stgit/commands/mail.py | 15 ++++++---------
1 files changed, 6 insertions(+), 9 deletions(-)
@@ -26,7 +26,7 @@ from stgit.config import confighelp='send a patch or series of patches by e-mail'-usage="""%prog [options] [<patch>]+usage="""%prog [options] [<patch> [<patch2...]]Sendapatchorarangeofpatches(defaultingtotheappliedpatches)bye-mailusingthe'smtpserver'configurationoption.TheFrom
@@ -265,9 +265,6 @@ def func(parser, options, args):"""Send the patches by e-mail using the patchmail.tmpl file asatemplate"""-iflen(args)>1:-parser.error('incorrect number of arguments')-ifnotconfig.has_option('stgit','smtpserver'):raiseCmdException,'smtpserver not defined'smtpserver=config.get('stgit','smtpserver')
@@ -281,11 +278,11 @@ def func(parser, options, args):applied=crt_series.get_applied()-iflen(args)==1:-ifargs[0]inapplied:-patches=[args[0]]-else:-raiseCmdException,'Patch "%s" not applied'%args[0]+iflen(args)>=1:+forpatchinargs:+ifnotpatchinapplied:+raiseCmdException,'Patch "%s" not applied'%patch+patches=argselifoptions.all:patches=appliedelifoptions.range:
From: Paolo 'Blaisorblade' Giarrusso <hidden> Date: 2016-06-15 22:42:06
From: Paolo 'Blaisorblade' Giarrusso <redacted>
Tried sending an email cc'ing LKML - watched my postfix queue - and saw
kernel@vger.kernel.org as delivery address! What had happened? StGIT didn't like
"linux-kernel" ! Fix the regexp.
I just added an hyphen to both sections (yes, there are plenty of domain names
including hyphens, and I tested the problem there too). Don't know if other
chars are missing.
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <redacted>
---
stgit/commands/mail.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
@@ -112,7 +112,7 @@ def __parse_addresses(string):"""Return a two elements tuple: (from, [to])"""def__addr_list(string):-returnre.split('.*?([\w\.]+@[\w\.]+)',string)[1:-1:2]+returnre.split('.*?([-\w\.]+@[-\w\.]+)',string)[1:-1:2]from_addr_list=[]to_addr_list=[]
On Fri, 2005-09-16 at 21:35 +0200, Paolo 'Blaisorblade' Giarrusso wrote:
That's just too slow, and quilt doesn't do it, so user will live with it.
Don't know if there's a reason to allow dropping the fanciness here
entirely, but I think there's no user doing one-liner scripts with quilt
series. And anyway, for that you can do "stg applied; stg unapplied".
Actually, with this patch you must ask explicitly the checking.
All the 11 patches applied. Thanks.
One note about this one - we could store the tree id as well in the
patch information since it is generated by git.commit() anyway and it
would make the checking simpler. Anyway, in the meantime this patch is
OK.
--
Catalin