2
# dumppack - Simple pack dumper for dulwich
3
# Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org>
5
# This program is free software; you can redistribute it and/or
6
# modify it under the terms of the GNU General Public License
7
# as published by the Free Software Foundation; version 2
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
15
# You should have received a copy of the GNU General Public License
16
# along with this program; if not, write to the Free Software
17
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21
from dulwich.pack import PackData, PackIndex, sha_to_hex
24
basename = sys.argv[1]
27
x = PackIndex(basename + ".idx")
29
print "CHECKSUM DOES NOT MATCH"
30
print "Length: %d" % len(x)
31
print "Entries in index:"
32
for name, offset, crc in x.iterentries():
33
print "\t%s: %d" % (sha_to_hex(name), offset)
36
x = PackData(basename + ".pack")
40
print "CHECKSUM DOES NOT MATCH"
41
print "Number of objects: %d" % len(x)