@matheusbsbs / matheus-bagliano / commits / 9dcc829fe1
Fork 0

Retire rev-tree.

Some old scripts might still use git-rev-tree, but it really is clearly inferior in every way to git-rev-list that such scripts should be fixed anyway. Fixing them should be pretty easy. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Sep 16, 2005 at 22:30 UTC 9dcc829fe13b7c843a1df6c38479d5b8b8c7d20f
6 files changed +3 -235
.gitignore
-1
@@ -69,7 +69,6 @@ git-reset
69 git-resolve
70 git-rev-list
71 git-rev-parse
72 -git-rev-tree
72 git-revert
73 git-send-email
74 git-send-pack
Documentation/git-rev-tree.txt deleted
-88
@@ -1,88 +0,0 @@
1 -git-rev-tree(1)
2 -===============
3 -v0.1, May 2005
4 -
5 -NAME
6 -----
7 -git-rev-tree - Provides the revision tree for one or more commits
8 -
9 -
10 -SYNOPSIS
11 ---------
12 -'git-rev-tree' [--edges] [--cache <cache-file>] [^]<commit> [[^]<commit>]
13 -
14 -DESCRIPTION
15 ------------
16 -Provides the revision tree for one or more commits.
17 -
18 -OPTIONS
19 --------
20 ---edges::
21 - Show edges (ie places where the marking changes between parent
22 - and child)
23 -
24 ---cache <cache-file>::
25 - Use the specified file as a cache from a previous git-rev-list run
26 - to speed things up. Note that this "cache" is totally different
27 - concept from the directory index. Also this option is not
28 - implemented yet.
29 -
30 -[^]<commit>::
31 - The commit id to trace (a leading caret means to ignore this
32 - commit-id and below)
33 -
34 -Output
35 -------
36 -
37 - <date> <commit>:<flags> [<parent-commit>:<flags> ]\*
38 -
39 -<date>::
40 - Date in 'seconds since epoch'
41 -
42 -<commit>::
43 - id of commit object
44 -
45 -<parent-commit>::
46 - id of each parent commit object (>1 indicates a merge)
47 -
48 -<flags>::
49 -
50 - The flags are read as a bitmask representing each commit
51 - provided on the commandline. eg: given the command:
52 -
53 - $ git-rev-tree <com1> <com2> <com3>
54 -
55 - The output:
56 -
57 - <date> <commit>:5
58 -
59 - means that <commit> is reachable from <com1>(1) and <com3>(4)
60 -
61 -A revtree can get quite large. "git-rev-tree" will eventually allow
62 -you to cache previous state so that you don't have to follow the whole
63 -thing down.
64 -
65 -So the change difference between two commits is literally
66 -
67 - git-rev-tree [commit-id1] > commit1-revtree
68 - git-rev-tree [commit-id2] > commit2-revtree
69 - join -t : commit1-revtree commit2-revtree > common-revisions
70 -
71 -(this is also how to find the most common parent - you'd look at just
72 -the head revisions - the ones that aren't referred to by other
73 -revisions - in "common-revision", and figure out the best one. I
74 -think.)
75 -
76 -
77 -Author
78 -------
79 -Written by Linus Torvalds <torvalds@osdl.org>
80 -
81 -Documentation
82 ---------------
83 -Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
84 -
85 -GIT
86 ----
87 -Part of the gitlink:git[7] suite
88 -
Documentation/git.txt
-3
@@ -134,9 +134,6 @@ gitlink:git-merge-base[1]::
134 gitlink:git-rev-list[1]::
135 Lists commit objects in reverse chronological order
136
137 -gitlink:git-rev-tree[1]::
138 - Provides the revision tree for one or more commits
139 -
137 gitlink:git-show-index[1]::
138 Displays contents of a pack idx file.
139
Documentation/howto/using-topic-branches.txt
+2 -2
@@ -245,7 +245,7 @@ gb=$(tput setab 2)
245 rb=$(tput setab 1)
246 restore=$(tput setab 9)
247
248 -if [ `git-rev-tree release ^test | wc -c` -gt 0 ]
248 +if [ `git-rev-list release ^test | wc -c` -gt 0 ]
249 then
250 echo $rb Warning: commits in release that are not in test $restore
251 git-whatchanged release ^test
@@ -262,7 +262,7 @@ do
262 status=
263 for ref in test release linus
264 do
265 - if [ `git-rev-tree $branch ^$ref | wc -c` -gt 0 ]
265 + if [ `git-rev-list $branch ^$ref | wc -c` -gt 0 ]
266 then
267 status=$status${ref:0:1}
268 fi
Makefile
+1 -1
@@ -109,7 +109,7 @@ PROGRAMS = \
109 git-merge-index git-mktag git-pack-objects git-patch-id \
110 git-peek-remote git-prune-packed git-read-tree \
111 git-receive-pack git-rev-list git-rev-parse \
112 - git-rev-tree git-send-pack git-show-branch \
112 + git-send-pack git-show-branch \
113 git-show-index git-ssh-fetch \
114 git-ssh-upload git-tar-tree git-unpack-file \
115 git-unpack-objects git-update-index git-update-server-info \
rev-tree.c deleted
-140
@@ -1,140 +0,0 @@
1 -#include "cache.h"
2 -#include "commit.h"
3 -
4 -/*
5 - * revision.h leaves the low 16 bits of the "flags" field of the
6 - * revision data structure unused. We use it for a "reachable from
7 - * this commit <N>" bitmask.
8 - */
9 -#define MAX_COMMITS 16
10 -#define REACHABLE (1U << 16)
11 -
12 -#define cmit_flags(cmit) ((cmit)->object.flags & ~REACHABLE)
13 -
14 -static int show_edges = 0;
15 -static int basemask = 0;
16 -
17 -static void read_cache_file(const char *path)
18 -{
19 - die("no revtree cache file yet");
20 -}
21 -
22 -/*
23 - * Some revisions are less interesting than others.
24 - *
25 - * For example, if we use a cache-file, that one may contain
26 - * revisions that were never used. They are never interesting.
27 - *
28 - * And sometimes we're only interested in "edge" commits, ie
29 - * places where the marking changes between parent and child.
30 - */
31 -static int interesting(struct commit *rev)
32 -{
33 - unsigned mask = cmit_flags(rev);
34 -
35 - if (!mask)
36 - return 0;
37 - if (show_edges) {
38 - struct commit_list *p = rev->parents;
39 - while (p) {
40 - if (mask != cmit_flags(p->item))
41 - return 1;
42 - p = p->next;
43 - }
44 - return 0;
45 - }
46 - if (mask & basemask)
47 - return 0;
48 -
49 - return 1;
50 -}
51 -
52 -/*
53 - * Usage: git-rev-tree [--edges] [--cache <cache-file>] <commit-id> [<commit-id2>]
54 - *
55 - * The cache-file can be quite important for big trees. This is an
56 - * expensive operation if you have to walk the whole chain of
57 - * parents in a tree with a long revision history.
58 - */
59 -int main(int argc, char **argv)
60 -{
61 - int i;
62 - int nr = 0;
63 - unsigned char sha1[MAX_COMMITS][20];
64 - struct commit_list *list = NULL;
65 -
66 - /*
67 - * First - pick up all the revisions we can (both from
68 - * caches and from commit file chains).
69 - */
70 - for (i = 1; i < argc ; i++) {
71 - char *arg = argv[i];
72 - struct commit *commit;
73 -
74 - if (!strcmp(arg, "--cache")) {
75 - read_cache_file(argv[++i]);
76 - continue;
77 - }
78 -
79 - if (!strcmp(arg, "--edges")) {
80 - show_edges = 1;
81 - continue;
82 - }
83 -
84 - if (arg[0] == '^') {
85 - arg++;
86 - basemask |= 1<<nr;
87 - }
88 - if (nr >= MAX_COMMITS || get_sha1(arg, sha1[nr]))
89 - usage("git-rev-tree [--edges] [--cache <cache-file>] <commit-id> [<commit-id>]");
90 -
91 - commit = lookup_commit_reference(sha1[nr]);
92 - if (!commit || parse_commit(commit) < 0)
93 - die("bad commit object");
94 - commit_list_insert(commit, &list);
95 - nr++;
96 - }
97 -
98 - /*
99 - * Parse all the commits in date order.
100 - *
101 - * We really should stop once we know enough, but that's a
102 - * decision that isn't trivial to make.
103 - */
104 - while (list)
105 - pop_most_recent_commit(&list, REACHABLE);
106 -
107 - /*
108 - * Now we have the maximal tree. Walk the different sha files back to the root.
109 - */
110 - for (i = 0; i < nr; i++)
111 - mark_reachable(&lookup_commit_reference(sha1[i])->object, 1 << i);
112 -
113 - /*
114 - * Now print out the results..
115 - */
116 - for (i = 0; i < nr_objs; i++) {
117 - struct object *obj = objs[i];
118 - struct commit *commit;
119 - struct commit_list *p;
120 -
121 - if (obj->type != commit_type)
122 - continue;
123 -
124 - commit = (struct commit *) obj;
125 -
126 - if (!interesting(commit))
127 - continue;
128 -
129 - printf("%lu %s:%d", commit->date, sha1_to_hex(obj->sha1),
130 - cmit_flags(commit));
131 - p = commit->parents;
132 - while (p) {
133 - printf(" %s:%d", sha1_to_hex(p->item->object.sha1),
134 - cmit_flags(p->item));
135 - p = p->next;
136 - }
137 - printf("\n");
138 - }
139 - return 0;
140 -}