git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [StGit PATCH 1/1] Add basic test for stg status
@ 2007-08-30 11:11 David Kågedal
  2007-08-30 11:11 ` [StGit PATCH 2/2] Cleanup tree_status and use -z David Kågedal
  2007-08-30 11:14 ` [StGit PATCH 1/1] Add basic test for stg status David Kågedal
  0 siblings, 2 replies; 7+ messages in thread
From: David Kågedal @ 2007-08-30 11:11 UTC (permalink / raw)
  To: git, catalin.marinas; +Cc: David Kågedal


Signed-off-by: David KÃ¥gedal <davidk@lysator.liu.se>
---

This is very basic, but there was no test at all that ran stg status,
so nothing excercised the code changed in the following patch.

 t/t0002-status.sh |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
 create mode 100755 t/t0002-status.sh

diff --git a/t/t0002-status.sh b/t/t0002-status.sh
new file mode 100755
index 0000000..c088d56
--- /dev/null
+++ b/t/t0002-status.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# Copyright (c) 2007 David Kågedal
+#
+
+test_description='Basic stg status
+
+Test that "stg status" works.'
+
+. ./test-lib.sh
+
+test_expect_success 'Run status on empty' \
+  'stg status'
+
+test_done
-- 
1.5.3.rc6.31.g3c3b

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [StGit PATCH 2/2] Cleanup tree_status and use -z
  2007-08-30 11:11 [StGit PATCH 1/1] Add basic test for stg status David Kågedal
@ 2007-08-30 11:11 ` David Kågedal
  2007-08-30 12:11   ` Karl Hasselström
  2007-08-30 11:14 ` [StGit PATCH 1/1] Add basic test for stg status David Kågedal
  1 sibling, 1 reply; 7+ messages in thread
From: David Kågedal @ 2007-08-30 11:11 UTC (permalink / raw)
  To: git, catalin.marinas; +Cc: David Kågedal, David Kågedal

From: David KÃ¥gedal <david@virtutech.com>

Improved the python code, eliminating temporary variables and using
destructuring binds. And use NUL-separation instead of newlines.

Signed-off-by: David KÃ¥gedal <davidk@lysator.liu.se>
---
There are still no good test cases for this code, though.

 stgit/commands/patches.py |    2 +-
 stgit/commands/refresh.py |    2 +-
 stgit/git.py              |   22 +++++++++++-----------
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/stgit/commands/patches.py b/stgit/commands/patches.py
index b3defb6..fb65b62 100644
--- a/stgit/commands/patches.py
+++ b/stgit/commands/patches.py
@@ -51,7 +51,7 @@ def func(parser, options, args):
     """Show the patches modifying a file
     """
     if not args:
-        files = [stat[1] for stat in git.tree_status(verbose = True)]
+        files = [path for (stat,path) in git.tree_status(verbose = True)]
     else:
         files = args
 
diff --git a/stgit/commands/refresh.py b/stgit/commands/refresh.py
index 218075b..f44c58c 100644
--- a/stgit/commands/refresh.py
+++ b/stgit/commands/refresh.py
@@ -121,7 +121,7 @@ def func(parser, options, args):
     else:
         sign_str = None
 
-    files = [x[1] for x in git.tree_status(verbose = True)]
+    files = [path for (stat,path) in git.tree_status(verbose = True)]
     if args:
         files = [f for f in files if f in args]
 
diff --git a/stgit/git.py b/stgit/git.py
index 7962cdb..f315b05 100644
--- a/stgit/git.py
+++ b/stgit/git.py
@@ -168,7 +168,7 @@ def exclude_files():
 
 def tree_status(files = None, tree_id = 'HEAD', unknown = False,
                   noexclude = True, verbose = False, diff_flags = []):
-    """Returns a list of pairs - [status, filename]
+    """Returns a list of pairs - (status, filename)
     """
     if verbose:
         out.start('Checking for changes in the working directory')
@@ -181,16 +181,16 @@ def tree_status(files = None, tree_id = 'HEAD', unknown = False,
 
     # unknown files
     if unknown:
-        if noexclude:
-            exclude = []
-        else:
-            exclude = (['--exclude=%s' % s for s in
-                        ['*.[ao]', '*.pyc', '.*', '*~', '#*', 'TAGS', 'tags']]
-                       + ['--exclude-per-directory=.gitignore']
-                       + ['--exclude-from=%s' % fn for fn in exclude_files()
-                          if os.path.exists(fn)])
-        lines = GRun('git-ls-files', '--others', '--directory', *exclude
-                     ).output_lines()
+        cmd = ['git-ls-files', '-z', '--others', '--directory']
+        if not noexclude:
+            cmd += ['--exclude=%s' % s for s in
+                    ['*.[ao]', '*.pyc', '.*', '*~', '#*', 'TAGS', 'tags']]
+            cmd += ['--exclude-per-directory=.gitignore']
+            cmd += ['--exclude-from=%s' % fn
+                    for fn in exclude_files()
+                    if os.path.exists(fn)]
+
+        lines = GRun(*cmd).raw_output().split('\0')
         cache_files += [('?', line) for line in lines]
 
     # conflicted files
-- 
1.5.3.rc6.31.g3c3b

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [StGit PATCH 1/1] Add basic test for stg status
  2007-08-30 11:11 [StGit PATCH 1/1] Add basic test for stg status David Kågedal
  2007-08-30 11:11 ` [StGit PATCH 2/2] Cleanup tree_status and use -z David Kågedal
