threads / discuss / 535

cg-log patches

Subject: cg-log patches

## tl;dr

17 messages between May 8, 2005 and May 10, 2005.

replies: 16people: 4as markdown or json

Sean· May 8, 2005, 17:35 UTC · lore
Hi Petr,

A few minor cg-log patches outlined below available for you at: http://git.homelinux.com/cogito

commit ce5e8e645754f3051ce3b3cf87c085544339acef
    Permit cg-log command line options to be given in any order
commit a1c2b474ad39750a07a43ddee2682f5613624652
    Make sure that CC: and From: lines are picked up as a valid
    part of the sign off process and given the proper color
commit 33762f33ee87377c0cfcea51382bad04d7c9ba8d
    Fix cg-log -f option so that a complete list of files is
    displayed when a commit has more than one parent.
    Move the list of files so they're displayed after the
    commit message
    List the files in columns, instead of one big line of comma-
    separated files.
---
cg-log | 135
++++++++++++++++++++++++++---------------------------------------
 1 files changed, 56 insertions(+), 79 deletions(-)

Cheers, Sean

Marcel Holtmann· May 8, 2005, 17:42 UTC · re: Sean · lore

Re: cg-log patches

Hi Sean,
Show 10 quoted lines
> commit 33762f33ee87377c0cfcea51382bad04d7c9ba8d
> 
>     Fix cg-log -f option so that a complete list of files is
>     displayed when a commit has more than one parent.
> 
>     Move the list of files so they're displayed after the
>     commit message
> 
>     List the files in columns, instead of one big line of comma-
>     separated files.

why don't you use diffstat for it? I think that it is more handy then the list of modified files.

Regards
Marcel
Sean· May 8, 2005, 18:26 UTC · re: Marcel Holtmann · lore

Re: cg-log patches

On Sun, May 8, 2005 1:42 pm, Marcel Holtmann said:
> why don't you use diffstat for it? I think that it is more handy then
> the list of modified files.
Hi Marcel,

Is a good idea, but would be a fair bit harder to generate unfortunately. Right now the blobs themselves don't have to be opened and inspected, just the commit trees. Actually, i'm not sure exactly how you'd even go about generating a correct diffstat for commits that have multiple parents.

Sean
Marcel Holtmann· May 8, 2005, 19:00 UTC · re: Sean · lore

Re: cg-log patches

Hi Sean,
Show 7 quoted lines
> > why don't you use diffstat for it? I think that it is more handy then
> > the list of modified files.
> 
> Is a good idea, but would be a fair bit harder to generate unfortunately. 
> Right now the blobs themselves don't have to be opened and inspected, just
> the commit trees.   Actually, i'm not sure exactly how you'd even go about
> generating a correct diffstat for commits that have multiple parents.

I am not a really good git expert, but maybe another option for it would be fine.

However there is another thing that I am missing. With Bitkeeper I was able to do something like "bk changes -umarcel" to list all changes done by the user "marcel". I like to have something similar with cg-log. Any ideas on how to do that?

Regards
Marcel
Petr Baudis· May 8, 2005, 19:18 UTC · re: Marcel Holtmann · lore

Re: cg-log patches

Dear diary, on Sun, May 08, 2005 at 09:00:07PM CEST, I got a letter where Marcel Holtmann <marcel@holtmann.org> told me that...

Show 17 quoted lines
> Hi Sean,
> 
> > > why don't you use diffstat for it? I think that it is more handy then
> > > the list of modified files.
> > 
> > Is a good idea, but would be a fair bit harder to generate unfortunately. 
> > Right now the blobs themselves don't have to be opened and inspected, just
> > the commit trees.   Actually, i'm not sure exactly how you'd even go about
> > generating a correct diffstat for commits that have multiple parents.
> 
> I am not a really good git expert, but maybe another option for it would
> be fine.
> 
> However there is another thing that I am missing. With Bitkeeper I was
> able to do something like "bk changes -umarcel" to list all changes done
> by the user "marcel". I like to have something similar with cg-log. Any
> ideas on how to do that?

