Miscellaneous fixes
cover Miscellaneous fixes
This is a few miscellaneous fixes. Also available here:
git://repo.or.cz/stgit/kha.git fixes
Karl Hasselström (4):
Don't use test_expect_failure when more than one thing could fail Don't write None to the conf file
Replace "git repo-config" with "git config" in help texts Compile regexp just once
examples/gitconfig | 2 +- stgit/git.py | 3 ++- stgit/stack.py | 7 ++++--- t/t2101-pull-policy-pull.sh | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-)
Signature · 2 lines
Karl Hasselström, [email protected] www.treskal.com/kalle
PATCH 1/4 Don't use test_expect_failure when more than one thing could fail
It's much better to use ! for the part that you actually expect to fail; that way, the test will still scream if something _else_ goes wrong.
---
t/t2101-pull-policy-pull.sh | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
t/t2101-pull-policy-pull.sh +2 -2
@@ -39,11 +39,11 @@ test_expect_success \ # as rewinding, and thus heads/origin is not moved, but the stack # is still correctly rebased -test_expect_failure \ +test_expect_success \ 'Rewind/rewrite upstream commit and pull it from clone, without --merged' \ ' (cd upstream && echo b >> file2 && stg refresh) && - (cd clone && stg pull) + (cd clone && ! stg pull) ' test_expect_success \
PATCH 2/4 Don't write None to the conf file
In reply to Karl HasselströmIf we don't have a value for the remote, just don't write it. Writing None will either write the string "None" or crash StGIT, depending on how exactly the call is done -- and neither is what we want!
---
stgit/stack.py | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
stgit/stack.py +2 -1
@@ -546,7 +546,8 @@ class Series(PatchSet): def set_parent(self, remote, localbranch): if localbranch: - self.__set_parent_remote(remote) + if remote: + self.__set_parent_remote(remote) self.__set_parent_branch(localbranch) # We'll enforce this later # else:
PATCH 3/4 Replace "git repo-config" with "git config" in help texts
In reply to Karl HasselströmIt makes sense to still use git-repo-config instead of git-config in the code, since the latter name is not available in older gits, but it's better to use the new name in the help texts since the overwhelming majority of users aren't going to use a very old git.
---
examples/gitconfig | 2 +- stgit/stack.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
examples/gitconfig +1 -1
@@ -1,6 +1,6 @@ # StGIT configuration file. Copy it to any of ~/.gitconfig or # .git/config and modify as needed. Note that the latter overrides -# the former. The "git repo-config" command can be used as well +# the former. The "git config" command can be used as well [user] # Default author/committer details (standard GIT variables)
stgit/stack.py +2 -2
@@ -515,7 +515,7 @@ class Series(PatchSet): out.note(('No parent remote declared for stack "%s",' ' defaulting to "origin".' % self.get_name()), ('Consider setting "branch.%s.remote" and' - ' "branch.%s.merge" with "git repo-config".' + ' "branch.%s.merge" with "git config".' % (self.get_name(), self.get_name()))) return 'origin' else:
@@ -532,7 +532,7 @@ class Series(PatchSet): out.note(('No parent branch declared for stack "%s",' ' defaulting to "heads/origin".' % self.get_name()), ('Consider setting "branch.%s.stgit.parentbranch"' - ' with "git repo-config".' % self.get_name())) + ' with "git config".' % self.get_name())) return 'heads/origin' else: raise StackException, 'Cannot find a parent branch for "%s"' % self.get_name()
PATCH 4/4 Compile regexp just once
In reply to Karl HasselströmIt's a waste of time to recompile the same regexp every time we go through the loop.
---
stgit/git.py | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
stgit/git.py +2 -1
@@ -275,8 +275,9 @@ def local_changes(verbose = True): def get_heads(): heads = [] + hr = re.compile(r'^[0-9a-f]{40} refs/heads/(.+)$') for line in _output_lines(['git-show-ref', '--heads']): - m = re.match('^[0-9a-f]{40} refs/heads/(.+)$', line) + m = hr.match(line) heads.append(m.group(1)) return heads
Quoted 1 line · Karl Hasselström
This is a few miscellaneous fixes. Also available here:
Thanks.
Quoted 9 lines
git://repo.or.cz/stgit/kha.gitfixesKarl Hasselström (4):
Don't usetest_expect_failurewhen more than one thing could fail Don't write None to the conf file
Replace "git repo-config" with "git config" in help texts Compile regexp just once
Quoted 5 lines
examples/gitconfig | 2 +- stgit/git.py | 3 ++- stgit/stack.py | 7 ++++--- t/t2101-pull-policy-pull.sh | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-)
BTW, did you generate the above text by hand and copied it to the e-mail? People asked in the past for this kind of text to be automatically generated by 'stg mail'.
Signature · 1 line
Catalin
Quoted 10 lines · Catalin Marinas
Quoted 8 lines · Karl Hasselström
git://repo.or.cz/stgit/kha.gitfixesKarl Hasselström (4):
Don't usetest_expect_failurewhen more than one thing could fail Don't write None to the conf file
Replace "git repo-config" with "git config" in help texts Compile regexp just once
Quoted 8 lines
Quoted 5 lines
examples/gitconfig | 2 +- stgit/git.py | 3 ++- stgit/stack.py | 7 ++++--- t/t2101-pull-policy-pull.sh | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-)BTW, did you generate the above text by hand and copied it to the e-mail?
Yes. It's the output of git-request-pull.
Quoted 2 lines
People asked in the past for this kind of text to be automatically generated by 'stg mail'.
I might very well have been one of them.
Adding cover message template support for shortlog and aggregate diffstat should be straightforward. I might get to it some time in the not too distant future if no one else beats me to it. As for the pull line, that's another story; git-request-pull actually seems to connect to that repository and check its contents, and I'm not convinced that's a good thing for stg-mail to be doing. But that's the least wanted item of the three anyway, I guess.
Signature · 2 lines
Karl Hasselström, [email protected] www.treskal.com/kalle
Quoted 12 lines · Karl Hasselström
Quoted 9 lines · Catalin Marinas
Quoted 5 lines · Karl Hasselström
examples/gitconfig | 2 +- stgit/git.py | 3 ++- stgit/stack.py | 7 ++++--- t/t2101-pull-policy-pull.sh | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-)BTW, did you generate the above text by hand and copied it to the e-mail?
Quoted 6 lines
Yes. It's the output of git-request-pull.
Quoted 2 lines
People asked in the past for this kind of text to be automatically generated by 'stg mail'.
I might very well have been one of them.
On a related note, it might make sense for 'stg export' to add (with an additional option) a comment line beside each patch in the series file containing the short description.
Signature · 1 line
Catalin