~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remotebranch.py

  • Committer: Martin Pool
  • Date: 2005-07-18 18:53:46 UTC
  • Revision ID: mbp@sourcefrog.net-20050718185346-6226a1be01b942e1
- new 'weave stats' command

Show diffs side-by-side

added added

removed removed

Lines of Context:
170
170
        return get_url(p, compressed=True)
171
171
    
172
172
 
173
 
def simple_walk():
174
 
    """For experimental purposes, traverse many parts of a remote branch"""
175
 
    from bzrlib.revision import Revision
176
 
    from bzrlib.branch import Branch
177
 
    from bzrlib.inventory import Inventory
178
 
    from bzrlib.xml import unpack_xml
179
 
 
180
 
    got_invs = {}
181
 
    got_texts = {}
182
 
 
183
 
    print 'read history'
184
 
    history = get_url('/.bzr/revision-history').readlines()
185
 
    num_revs = len(history)
186
 
    for i, rev_id in enumerate(history):
187
 
        rev_id = rev_id.rstrip()
188
 
        print 'read revision %d/%d' % (i, num_revs)
189
 
 
190
 
        # python gzip needs a seekable file (!!) but the HTTP response
191
 
        # isn't, so we need to buffer it
192
 
 
193
 
        rev_f = get_url('/.bzr/revision-store/%s' % rev_id,
194
 
                        compressed=True)
195
 
 
196
 
        rev = unpack_xml(Revision, rev_f)
197
 
        print rev.message
198
 
        inv_id = rev.inventory_id
199
 
        if inv_id not in got_invs:
200
 
            print 'get inventory %s' % inv_id
201
 
            inv_f = get_url('/.bzr/inventory-store/%s' % inv_id,
202
 
                            compressed=True)
203
 
            inv = Inventory.read_xml(inv_f)
204
 
            print '%4d inventory entries' % len(inv)
205
 
 
206
 
            for path, ie in inv.iter_entries():
207
 
                text_id = ie.text_id
208
 
                if text_id == None:
209
 
                    continue
210
 
                if text_id in got_texts:
211
 
                    continue
212
 
                print '  fetch %s text {%s}' % (path, text_id)
213
 
                text_f = get_url('/.bzr/text-store/%s' % text_id,
214
 
                                 compressed=True)
215
 
                got_texts[text_id] = True
216
 
 
217
 
            got_invs.add[inv_id] = True
218
 
 
219
 
        print '----'
220
 
 
221
 
 
222
 
def try_me():
223
 
    BASE_URL = 'http://bazaar-ng.org/bzr/bzr.dev/'
224
 
    b = RemoteBranch(BASE_URL)
225
 
    ## print '\n'.join(b.revision_history())
226
 
    from log import show_log
227
 
    show_log(b)
228
 
 
229
 
 
230
 
if __name__ == '__main__':
231
 
    try_me()
232
173