What should it take in regard? Username portion of the email address? The email address itself? The realname?

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
Sean· May 8, 2005, 19:23 UTC · re: Petr Baudis · lore

Re: cg-log patches

On Sun, May 8, 2005 3:18 pm, Petr Baudis said:
Show 11 quoted lines
>> I am not a really good git expert, but maybe another option for it would
>> be fine.
>>
>> However there is another thing that I am missing. With Bitkeeper I was
>> able to do something like "bk changes -umarcel" to list all changes done
>> by the user "marcel". I like to have something similar with cg-log. Any
>> ideas on how to do that?
>
> What should it take in regard? Username portion of the email address?
> The email address itself? The realname?
>

Attached is a new version of cg-log that includes a -u option that takes a single parameter. Whatever you put in that parameter will be searched in the author line, so it can be part or all of an authors name and/or email address.

So you could do:
cg-log -c -f -u petr
or
cg-log -uxpasky
Sean
Petr Baudis· May 8, 2005, 19:25 UTC · re: Sean · lore

Re: cg-log patches

Dear diary, on Sun, May 08, 2005 at 09:23:50PM CEST, I got a letter where Sean <seanlkml@sympatico.ca> told me that...

Show 28 quoted lines
> On Sun, May 8, 2005 3:18 pm, Petr Baudis said:
> 
> >> I am not a really good git expert, but maybe another option for it would
> >> be fine.
> >>
> >> However there is another thing that I am missing. With Bitkeeper I was
> >> able to do something like "bk changes -umarcel" to list all changes done
> >> by the user "marcel". I like to have something similar with cg-log. Any
> >> ideas on how to do that?
> >
> > What should it take in regard? Username portion of the email address?
> > The email address itself? The realname?
> >
> 
> Attached is a new version of cg-log that includes a -u option that takes a
> single parameter.   Whatever you put in that parameter will be searched in
> the author line, so it can be part or all of an authors name and/or email
> address.
> 
> So you could do:
> 
> cg-log -c -f -u petr
> 
> or
> 
> cg-log -uxpasky
> 
> Sean

That sounds great. Could you please post a patch against the current Cogito's cg-log?

Thanks,
-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
Sean· May 8, 2005, 19:52 UTC · re: Petr Baudis · lore

Re: cg-log patches

On Sun, May 8, 2005 3:25 pm, Petr Baudis said:
Show 12 quoted lines
>>
>> cg-log -c -f -u petr
>>
>> or
>>
>> cg-log -uxpasky
>>
>> Sean
>
> That sounds great. Could you please post a patch against the current
> Cogito's cg-log?
>
Hey Petr,

Sorry it relies on other patches in a series. If you're interested in them they're available from:

http://git.homelinux.com/cogito

Actually, if you look you'll see I renamed the option -a and added help so that it shows up on -h or --help.

Cheers, Sean

Marcel Holtmann· May 8, 2005, 19:27 UTC · re: Petr Baudis · lore

Re: cg-log patches

Hi Petr,
Show 7 quoted lines
> > However there is another thing that I am missing. With Bitkeeper I was
> > able to do something like "bk changes -umarcel" to list all changes done
> > by the user "marcel". I like to have something similar with cg-log. Any
> > ideas on how to do that?
> 
> What should it take in regard? Username portion of the email address?
> The email address itself? The realname?

good question. Bitkeeper was only able to handle the user part of the address. Maybe we can make cg-log a little bit more intelligent. We also have the author and the committer. My idea would be to use -A for the author and -C for the committer and maybe -U to search in both. If the value contains and "@" it should search in the email address part and otherwise in the username portion. Some regular expression stuff like "^marcel" (case insensitive) would also be great.

I have no idea how to realize it, but would be thankful for such an option. It is one of the last pieces that I miss.

Regards
Marcel
Jonas Fonseca· May 8, 2005, 23:49 UTC · re: Sean · lore

Re: cg-log patches

