git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Add --topo-order flag to git-rev-list
@ 2005-07-02  6:09 Jon Seymour
  2005-07-02  7:56 ` [WITHDRAWN PATCH " Jon Seymour
  0 siblings, 1 reply; 2+ messages in thread
From: Jon Seymour @ 2005-07-02  6:09 UTC (permalink / raw)
  To: git; +Cc: torvalds, jon.seymour


Added a --topo-order flag to git-rev-list.

When this flag is specified, git-rev-list sorts its output
in topological order. That is:

	a is reachable from b ==> ord(b) < ord(a)

This ordering invariant is weaker than the --merge-order invariant
but should be sufficient for tools just as gitk that only
need the minimum guarantee provided by --topo-order.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
---
Note: this patch assumes that my previous patch series that introduces
sort_in_topological_order() to commit.c has been applied.

A subsequent patch to gitk will make gitk use --topo-order instead
of --merge-order.
---

 rev-list.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

804e6b585e205ba119a9a43058d69c2ef914dc80
diff --git a/rev-list.c b/rev-list.c
--- a/rev-list.c
+++ b/rev-list.c
@@ -32,6 +32,7 @@ static int max_count = -1;
 static enum cmit_fmt commit_format = CMIT_FMT_RAW;
 static int merge_order = 0;
 static int show_breaks = 0;
+static int topo_order=0;
 static int stop_traversal = 0;
 static int bisect_by_cut_option = 0;
 
@@ -373,11 +374,15 @@ int main(int argc, char **argv)
 			blob_objects = 1;
 			continue;
 		}
-		if (!strncmp(arg, "--merge-order", 13)) {
+		if (!strcmp(arg, "--merge-order")) {
 		        merge_order = 1;
 			continue;
 		}
-		if (!strncmp(arg, "--show-breaks", 13)) {
+		if (!strcmp(arg, "--topo-order")) {
+		        topo_order = 1;
+			continue;
+		}
+		if (!strcmp(arg, "--show-breaks")) {
 			show_breaks = 1;
 			continue;
 		}
@@ -398,9 +403,12 @@ int main(int argc, char **argv)
 	if (!merge_order) {		
 	        if (limited)
 			list = limit_list(list);
-		if (!bisect_by_cut_option) 
+		if (!bisect_by_cut_option) {
+			if (topo_order) {
+				sort_in_topological_order(&list);
+			}
 			show_commit_list(list);
-		else {
+		} else {
 			sort_in_topological_order(&list);
 			show_commit(bisect_by_cut(list));
 		}
------------

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

* Re: [WITHDRAWN PATCH 1/2] Add --topo-order flag to git-rev-list
  2005-07-02  6:09 [PATCH 1/2] Add --topo-order flag to git-rev-list Jon Seymour
@ 2005-07-02  7:56 ` Jon Seymour
  0 siblings, 0 replies; 2+ messages in thread
From: Jon Seymour @ 2005-07-02  7:56 UTC (permalink / raw)
  To: git; +Cc: torvalds, jon.seymour, Paul Mackerras

Actually, I need to withdraw this patch.

The way show_commit_list works defeats the approach I was using to
perform a topological sort - since show_commit_list does more than
show the list, it also performs a chronological sort on the list,
thereby undoing the topological sort that is attempted.

jon.

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

end of thread, other threads:[~2005-07-02  7:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-02  6:09 [PATCH 1/2] Add --topo-order flag to git-rev-list Jon Seymour
2005-07-02  7:56 ` [WITHDRAWN PATCH " Jon Seymour

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