From: Junio C Hamano <junkio@cox.net>
To: Aneesh Kumar <aneesh.kumar@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: git rev-list
Date: Thu, 26 Jan 2006 23:35:28 -0800 [thread overview]
Message-ID: <7vvew62ke7.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: cc723f590601261946h101d7000oa1990c31c5b642fc@mail.gmail.com
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, "*>*"
prev parent reply other threads:[~2006-01-27 7:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-27 3:46 git rev-list Aneesh Kumar
2006-01-27 7:35 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vvew62ke7.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=aneesh.kumar@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox