~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/foreign.py

  • Committer: Aaron Bentley
  • Date: 2009-04-13 19:11:43 UTC
  • mto: This revision was merged to the branch mainline in revision 4293.
  • Revision ID: aaron@aaronbentley.com-20090413191143-miq7d5z8hjjljsu0
Implement dpush via sexy APIs

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    errors,
29
29
    osutils,
30
30
    registry,
 
31
    transform,
31
32
    )
32
33
""")
33
34
 
291
292
    return ret
292
293
 
293
294
 
 
295
def update_workingtree_fileids(wt, target_tree):
 
296
    tt = transform.TreeTransform(wt)
 
297
    try:
 
298
        for f, p, c, v, d, n, k, e in target_tree.iter_changes(wt):
 
299
            if v == (True, False):
 
300
                trans_id = tt.trans_id_tree_path(p[0])
 
301
                tt.unversion_file(trans_id)
 
302
            elif v == (False, True):
 
303
                trans_id = tt.trans_id_tree_path(p[1])
 
304
                tt.version_file(f, trans_id)
 
305
        tt.apply()
 
306
    finally:
 
307
        tt.finalize()
 
308
    if len(wt.get_parent_ids()) == 1:
 
309
        wt.set_parent_trees([(target_tree.get_revision_id(), target_tree)])
 
310
    else:
 
311
        wt.set_last_revision(target_tree.get_revision_id())
 
312
 
 
313
 
294
314
def update_workinginv_fileids(wt, old_inv, new_inv):
295
315
    """Update all file ids in wt according to old_tree/new_tree. 
296
316
 
385
405
                if source_wt is not None and old_last_revid != new_last_revid:
386
406
                    source_wt.lock_write()
387
407
                    try:
388
 
                        update_workinginv_fileids(source_wt, 
389
 
                            source_wt.branch.repository.get_inventory(
390
 
                                old_last_revid),
391
 
                            source_wt.branch.repository.get_inventory(
392
 
                                new_last_revid))
 
408
                        target = source_wt.branch.repository.revision_tree(
 
409
                            new_last_revid)
 
410
                        update_workingtree_fileids(source_wt, target)
 
411
#                        update_workinginv_fileids(source_wt, 
 
412
#                            source_wt.branch.repository.get_inventory(
 
413
#                                old_last_revid),
 
414
#                            source_wt.branch.repository.get_inventory(
 
415
#                                new_last_revid))
393
416
                    finally:
394
417
                        source_wt.unlock()
395
418
        finally:
396
419
            target_branch.unlock()
397
 
 
398