@ 2007-08-30 11:14 ` David Kågedal
  2007-08-30 11:34   ` David Kågedal
  1 sibling, 1 reply; 7+ messages in thread
From: David Kågedal @ 2007-08-30 11:14 UTC (permalink / raw)
  To: catalin marinas, git

David Kågedal <davidk@lysator.liu.se> writes:

> Signed-off-by: David KÃ¥gedal <davidk@lysator.liu.se>

This was probably confused by the fact that the patch itself contained
my name in latin1 encoding.

-- 
David Kågedal

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [StGit PATCH 1/1] Add basic test for stg status
  2007-08-30 11:14 ` [StGit PATCH 1/1] Add basic test for stg status David Kågedal
@ 2007-08-30 11:34   ` David Kågedal
  2007-08-30 12:07     ` Karl Hasselström
  0 siblings, 1 reply; 7+ messages in thread
From: David Kågedal @ 2007-08-30 11:34 UTC (permalink / raw)
  To: git

David Kågedal <davidk@lysator.liu.se> writes:

> David Kågedal <davidk@lysator.liu.se> writes:
>
>> Signed-off-by: David KÃ¥gedal <davidk@lysator.liu.se>
>
> This was probably confused by the fact that the patch itself contained
> my name in latin1 encoding.

Or not.  It's the same problem as before.  I'll stop using
git-send-email until I or someone else fixes it.

-- 
David Kågedal

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [StGit PATCH 1/1] Add basic test for stg status
  2007-08-30 11:34   ` David Kågedal
@ 2007-08-30 12:07     ` Karl Hasselström
  2007-08-30 12:45       ` David Kågedal
  0 siblings, 1 reply; 7+ messages in thread
From: Karl Hasselström @ 2007-08-30 12:07 UTC (permalink / raw)
  To: David Kågedal; +Cc: git

On 2007-08-30 13:34:19 +0200, David Kågedal wrote:

> David Kågedal <davidk@lysator.liu.se> writes:
>
> > David Kågedal <davidk@lysator.liu.se> writes:
> >
> > > Signed-off-by: David KÃ¥gedal <davidk@lysator.liu.se>
> >
> > This was probably confused by the fact that the patch itself
> > contained my name in latin1 encoding.
>
> Or not. It's the same problem as before. I'll stop using
> git-send-email until I or someone else fixes it.

Try "stg mail", since you are already using StGIT. It used to have
this kind of problem, but it doesn't anymore (at least for me).

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [StGit PATCH 2/2] Cleanup tree_status and use -z
  2007-08-30 11:11 ` [StGit PATCH 2/2] Cleanup tree_status and use -z David Kågedal
@ 2007-08-30 12:11   ` Karl Hasselström
  0 siblings, 0 replies; 7+ messages in thread
From: Karl Hasselström @ 2007-08-30 12:11 UTC (permalink / raw)
  To: David Kågedal; +Cc: git, catalin.marinas, David Kågedal

On 2007-08-30 13:11:10 +0200, David Kågedal wrote:

> Improved the python code, eliminating temporary variables and using
> destructuring binds. And use NUL-separation instead of newlines.

Good changes, both of them. It all looks OK to me (but I haven't tried
to run it yet).

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [StGit PATCH 1/1] Add basic test for stg status
  2007-08-30 12:07     ` Karl Hasselström
@ 2007-08-30 12:45       ` David Kågedal
  0 siblings, 0 replies; 7+ messages in thread
From: David Kågedal @ 2007-08-30 12:45 UTC (permalink / raw)
  To: git

Karl Hasselström <kha@treskal.com> writes:

> On 2007-08-30 13:34:19 +0200, David Kågedal wrote:
>
>> David Kågedal <davidk@lysator.liu.se> writes:
>>
>> > David Kågedal <davidk@lysator.liu.se> writes:
>> >
>> > > Signed-off-by: David KÃ¥gedal <davidk@lysator.liu.se>
>> >
>> > This was probably confused by the fact that the patch itself
>> > contained my name in latin1 encoding.
>>
>> Or not. It's the same problem as before. I'll stop using
>> git-send-email until I or someone else fixes it.
>
> Try "stg mail", since you are already using StGIT. It used to have
> this kind of problem, but it doesn't anymore (at least for me).

Yes, much better. Thank you.

-- 
David Kågedal

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-08-30 12:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-30 11:11 [StGit PATCH 1/1] Add basic test for stg status David Kågedal
2007-08-30 11:11 ` [StGit PATCH 2/2] Cleanup tree_status and use -z David Kågedal
2007-08-30 12:11   ` Karl Hasselström
2007-08-30 11:14 ` [StGit PATCH 1/1] Add basic test for stg status David Kågedal
2007-08-30 11:34   ` David Kågedal
2007-08-30 12:07     ` Karl Hasselström
2007-08-30 12:45       ` David Kågedal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).