Skip to contentSkip to conversation

cg-log patches

DISCUSSION Sean 4 participants 17 messages Jun 15, 2016 3 messages not in the archive

lore
Share & tools
lore

Sean

author
#0 lore raw

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

#1 lore raw

Hi Sean,

Quoted 10 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

author
#2 lore raw
Quoted 2 lines · Marcel Holtmann

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

#3 lore raw

Hi Sean,

Quoted 7 lines
Quoted 2 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

#4 lore raw

Dear diary, on Sun, May 08, 2005 at 09:00:07PM CEST, I got a letter where Marcel Holtmann <[email protected]> told me that...

Quoted 10 lines

Hi Sean,

Quoted 7 lines
Quoted 2 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.

Quoted 7 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?

Signature · 3 lines
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
#5 lore raw

Hi Petr,

Quoted 7 lines
Quoted 4 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

author
#6 lore raw
In reply to Petr Baudis
Quoted 11 lines · Petr Baudis
Quoted 7 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

#7 lore raw

Dear diary, on Sun, May 08, 2005 at 09:23:50PM CEST, I got a letter where Sean <[email protected]> told me that...

Quoted 21 lines · Petr Baudis
Quoted 4 lines
Quoted 4 lines

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

Quoted 8 lines
Quoted 4 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?

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:

Quoted 7 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?

Thanks,

Signature · 3 lines
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
author
#8 lore raw
Quoted 12 lines · Petr Baudis
Quoted 8 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

A message that is not in the archive (sent off-list or not yet received): 1792.10.10.10.24.1115575196.squirrel@linux1

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 1896.10.10.10.24.1115577733.squirrel@linux1

#12 lore raw

Dear diary, on Sun, May 08, 2005 at 08:42:13PM CEST, I got a letter where Sean <[email protected]> told me that...

Quoted 7 lines · Petr Baudis
Quoted 2 lines

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.

Quoted 1 line

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.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

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,

Signature · 3 lines
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
#13 lore raw
In reply to Sean

Sean <[email protected]> wrote Sun, May 08, 2005:

Quoted 4 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.

This sounds great.

Quoted 2 lines

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

Quoted 2 lines

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.

cg-log (mode:100755) +9 -1
@@ -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:"
 }
Signature · 1 line
Jonas Fonseca
author
#14 lore raw

On Sun, May 8, 2005 7:49 pm, Jonas Fonseca said:

Hey Jonas,

Quoted 4 lines
Quoted 2 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.

Quoted 2 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_.

Quoted 5 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

#15 lore raw

Sean <[email protected]> wrote Sun, May 08, 2005:

Quoted 2 lines · Jonas Fonseca

Hey Jonas,

Hi Sean,

Quoted 7 lines
Quoted 4 lines
Quoted 2 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.

Quoted 5 lines
Quoted 2 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.

Signature · 1 line
Jonas Fonseca

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

---
commit 06a6b40f8e52eff0e34706c7024b54df50abb6b9
tree 95bc73fd188347aa294991d1c5c7cffd60422098
parent 4ed293bc0a5ffca9683e139cad499b69a4c4d569
author jonas <[email protected]> Mon, 09 May 2005 13:23:20 +0200 committer jonas <[email protected]> Mon, 09 May 2005 13:23:20 +0200

 cg-log |   34 +++++++++++++++-------------------
 1 files changed, 15 insertions(+), 19 deletions(-)
cg-log (mode:100755) +15 -19
Index: cg-log
===================================================================
@@ -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.

---
commit 9d86f44f7d1eee525ed4c45731ad07b95f62dbb6
tree ddf82a0140bdc1440eb93bcbe01e14e90e44a3e8
parent 06a6b40f8e52eff0e34706c7024b54df50abb6b9
author jonas <[email protected]> Mon, 09 May 2005 13:27:20 +0200 committer jonas <[email protected]> Mon, 09 May 2005 13:27:20 +0200

 cg-log |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletion(-)
cg-log (mode:100755) +9 -1
Index: cg-log
===================================================================
@@ -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:"
 }
#16 lore raw

Dear diary, on Mon, May 09, 2005 at 01:39:07PM CEST, I got a letter where Jonas Fonseca <[email protected]> told me that...

Quoted 5 lines

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

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.

Quoted 12 lines

Index: cg-log
===================================================================

cg-log (mode:100755) +2 -1
@@ -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

cg-log (mode:100755) line 82

Quoted 10 lines
cg-log (mode:100755) +7 -0
+ 			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?

Signature · 3 lines
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
#17 lore raw

Petr Baudis <[email protected]> wrote Mon, May 09, 2005:

Quoted 14 lines

Dear diary, on Mon, May 09, 2005 at 01:39:07PM CEST, I got a letter where Jonas Fonseca <[email protected]> told me that...

Quoted 5 lines

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

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.

Quoted 6 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

Ok, forget the patch then. I was not sure how to handle the multiple parents.

Quoted 9 lines

cg-log (mode:100755) line 70

Quoted 9 lines

Index: cg-log
===================================================================

cg-log (mode:100755) +0 -1
@@ -67,8 +67,16 @@
 		done
 	fi | sort -u | \
 	while read modes type sha1s file; do
-		echo -n "$sep$file"

# Always put a trailing comma

Quoted 7 lines
Quoted 7 lines
cg-log (mode:100755) +6 -0
+		echo -n "$sep"
 		sep=", "
+ 		if [ $(echo "$line$sep$file" | wc -c) -lt 75 ]; then
+ 			line="$line$sep$file"
+ 			echo -n "$file"
+ 		else
+ 			line="$file"
Quoted 8 lines

cg-log (mode:100755) line 82

Quoted 6 lines
cg-log (mode:100755) +3 -0
+ 			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 <[email protected]> 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:

Signature · 1 line
Jonas Fonseca
#18 lore raw
In reply to Petr Baudis

Dear diary, on Mon, May 09, 2005 at 02:14:35PM CEST, I got a letter where Petr Baudis <[email protected]> told me that...

Quoted 17 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 ---+--
Quoted 7 lines

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.

Signature · 3 lines
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
author
#19 lore raw
In reply to Petr Baudis
Quoted 9 lines · Petr Baudis

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