~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to mpknit

Merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
    print >> sys.stderr, 'Usage: mpknit [--single] FILENAME'
15
15
    sys.exit(3)
16
16
    
17
 
bt = wt.branch.repository.revision_tree(wt.last_revision())
18
 
file_id = wt.path2id(path)
19
 
file_weave = bt.get_weave(file_id)
20
 
for revision in file_weave.get_ancestry([bt.inventory[file_id].revision]):
21
 
    parents = file_weave.get_parents(revision)
22
 
    if single_parent:
23
 
        parents = parents[0:1]
24
 
    texts = file_weave.get_texts([revision] + parents)
25
 
    print revision
26
 
    patch_iter = MultiParent.from_texts(texts[0], texts[1:]).to_patch()
27
 
    sys.stdout.writelines(patch_iter)
 
17
wt.lock_read()
 
18
try:
 
19
    bt = wt.branch.repository.revision_tree(wt.last_revision())
 
20
    file_id = wt.path2id(path)
 
21
    file_weave = bt.get_weave(file_id)
 
22
    for revision in file_weave.get_ancestry([bt.inventory[file_id].revision]):
 
23
        parents = file_weave.get_parents(revision)
 
24
        if single_parent:
 
25
            parents = parents[0:1]
 
26
        texts = file_weave.get_texts([revision] + parents)
 
27
        print revision
 
28
        patch_iter = MultiParent.from_texts(texts[0], texts[1:]).to_patch()
 
29
        sys.stdout.writelines(patch_iter)
 
30
finally:
 
31
    wt.unlock()