Sean <seanlkml@sympatico.ca> wrote Sun, May 08, 2005:
> commit 33762f33ee87377c0cfcea51382bad04d7c9ba8d
> 
>     Fix cg-log -f option so that a complete list of files is
>     displayed when a commit has more than one parent.
This sounds great.
>     Move the list of files so they're displayed after the
>     commit message

The reason I put it at the top was to make it more similar to GNU-style changelogs (if there is such a style).

>     List the files in columns, instead of one big line of comma-
>     separated files.
I think that will make `-f' less usable because of the extra scrolling.

Assuming use of wc will not create more dependency nightmares and the extra overhead is acceptable here is a patch that will wrap file listing lines near the 80th column.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>

--- d4119364a7fbf5a4b8f00f061e4f5d58fa4abd0e/cg-log (mode:100755) +++ uncommitted/cg-log (mode:100755)

@@ -64,8 +64,16 @@
 	fi
 	echo
 	$list_cmd | while read modes type sha1s file; do
-		echo -n "$sep$file"
+		echo -n "$sep"
 		sep=", "
+		if [ $(echo "$line$sep$file" | wc -c) -lt 75 ]; then
+			line="$line$sep$file"
+			echo -n "$file"
+		else
+			line="$file"
+			echo "$coldefault"
+			echo -n "    $colfiles$file"
+		fi
 	done
 	echo "$coldefault:"
 }
-- 
Jonas Fonseca
Sean· May 9, 2005, 03:45 UTC · re: Jonas Fonseca · lore

Re: cg-log patches

On Sun, May 8, 2005 7:49 pm, Jonas Fonseca said:
Hey Jonas,
>>     Fix cg-log -f option so that a complete list of files is
>>     displayed when a commit has more than one parent.
>
> This sounds great.

You might want to rip it out and submit it, because it's not likely to see the light of day otherwise.

> The reason I put it at the top was to make it more similar to GNU-style
> changelogs (if there is such a style).

Yeah, I felt a bit guilty sliding that shift in, really I had no rationale other than it looked better _to me_.

Show 5 quoted lines
> I think that will make `-f' less usable because of the extra scrolling.
>
> Assuming use of wc will not create more dependency nightmares and the
> extra overhead is acceptable here is a patch that will wrap file listing
> lines near the 80th column.

Your patch will work fine but I did test my version out against the kernel repo and it didn't seem to be a problem.

Cheers, Sean

Jonas Fonseca· May 9, 2005, 11:39 UTC · re: Sean · lore

Re: cg-log patches

Sean <seanlkml@sympatico.ca> wrote Sun, May 08, 2005:
> On Sun, May 8, 2005 7:49 pm, Jonas Fonseca said:
> Hey Jonas,
Hi Sean,
Show 7 quoted lines
> >>     Fix cg-log -f option so that a complete list of files is
> >>     displayed when a commit has more than one parent.
> >
> > This sounds great.
> 
> You might want to rip it out and submit it, because it's not likely to see
> the light of day otherwise.
I ripped it out and made a patch only with the fix.
Pasky, I also updated the line-wrapping patch if you want it.
Show 5 quoted lines
> > The reason I put it at the top was to make it more similar to GNU-style
> > changelogs (if there is such a style).
> 
> Yeah, I felt a bit guilty sliding that shift in, really I had no rationale
> other than it looked better _to me_.

I don't feel strong about it. I guess I have just gotten used to it that way.

-- 
Jonas Fonseca


Fix cg-log -f option so that a complete list of files is
displayed when a commit has more than one parent.

Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca>
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>

---
commit 06a6b40f8e52eff0e34706c7024b54df50abb6b9
tree 95bc73fd188347aa294991d1c5c7cffd60422098
parent 4ed293bc0a5ffca9683e139cad499b69a4c4d569
author jonas <fonseca@diku.dk> Mon, 09 May 2005 13:23:20 +0200
committer jonas <fonseca@diku.dk> Mon, 09 May 2005 13:23:20 +0200

 cg-log |   34 +++++++++++++++-------------------
 1 files changed, 15 insertions(+), 19 deletions(-)

