/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: Vincent Ladeuil
  • Date: 2011-03-14 10:11:58 UTC
  • mfrom: (5609.24.1 2.3)
  • mto: (5609.24.2 2.3)
  • mto: This revision was merged to the branch mainline in revision 5723.
  • Revision ID: v.ladeuil+lp@free.fr-20110314101158-9ojis0ftsljg3c3t
Merge bzr/2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
19
19
from stat import S_ISREG, S_IEXEC
20
20
import time
21
21
 
 
22
import bzrlib
22
23
from bzrlib import (
23
24
    errors,
24
25
    lazy_import,
25
26
    registry,
 
27
    tree,
26
28
    )
27
29
lazy_import.lazy_import(globals(), """
28
30
from bzrlib import (
38
40
    revision as _mod_revision,
39
41
    trace,
40
42
    ui,
 
43
    urlutils,
41
44
    )
42
45
""")
43
46
from bzrlib.errors import (DuplicateKey, MalformedTransform, NoSuchFile,
50
53
    delete_any,
51
54
    file_kind,
52
55
    has_symlinks,
53
 
    lexists,
54
56
    pathjoin,
55
57
    sha_file,
56
58
    splitpath,
57
59
    supports_executable,
58
 
)
 
60
    )
59
61
from bzrlib.progress import ProgressPhase
60
62
from bzrlib.symbol_versioning import (
61
 
        deprecated_function,
62
 
        deprecated_in,
63
 
        deprecated_method,
64
 
        )
65
 
from bzrlib.trace import mutter, warning
66
 
from bzrlib import tree
67
 
import bzrlib.ui
68
 
import bzrlib.urlutils as urlutils
 
63
    deprecated_function,
 
64
    deprecated_in,
 
65
    deprecated_method,
 
66
    )
 
67
from bzrlib.trace import warning
69
68
 
70
69
 
71
70
ROOT_PARENT = "root-parent"
528
527
        for trans_id in self._removed_id:
529
528
            file_id = self.tree_file_id(trans_id)
530
529
            if file_id is not None:
 
530
                # XXX: This seems like something that should go via a different
 
531
                #      indirection.
531
532
                if self._tree.inventory[file_id].kind == 'directory':
532
533
                    parents.append(trans_id)
533
534
            elif self.tree_kind(trans_id) == 'directory':
1675
1676
        """
1676
1677
        if not no_conflicts:
1677
1678
            self._check_malformed()
1678
 
        child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
 
1679
        child_pb = ui.ui_factory.nested_progress_bar()
1679
1680
        try:
1680
1681
            if precomputed_delta is None:
1681
1682
                child_pb.update('Apply phase', 0, 2)
1708
1709
    def _generate_inventory_delta(self):
1709
1710
        """Generate an inventory delta for the current transform."""
1710
1711
        inventory_delta = []
1711
 
        child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
 
1712
        child_pb = ui.ui_factory.nested_progress_bar()
1712
1713
        new_paths = self._inventory_altered()
1713
1714
        total_entries = len(new_paths) + len(self._removed_id)
1714
1715
        try:
1776
1777
        """
1777
1778
        tree_paths = list(self._tree_path_ids.iteritems())
1778
1779
        tree_paths.sort(reverse=True)
1779
 
        child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
 
1780
        child_pb = ui.ui_factory.nested_progress_bar()
1780
1781
        try:
1781
1782
            for num, data in enumerate(tree_paths):
1782
1783
                path, trans_id = data
1811
1812
        modified_paths = []
1812
1813
        new_path_file_ids = dict((t, self.final_file_id(t)) for p, t in
1813
1814
                                 new_paths)
1814
 
        child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
 
1815
        child_pb = ui.ui_factory.nested_progress_bar()
1815
1816
        try:
1816
1817
            for num, (path, trans_id) in enumerate(new_paths):
1817
1818
                if (num % 10) == 0:
2429
2430
        if num > 0:  # more than just a root
2430
2431
            raise errors.WorkingTreeAlreadyPopulated(base=wt.basedir)
2431
2432
    file_trans_id = {}
2432
 
    top_pb = bzrlib.ui.ui_factory.nested_progress_bar()
 
2433
    top_pb = ui.ui_factory.nested_progress_bar()
2433
2434
    pp = ProgressPhase("Build phase", 2, top_pb)
2434
2435
    if tree.inventory.root is not None:
2435
2436
        # This is kind of a hack: we should be altering the root
2448
2449
        pp.next_phase()
2449
2450
        file_trans_id[wt.get_root_id()] = \
2450
2451
            tt.trans_id_tree_file_id(wt.get_root_id())
2451
 
        pb = bzrlib.ui.ui_factory.nested_progress_bar()
 
2452
        pb = ui.ui_factory.nested_progress_bar()
2452
2453
        try:
2453
2454
            deferred_contents = []
2454
2455
            num = 0
2778
2779
def _prepare_revert_transform(working_tree, target_tree, tt, filenames,
2779
2780
                              backups, pp, basis_tree=None,
2780
2781
                              merge_modified=None):
2781
 
    child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
 
2782
    child_pb = ui.ui_factory.nested_progress_bar()
2782
2783
    try:
2783
2784
        if merge_modified is None:
2784
2785
            merge_modified = working_tree.merge_modified()
2787
2788
                                      merge_modified, basis_tree)
2788
2789
    finally:
2789
2790
        child_pb.finished()
2790
 
    child_pb = bzrlib.ui.ui_factory.nested_progress_bar()
 
2791
    child_pb = ui.ui_factory.nested_progress_bar()
2791
2792
    try:
2792
2793
        raw_conflicts = resolve_conflicts(tt, child_pb,
2793
2794
            lambda t, c: conflict_pass(t, c, target_tree))
3020
3021
            file_id = tt.inactive_file_id(conflict[1])
3021
3022
            # special-case the other tree root (move its children instead)
3022
3023
            if path_tree and file_id in path_tree:
3023
 
                if path_tree.inventory[file_id].parent_id is None:
 
3024
                if path_tree.path2id('') == file_id:
 
3025
                    # This is the root entry, skip it
3024
3026
                    continue
3025
3027
            tt.version_file(file_id, conflict[1])
3026
3028
            new_conflicts.add((c_type, 'Versioned directory', conflict[1]))