Commit Graph

17 Commits

Author SHA1 Message Date
Linus Torvalds
3c249c9506 Add "get_sha1()" helper function.
This allows the programs to use various simplified versions of
the SHA1 names, eg just say "HEAD" for the SHA1 pointed to by
the .git/HEAD file etc.

For example, this commit has been done with

	git-commit-tree $(git-write-tree) -p HEAD

instead of the traditional "$(cat .git/HEAD)" syntax.
2005-05-01 16:36:56 -07:00
Linus Torvalds
5e7921e7c1 rev-tree.c: don't include unnecessary header files
We used to have all these time-related issues, long gone now.
2005-04-30 16:26:56 -07:00
Linus Torvalds
94dfb7f2e3 Fix NSEC compile problem, and properly parse the rev-tree cmd line.
The rev-tree thing just happened to work. It shouldn't have.
2005-04-21 09:58:24 -07:00
Linus Torvalds
3b7d368f34 Don't parse commit objects more than once.
Yes, the "parse_commit()" already checks for this condition, but
we need to check for it in rev-tree too, so that we don't start
walking the parent chain unnecessarily.
2005-04-19 09:52:24 -07:00
Daniel Barkalow
5873b67eef [PATCH] Port rev-tree to parsing functions
This ports rev-tree to use the parsing functions introduced in the
previous patches.

Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-18 11:39:48 -07:00
Linus Torvalds
15000d7899 Make "rev-tree.c" use the new-and-improved "mark_reachable()"
It used to have its own specialized version for marking the
sub-reachability bits.
2005-04-17 12:09:20 -07:00
Linus Torvalds
89d21f4b64 Move "parse_commit()" into common revision.h file.
This also drops the old-style date parsing. We just don't care
enough, since we dropped that format pretty early.

Yes, this could do with some cleanup, and a common library file.
Some day.
2005-04-17 11:39:18 -07:00
David Woodhouse
27de946d0e [PATCH] Simplify date handling and make it more reliable
This make all dates be stores as seconds since UTC epoch, with the
author's or committer's timezone as auxiliary data so that dates can be
pretty-printed in the original timezone later if anyone cares.  I left
the date parsing in rev-tree.c for backward compatibility but it can be
dropped when we change to base64 :)

commit-tree now eats RFC2822 dates as AUTHOR_DATE because that's
what you're going to want to feed it.

Yes, glibc sucks and strptime is a pile of crap. We have to parse it
ourselves.
2005-04-15 08:39:57 -07:00
Linus Torvalds
458754a9fe Use common "revision.h" header for both fsck and rev-tree.
It's really a very generic thing: the notion of one sha1 revision
referring to another one. "fsck" uses it for all nodes, and "rev-tree"
only tracks commit-node relationships, but the code was already
the same - now we just make that explicit by moving it to a common
header file.
2005-04-13 21:37:59 -07:00
Petr Baudis
2de381f919 [PATCH] Consolidate the error handling
Now there is error() for "library" errors and die() for fatal "application"
errors. usage() is now used strictly only for usage errors.

Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-04-13 02:28:48 -07:00
Petr Baudis
3d8c7a5790 [PATCH] Fix a crash when doing rev-tree
In parse_commit(), free(buffer) is fed a bogus pointer.

Signed-off-by: Petr Baudis <pasky@ucw.cz>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-12 14:37:42 -07:00
Linus Torvalds
40e88b95cd Make "rev-tree" able to read its own output again from the cache.
Also, add "date" information to the output so that you can do something
like this:

	rev-tree `cat .git/HEAD` | sort -nr | cut -d' ' -f2 | while read i; do cat-file commit $i; done

which basically becomes a "git log" (aka "git changes") where things are
sorted by time.
2005-04-12 13:40:03 -07:00
David Woodhouse
727ff27787 [PATCH] rev-tree support for "in X but not in Y".
To do the automated commit-mailing I need to be able to answer the
question "which commits are here today but weren't yesterday"...  i.e. 
given two commit-ids $HEAD and $YESTERDAY I want to be able to do:

	rev-tree $HEAD ^$YESTERDAY

to list those commits which are in the tree now but weren't
ancestors of yesterday's head.

Yes, I could probably do this with 
	rev-tree $HEAD $YESTERDAY | egrep -v ^[a-z0-9]*:3
but I prefer not to.
2005-04-12 12:35:11 -07:00
Linus Torvalds
771364af0e Make the rev-tree output more regular. This is the last
change. Promise.

It now always outputs all the revisions as <sha1>:<reachability>, where the
reachability is the bitmask of how that revision was reachable from the
commits in the argument list.

Trivially, if there is only one commit, the reachability will always be
(1 << 0) == 1 for all reachable revisions, and there won't be any edges
(so the "--edges" flag only makes sense with multiple commit keys).
2005-04-11 17:40:58 -07:00
Linus Torvalds
28258afe91 Make "rev-tree" capable of showing the difference in reachability between two
or more commit points.

This is important both to know what the difference between two commit
points is, but also to figure out where to try to merge from.
2005-04-11 17:23:58 -07:00
Linus Torvalds
97d9c3cdea Make "rev-tree" more efficient and more useful.
Slight change of output format: it now lists all parents on the same line.

This allows it to work on initial commits too (which have no parents), and
also makes the output format a lot more intuitive.
2005-04-11 16:42:13 -07:00
Linus Torvalds
84fe972055 Add a "rev-tree" helper, which calculates the revision
tree graph.

It's quite fast when the commit-objects are cached, but since
it has to walk every single commit-object, it also allows you
to cache an old state and just add on top of that.
2005-04-11 13:55:10 -07:00