Index: cg-log
===================================================================
--- 00b94eea5b99d5dd1d1bbe9c9ca3502d11aec581/cg-log  (mode:100755)
+++ 95bc73fd188347aa294991d1c5c7cffd60422098/cg-log  (mode:100755)
@@ -53,17 +53,20 @@
 
 list_commit_files()
 {
-	tree1="$1"
-	tree2="$2"
+	tree="$1"
 	sep="    * $colfiles"
-	# List all files for for the initial commit
-	if [ -z $tree2 ]; then
-		list_cmd="git-ls-tree $tree1"
-	else
-		list_cmd="git-diff-tree -r $tree1 $tree2"
-	fi
 	echo
-	$list_cmd | while read modes type sha1s file; do
+	if [ -z $2 ]; then
+		# List all files for the initial commit
+		git-ls-tree $tree
+	else
+		shift
+		# List changes from each parent
+		for parent; do
+			git-diff-tree -r $tree $parent
+		done
+	fi | sort -u | \
+	while read modes type sha1s file; do
 		echo -n "$sep$file"
 		sep=", "
 	done
@@ -102,8 +105,7 @@
 
 $revls | $revsort | while read time commit parents; do
 	trap exit SIGPIPE
-	tree1=
-	tree2=
+	trees=
 	[ "$revfmt" = "git-rev-list" ] && commit="$time"
 	if [ $# -ne 0 ]; then
 		parent=$(git-cat-file commit $commit | sed -n '2s/parent //p;2Q')
@@ -131,17 +133,11 @@
 				fi
 				;;
 			"tree"|"parent")
-				if [ -z $tree1 ]; then
-					tree1=$rest
-				elif [ -z $tree2 ]; then
-					tree2=$rest
-				fi
+				trees="$trees $rest"
 				echo $colheader$key $rest $coldefault
 				;;
 			"")
-				if [ -n "$list_files" ]; then
-					list_commit_files "$tree1" "$tree2"
-				fi
+				[ -n "$list_files" ] && list_commit_files $trees
 				echo; sed -re '
 					/ *Signed-off-by:.*/Is//'$colsignoff'&'$coldefault'/
 					/ *Acked-by:.*/Is//'$colsignoff'&'$coldefault'/


Wrap file listing lines near the 80th column.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>

---
commit 9d86f44f7d1eee525ed4c45731ad07b95f62dbb6
tree ddf82a0140bdc1440eb93bcbe01e14e90e44a3e8
parent 06a6b40f8e52eff0e34706c7024b54df50abb6b9
author jonas <fonseca@diku.dk> Mon, 09 May 2005 13:27:20 +0200
committer jonas <fonseca@diku.dk> Mon, 09 May 2005 13:27:20 +0200

 cg-log |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletion(-)

Index: cg-log
===================================================================
--- 95bc73fd188347aa294991d1c5c7cffd60422098/cg-log  (mode:100755)
+++ ddf82a0140bdc1440eb93bcbe01e14e90e44a3e8/cg-log  (mode:100755)
@@ -67,8 +67,16 @@
 		done
 	fi | sort -u | \
 	while read modes type sha1s file; do
-		echo -n "$sep$file"
+		echo -n "$sep"
 		sep=", "
+ 		if [ $(echo "$line$sep$file" | wc -c) -lt 75 ]; then
+ 			line="$line$sep$file"
+ 			echo -n "$file"
+ 		else
+ 			line="$file"
+ 			echo "$coldefault"
+ 			echo -n "    $colfiles$file"
+ 		fi
 	done
 	echo "$coldefault:"
 }
Petr Baudis· May 9, 2005, 12:14 UTC · re: Jonas Fonseca · lore

Re: cg-log patches

Dear diary, on Mon, May 09, 2005 at 01:39:07PM CEST, I got a letter where Jonas Fonseca <fonseca@diku.dk> told me that...

Show 5 quoted lines
> Fix cg-log -f option so that a complete list of files is
> displayed when a commit has more than one parent.
> 
> Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca>
> Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
But that makes no sense, since each merge will have enormous amount of
files listed, making no sense. E.g. each merge of Cogito with Linus will
have all the Cogito files listed, since they aren't in the Linus branch
- but that's wrong, since the merge _to_ the Cogito branch concerns no
Cogito files.

