* git rev-list
@ 2006-01-27 3:46 Aneesh Kumar
2006-01-27 7:35 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: Aneesh Kumar @ 2006-01-27 3:46 UTC (permalink / raw)
To: junkio, git
I am right now making a gnome based git repository browser [1] . I use
git-rev-list to get the revision list. What i found is that from the
second commit on wards i am finding some control character at the
beginning of the first line with respect to each commit. You can
reproduce it easily by redirecting the output to a file and reading
the file using vi. I am using the latest git built from git repository
[1] http://www.flickr.com/photos/17388011@N00/91636482/
This is based on bzrk GUI frontend to bazaar and written in python
-aneesh
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: git rev-list
2006-01-27 3:46 git rev-list Aneesh Kumar
@ 2006-01-27 7:35 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2006-01-27 7:35 UTC (permalink / raw)
To: Aneesh Kumar; +Cc: git
Aneesh Kumar <aneesh.kumar@gmail.com> writes:
> ... I use
> git-rev-list to get the revision list. What i found is that from the
> second commit on wards i am finding some control character at the
> beginning of the first line with respect to each commit.
If you are using "git-rev-list --header" format, it uses an
ASCII NUL (0) to delimit each record. Technically, it is not
"beginning of the first line starting from the second commit",
but "at the end of each commit".
With Perl, you would read such NUL separated record by:
local $/ = "\0";
my $item = <>;
Admittedly my Python is quite rusty, and I do not offhand recall
there was no such "line separator is NUL instead of normal LF"
configuration on readable file objects. You may need to do
something ugly like this:
-- >8 --
import os
def rev_list(rev_range):
revlist = os.popen('git rev-list --header %s' % rev_range)
stash = []
while 1:
line = revlist.readline()
if line == '':
break
if line[0] == '\0':
yield ''.join(stash)
stash = []
line = line[1:]
if line == '':
break
stash.append(line)
if len(stash):
yield ''.join(stash)
for commit in rev_list('master..pu'):
# Use commit which is from a single record..
print "*<*", commit, "*>*"
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-01-27 7:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-27 3:46 git rev-list Aneesh Kumar
2006-01-27 7:35 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox