threads / patch / 9659

patch, 4 partsMiscellaneous fixes

Subject: [StGIT PATCH 0/4] Miscellaneous fixes

## tl;dr

8 messages between Aug 26, 2007 and Sep 3, 2007. Diffs are folded; open one to read it.

replies: 7people: 2as markdown or json

Karl Hasselström· Aug 26, 2007, 20:26 UTC · lore
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(-)
-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle
Karl Hasselström· Aug 26, 2007, 20:26 UTC · re: Karl Hasselström · lore

[StGIT 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.

Signed-off-by: Karl Hasselström <kha@treskal.com>
---
 t/t2101-pull-policy-pull.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Show changes to t/t2101-pull-policy-pull.sh +2 −2
diff --git a/t/t2101-pull-policy-pull.sh b/t/t2101-pull-policy-pull.sh
index 793491c..14d5adb 100755
--- a/t/t2101-pull-policy-pull.sh
+++ b/t/t2101-pull-policy-pull.sh
@@ -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 \
Karl Hasselström· Aug 26, 2007, 20:26 UTC · re: Karl Hasselström · lore

[StGIT PATCH 2/4] Don't write None to the conf file

If 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!

Signed-off-by: Karl Hasselström <kha@treskal.com>
---
 stgit/stack.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Show changes to stgit/stack.py +2 −1
diff --git a/stgit/stack.py b/stgit/stack.py
index 030562d..0ce9992 100644
--- a/stgit/stack.py
+++ b/stgit/stack.py
@@ -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:
Karl Hasselström· Aug 26, 2007, 20:26 UTC · re: Karl Hasselström · lore

[StGIT PATCH 3/4] Replace "git repo-config" with "git config" in help texts

It 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.

Signed-off-by: Karl Hasselström <kha@treskal.com>
---
 examples/gitconfig |    2 +-
 stgit/stack.py     |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
Show changes to 2 files +3 −3

examples/gitconfig, stgit/stack.py

diff --git a/examples/gitconfig b/examples/gitconfig
index e402208..f1c653e 100644
--- a/examples/gitconfig
+++ b/examples/gitconfig
@@ -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)
diff --git a/stgit/stack.py b/stgit/stack.py
index 0ce9992..1ab10c5 100644
--- a/stgit/stack.py
+++ b/stgit/stack.py
@@ -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()
Karl Hasselström· Aug 26, 2007, 20:26 UTC · re: Karl Hasselström · lore

[StGIT PATCH 4/4] Compile regexp just once

It's a waste of time to recompile the same regexp every time we go through the loop.

Signed-off-by: Karl Hasselström <kha@treskal.com>
---
 stgit/git.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Show changes to stgit/git.py +2 −1
diff --git a/stgit/git.py b/stgit/git.py
index 1807f69..14b4c81 100644
--- a/stgit/git.py
+++ b/stgit/git.py
@@ -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
 
Catalin Marinas· Aug 29, 2007, 10:18 UTC · re: Karl Hasselström · lore

Re: [StGIT PATCH 0/4] Miscellaneous fixes

On 26/08/2007, Karl Hasselström <kha@treskal.com> wrote:
> This is a few miscellaneous fixes. Also available here:
Thanks.
Show 14 quoted lines
>
>   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(-)

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'.

-- 
Catalin
Karl Hasselström· Aug 29, 2007, 11:17 UTC · re: Catalin Marinas · lore

Re: [StGIT PATCH 0/4] Miscellaneous fixes

On 2007-08-29 11:18:34 +0100, Catalin Marinas wrote:
Show 18 quoted lines
> On 26/08/2007, Karl Hasselström <kha@treskal.com> wrote:
>
> >   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(-)
>
> 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.
> 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.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle
Catalin Marinas· Sep 3, 2007, 08:40 UTC · re: Karl Hasselström · lore

Re: [StGIT PATCH 0/4] Miscellaneous fixes

On 29/08/07, Karl Hasselström <kha@treskal.com> wrote:
Show 18 quoted lines
> On 2007-08-29 11:18:34 +0100, Catalin Marinas wrote:
>
> > On 26/08/2007, Karl Hasselström <kha@treskal.com> wrote:
> > >  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.
>
> > 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.

-- 
Catalin

← back to recent threads