In git, the parents list is unordered. But this is different in Cogito, where the first parent _is_ special. If you are merging _from_ branch B _to_ branch A, the order of parents will be always

parent A parent B

In practice, it does not make too much difference, but this is one of the cases where it makes difference. So I think the current behaviour is right.

BTW, this also implies that merges
  A --
      \
  B ---+--
and
  A ---+--
      /
  B --

are considered as different ones by Cogito; in git itself, you might model that as

  A --.
       >---
  B --'

which is not possible in Cogito. I could imagine doing it by e.g. passing cg-clone multiple arguments, but I'd have to first see a compelling real-world usage for this first.

Show 22 quoted lines
> Index: cg-log
> ===================================================================
> --- 95bc73fd188347aa294991d1c5c7cffd60422098/cg-log  (mode:100755)
> +++ ddf82a0140bdc1440eb93bcbe01e14e90e44a3e8/cg-log  (mode:100755)
> @@ -67,8 +67,16 @@
>  		done
>  	fi | sort -u | \
>  	while read modes type sha1s file; do
> -		echo -n "$sep$file"
> +		echo -n "$sep"
>  		sep=", "
> + 		if [ $(echo "$line$sep$file" | wc -c) -lt 75 ]; then
> + 			line="$line$sep$file"
> + 			echo -n "$file"
> + 		else
> + 			line="$file"
> + 			echo "$coldefault"
> + 			echo -n "    $colfiles$file"
> + 		fi
>  	done
>  	echo "$coldefault:"
>  }
Could we have a trailing comma at the previous line?
-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
Jonas Fonseca· May 9, 2005, 12:41 UTC · re: Petr Baudis · lore

Re: cg-log patches

Petr Baudis <pasky@ucw.cz> wrote Mon, May 09, 2005:
Show 20 quoted lines
> Dear diary, on Mon, May 09, 2005 at 01:39:07PM CEST, I got a letter
> where Jonas Fonseca <fonseca@diku.dk> told me that...
> > Fix cg-log -f option so that a complete list of files is
> > displayed when a commit has more than one parent.
> > 
> > Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca>
> > Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
> 
> But that makes no sense, since each merge will have enormous amount of
> files listed, making no sense. E.g. each merge of Cogito with Linus will
> have all the Cogito files listed, since they aren't in the Linus branch
> - but that's wrong, since the merge _to_ the Cogito branch concerns no
> Cogito files.
>
> In git, the parents list is unordered. But this is different in Cogito,
> where the first parent _is_ special. If you are merging _from_ branch B
> _to_ branch A, the order of parents will be always
> 
> parent A
> parent B
Ok, forget the patch then. I was not sure how to handle the multiple parents.
Show 9 quoted lines
> > Index: cg-log
> > ===================================================================
> > --- 95bc73fd188347aa294991d1c5c7cffd60422098/cg-log  (mode:100755)
> > +++ ddf82a0140bdc1440eb93bcbe01e14e90e44a3e8/cg-log  (mode:100755)
> > @@ -67,8 +67,16 @@
> >  		done
> >  	fi | sort -u | \
> >  	while read modes type sha1s file; do
> > -		echo -n "$sep$file"
		# Always put a trailing comma
Show 15 quoted lines
> > +		echo -n "$sep"
> >  		sep=", "
> > + 		if [ $(echo "$line$sep$file" | wc -c) -lt 75 ]; then
> > + 			line="$line$sep$file"
> > + 			echo -n "$file"
> > + 		else
> > + 			line="$file"
> > + 			echo "$coldefault"
> > + 			echo -n "    $colfiles$file"
> > + 		fi
> >  	done
> >  	echo "$coldefault:"
> >  }
> 
> Could we have a trailing comma at the previous line?
It should already do that ..
committer Petr Baudis <xpasky@machine.sinus.cz> Sun, 08 May 2005 23:54:08 +0200
    * cg-Xlib, cg-update, cg-seek, cg-pull, cg-tag-ls, cg-branch-ls, cg-merge,
    cg-commit, cg-tag, cg-init, cg-branch-add, cg-admin-lsobj, cg-status,
    cg-cancel, cg-admin-uncommit:
