~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: Jelmer Vernooij
  • Date: 2012-04-02 01:44:26 UTC
  • mfrom: (6518 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6519.
  • Revision ID: jelmer@samba.org-20120402014426-0o5qtysohyl006b2
merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
575
575
            # ensure that all children are registered with the transaction
576
576
            list(self.iter_tree_children(parent_id))
577
577
 
578
 
    @deprecated_method(deprecated_in((2, 3, 0)))
579
 
    def has_named_child(self, by_parent, parent_id, name):
580
 
        return self._has_named_child(
581
 
            name, parent_id, known_children=by_parent.get(parent_id, []))
582
 
 
583
578
    def _has_named_child(self, name, parent_id, known_children):
584
579
        """Does a parent already have a name child.
585
580
 
2117
2112
        return cur_parent
2118
2113
 
2119
2114
    def path2id(self, path):
 
2115
        if isinstance(path, list):
 
2116
            if path == []:
 
2117
                path = [""]
 
2118
            path = osutils.pathjoin(*path)
2120
2119
        return self._transform.final_file_id(self._path2trans_id(path))
2121
2120
 
2122
2121
    def id2path(self, file_id):
2833
2832
        tt.set_executability(entry.executable, trans_id)
2834
2833
 
2835
2834
 
2836
 
@deprecated_function(deprecated_in((2, 3, 0)))
2837
 
def get_backup_name(entry, by_parent, parent_trans_id, tt):
2838
 
    return _get_backup_name(entry.name, by_parent, parent_trans_id, tt)
2839
 
 
2840
 
 
2841
 
@deprecated_function(deprecated_in((2, 3, 0)))
2842
 
def _get_backup_name(name, by_parent, parent_trans_id, tt):
2843
 
    """Produce a backup-style name that appears to be available"""
2844
 
    def name_gen():
2845
 
        counter = 1
2846
 
        while True:
2847
 
            yield "%s.~%d~" % (name, counter)
2848
 
            counter += 1
2849
 
    for new_name in name_gen():
2850
 
        if not tt.has_named_child(by_parent, parent_trans_id, new_name):
2851
 
            return new_name
2852
 
 
2853
 
 
2854
2835
def revert(working_tree, target_tree, filenames, backups=False,
2855
2836
           pb=None, change_reporter=None):
2856
2837
    """Revert a working tree's contents to those of a target tree."""