bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.211.35
by Jelmer Vernooij
Add simple pack dump utility. |
1 |
#!/usr/bin/python
|
2 |
# dumppack - Simple pack dumper for dulwich
|
|
3 |
# Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org>
|
|
4 |
#
|
|
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
|
|
8 |
# of the License.
|
|
9 |
#
|
|
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.
|
|
14 |
#
|
|
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,
|
|
18 |
# MA 02110-1301, USA.
|
|
19 |
||
20 |
||
21 |
from dulwich.pack import PackData, PackIndex, sha_to_hex |
|
22 |
import sys |
|
23 |
||
24 |
basename = sys.argv[1] |
|
25 |
print "Index file:" |
|
26 |
print "-----------" |
|
27 |
x = PackIndex(basename + ".idx") |
|
28 |
if not x.check(): |
|
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) |
|
34 |
print "" |
|
35 |
||
36 |
x = PackData(basename + ".pack") |
|
37 |
print "Pack file:" |
|
38 |
print "----------" |
|
39 |
if not x.check(): |
|
40 |
print "CHECKSUM DOES NOT MATCH" |
|
41 |
print "Number of objects: %d" % len(x) |