-- 
Jonas Fonseca
Sean· May 9, 2005, 13:13 UTC · re: Petr Baudis · lore

Re: cg-log patches

On Mon, May 9, 2005 8:14 am, Petr Baudis said:
Show 9 quoted lines
> But that makes no sense, since each merge will have enormous amount of
> files listed, making no sense. E.g. each merge of Cogito with Linus will
> have all the Cogito files listed, since they aren't in the Linus branch
> - but that's wrong, since the merge _to_ the Cogito branch concerns no
> Cogito files.
>
> In git, the parents list is unordered. But this is different in Cogito,
> where the first parent _is_ special. If you are merging _from_ branch B
> _to_ branch A, the order of parents will be always
But, there are commits (even in your tree) that aren't produced by Cogito.
 And the current logic gets them wrong.
Look at commit:  211232bae64bcc60bbf5d1b5e5b2344c22ed767e in your tree.

The current logic will miss the fact that one of the other parents altered, git-apply-patch-script. Seems better to over report, than under report changes, although I agree that some way must be found to handle the merge case.

Sean
Petr Baudis· May 10, 2005, 00:37 UTC · re: Petr Baudis · lore

Re: cg-log patches

Dear diary, on Mon, May 09, 2005 at 02:14:35PM CEST, I got a letter where Petr Baudis <pasky@ucw.cz> told me that...

Show 24 quoted lines
> In git, the parents list is unordered. But this is different in Cogito,
> where the first parent _is_ special. If you are merging _from_ branch B
> _to_ branch A, the order of parents will be always
> 
> parent A
> parent B
> 
> In practice, it does not make too much difference, but this is one of
> the cases where it makes difference. So I think the current behaviour is
> right.
> 
> BTW, this also implies that merges
> 
>   A --
>       \
>   B ---+--
> 
> and
> 
>   A ---+--
>       /
>   B --
> 
> are considered as different ones by Cogito
Ok. So you do
A ---+--
    /
B --
and now merge A to B, which results in fast-forward and
A ---+----
    /  \
B --    --
but when doing cg-log in B, the merge is the wrong way around now.

Sean counterexample works too, it's a good thing to maintain compatibility with git at this one too.

Still, I would like to have the files list separated. What about one bullet per parent? Like

    * asdf, hjkl, xyzzy
    * hjkl, quux
for a regular two-parents merge.
-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
Petr Baudis· May 8, 2005, 19:01 UTC · lore

Re: cg-log patches

Dear diary, on Sun, May 08, 2005 at 08:42:13PM CEST, I got a letter where Sean <seanlkml@sympatico.ca> told me that...

Show 7 quoted lines
> On Sun, May 8, 2005 2:03 pm, Petr Baudis said:
> 
> > do you think you could also send the patches by mail, please?
> 
> Yes, attached.  But i'm hoping you'll accept them from my .git repository
> so that I can keep my own repository consistent, without conflicts from my
> own patches being pulled back in from you with different commit id's.
Different commit id's shouldn't make much difference w.r.t. conflicts.
> Is there a problem with just using cogito to manage the patches?

No problem if I decide to accept all of your patches. But that's what I need to find out by reviewing the patches, and when I have any comments, I want to point them out easily in the context of the patch.

 From this viewpoint the cumulative patch you've sent is unfortunately
useless - I need it broken to the commits, in separate mails, and either
as text/plain attachments or inline, please.
Show 7 quoted lines
> >> What do you use to publish a repository?
> >
> > What do you mean?
> 
> Well, I just copied the .git directory and everything under it up to the
> website.   But I wondered if there was a cg-push or something similar
> which would handle things a little better.  No biggy.

Nothing like that so far. It should be possible with the ssh protocol relatively easily, and doable with rsync (although the locking is going to be pretty be hard).

Thanks,
-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor

← back to recent threads