~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remotebranch.py

  • Committer: Aaron Bentley
  • Date: 2005-07-26 14:06:11 UTC
  • mto: (1092.1.41) (1185.3.4) (974.1.47)
  • mto: This revision was merged to the branch mainline in revision 982.
  • Revision ID: abentley@panoramicfeedback.com-20050726140611-403e366f3c79c1f1
Fixed python invocation

Show diffs side-by-side

added added

removed removed

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