1
#!/usr/bin/env python2.4
4
from bzrlib.workingtree import WorkingTree
6
from multiparent import MultiParent
8
if len(sys.argv) > 1 and len(sys.argv) < 4:
9
wt, path = WorkingTree.open_containing(sys.argv[-1])
10
if len(sys.argv) == 3:
11
assert sys.argv[1] == '--single'
14
print >> sys.stderr, 'Usage: mpknit [--single] FILENAME'
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)
25
parents = parents[0:1]
26
texts = file_weave.get_texts([revision] + parents)
28
patch_iter = MultiParent.from_texts(texts[0], texts[1:]).to_patch()
29
sys.stdout.writelines(patch_iter)