# [PATCH] gitview: revamped to use string.join, stripped a function def

4 messages from 2007-09-27 to 2007-11-21. Participants: Denis Cheng, rae l, Vineet Kumar, Junio C Hamano.
Thread: https://gitlist.dev/t/10053

## Denis Cheng, 2007-09-27 19:55

Subject: [PATCH] gitview: revamped to use string.join, stripped a function def
Message-ID: <1190922917-5044-1-git-send-email-crquan@gmail.com>
URL: https://gitlist.dev/e/1190922917-5044-1-git-send-email-crquan%40gmail.com

```
Signed-off-by: Denis Cheng <crquan@gmail.com>
---
 contrib/gitview/gitview |   13 +------------
 1 files changed, 1 insertions(+), 12 deletions(-)

diff --git a/contrib/gitview/gitview b/contrib/gitview/gitview
index 5931766..2eb72b1 100755
--- a/contrib/gitview/gitview
+++ b/contrib/gitview/gitview
@@ -36,17 +36,6 @@ except ImportError:
 
 re_ident = re.compile('(author|committer) (?P<ident>.*) (?P<epoch>\d+) (?P<tz>[+-]\d{4})')
 
-def list_to_string(args, skip):
-	count = len(args)
-	i = skip
-	str_arg=" "
-	while (i < count ):
-		str_arg = str_arg + args[i]
-		str_arg = str_arg + " "
-		i = i+1
-
-	return str_arg
-
 def show_date(epoch, tz):
 	secs = float(epoch)
 	tzsecs = float(tz[1:3]) * 3600
@@ -1115,7 +1104,7 @@ class GitView(object):
 
 	def set_branch(self, args):
 		"""Fill in different windows with info from the reposiroty"""
-		fp = os.popen("git rev-parse --sq --default HEAD " + list_to_string(args, 1))
+		fp = os.popen("git rev-parse --sq --default HEAD " + " ".join(args[1:]))
 		git_rev_list_cmd = fp.read()
 		fp.close()
 		fp = os.popen("git rev-list  --header --topo-order --parents " + git_rev_list_cmd)
-- 
1.5.3.2

```

## rae l, 2007-11-21 05:19

Subject: Re: [PATCH] gitview: revamped to use string.join, stripped a function def
Message-ID: <91b13c310711202119j4f9e20f0n2515babe5f9217ac@mail.gmail.com>
URL: https://gitlist.dev/e/91b13c310711202119j4f9e20f0n2515babe5f9217ac%40mail.gmail.com
In-Reply-To: <1190922917-5044-1-git-send-email-crquan@gmail.com>

```
Please give some comments.

On Sep 28, 2007 3:55 AM, Denis Cheng <crquan@gmail.com> wrote:
> Signed-off-by: Denis Cheng <crquan@gmail.com>
> ---
>  contrib/gitview/gitview |   13 +------------
>  1 files changed, 1 insertions(+), 12 deletions(-)
>
> diff --git a/contrib/gitview/gitview b/contrib/gitview/gitview
> index 5931766..2eb72b1 100755
> --- a/contrib/gitview/gitview
> +++ b/contrib/gitview/gitview
> @@ -36,17 +36,6 @@ except ImportError:
>
>  re_ident = re.compile('(author|committer) (?P<ident>.*) (?P<epoch>\d+) (?P<tz>[+-]\d{4})')
>
> -def list_to_string(args, skip):
> -       count = len(args)
> -       i = skip
> -       str_arg=" "
> -       while (i < count ):
> -               str_arg = str_arg + args[i]
> -               str_arg = str_arg + " "
> -               i = i+1
> -
> -       return str_arg
> -
>  def show_date(epoch, tz):
>         secs = float(epoch)
>         tzsecs = float(tz[1:3]) * 3600
> @@ -1115,7 +1104,7 @@ class GitView(object):
>
>         def set_branch(self, args):
>                 """Fill in different windows with info from the reposiroty"""
> -               fp = os.popen("git rev-parse --sq --default HEAD " + list_to_string(args, 1))
> +               fp = os.popen("git rev-parse --sq --default HEAD " + " ".join(args[1:]))
>                 git_rev_list_cmd = fp.read()
>                 fp.close()
>                 fp = os.popen("git rev-list  --header --topo-order --parents " + git_rev_list_cmd)
> --
> 1.5.3.2

-- 
Cheng

```

## Vineet Kumar, 2007-11-21 06:23

Subject: Re: [PATCH] gitview: revamped to use string.join, stripped a function def
Message-ID: <20071121062303.GA24495@doorstop.net>
URL: https://gitlist.dev/e/20071121062303.GA24495%40doorstop.net
In-Reply-To: <91b13c310711202119j4f9e20f0n2515babe5f9217ac@mail.gmail.com>

```
* rae l (crquan@gmail.com) [071120 21:19]:
> Please give some comments.

Well I'm just an outside observer, but it looks like a good change to
me.

-- 
http://www.doorstop.net/

```

## Junio C Hamano, 2007-11-21 06:50

Subject: Re: [PATCH] gitview: revamped to use string.join, stripped a function def
Message-ID: <7vfxz0hz2a.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vfxz0hz2a.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <91b13c310711202119j4f9e20f0n2515babe5f9217ac@mail.gmail.com>

```
"rae l" <crquan@gmail.com> writes:

> Please give some comments.
>
> On Sep 28, 2007 3:55 AM, Denis Cheng <crquan@gmail.com> wrote:
>> Signed-off-by: Denis Cheng <crquan@gmail.com>

Blast from the past ;-).

>> -def list_to_string(args, skip):
>> -       count = len(args)
>> -       i = skip
>> -       str_arg=" "
>> -       while (i < count ):
>> -               str_arg = str_arg + args[i]
>> -               str_arg = str_arg + " "
>> -               i = i+1
>> -
>> -       return str_arg
>> ... 
>>                 """Fill in different windows with info from the reposiroty"""
>> -               fp = os.popen("git rev-parse --sq --default HEAD " + list_to_string(args, 1))
>> +               fp = os.popen("git rev-parse --sq --default HEAD " + " ".join(args[1:]))

Obviously correct, loses extra SPs on both ends of the args
string, and reads more Pythonic.

```
