bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.9.6
by Aaron Bentley
Add mpknit command |
1 |
#!/usr/bin/env python2.4
|
2 |
import sys |
|
3 |
||
4 |
from bzrlib.workingtree import WorkingTree |
|
5 |
||
6 |
from multiparent import MultiParent |
|
7 |
single_parent = False |
|
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' |
|
12 |
single_parent = True |
|
13 |
else: |
|
14 |
print >> sys.stderr, 'Usage: mpknit [--single] FILENAME' |
|
15 |
sys.exit(3) |
|
16 |
||
|
0.10.1
by Aaron Bentley
Tree locking's always a good idea |
17 |
wt.lock_read() |
18 |
try: |
|
|
0.9.13
by Aaron Bentley
Merge |
19 |
bt = wt.branch.repository.revision_tree(wt.last_revision()) |
|
0.10.1
by Aaron Bentley
Tree locking's always a good idea |
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() |