/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/mutabletree.py

  • Committer: Jelmer Vernooij
  • Date: 2011-03-13 21:30:33 UTC
  • mto: This revision was merged to the branch mainline in revision 5724.
  • Revision ID: jelmer@samba.org-20110313213033-ud9t11mm8e3idtti
Add test for per-file-timestamp zipfiles.

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
32
32
    hooks,
33
33
    osutils,
34
34
    revisiontree,
 
35
    inventory,
35
36
    symbol_versioning,
36
37
    trace,
37
38
    tree,
79
80
        # used on media which doesn't differentiate the case of names.
80
81
        self.case_sensitive = True
81
82
 
 
83
    def is_control_filename(self, filename):
 
84
        """True if filename is the name of a control file in this tree.
 
85
 
 
86
        :param filename: A filename within the tree. This is a relative path
 
87
        from the root of this tree.
 
88
 
 
89
        This is true IF and ONLY IF the filename is part of the meta data
 
90
        that bzr controls in this tree. I.E. a random .bzr directory placed
 
91
        on disk will not be a control file for this tree.
 
92
        """
 
93
        raise NotImplementedError(self.is_control_filename)
 
94
 
82
95
    @needs_tree_write_lock
83
96
    def add(self, files, ids=None, kinds=None):
84
97
        """Add paths to the set of versioned paths.
375
388
        This is designed more towards DWIM for humans than API clarity.
376
389
        For the specific behaviour see the help for cmd_add().
377
390
 
 
391
        :param file_list: List of zero or more paths.  *NB: these are 
 
392
            interpreted relative to the process cwd, not relative to the 
 
393
            tree.*  (Add and most other tree methods use tree-relative
 
394
            paths.)
378
395
        :param action: A reporter to be called with the inventory, parent_ie,
379
396
            path and kind of the path being added. It may return a file_id if
380
397
            a specific one should be used.
411
428
            for c in self.conflicts():
412
429
                conflicts_related.update(c.associated_filenames())
413
430
 
 
431
        # expand any symlinks in the directory part, while leaving the
 
432
        # filename alone
 
433
        # only expanding if symlinks are supported avoids windows path bugs
 
434
        if osutils.has_symlinks():
 
435
            file_list = map(osutils.normalizepath, file_list)
 
436
 
414
437
        # validate user file paths and convert all paths to tree
415
438
        # relative : it's cheaper to make a tree relative path an abspath
416
439
        # than to convert an abspath to tree relative, and it's cheaper to
536
559
                        this_ie = None
537
560
                    else:
538
561
                        this_ie = inv[this_id]
 
562
                        # Same as in _add_one below, if the inventory doesn't
 
563
                        # think this is a directory, update the inventory
 
564
                        if this_ie.kind != 'directory':
 
565
                            this_ie = inventory.make_entry('directory',
 
566
                                this_ie.name, this_ie.parent_id, this_id)
 
567
                            del inv[this_id]
 
568
                            inv.add(this_ie)
539
569
 
540
570
                for subf in sorted(os.listdir(abspath)):
541
571
                    # here we could use TreeDirectory rather than
715
745
        file_id or None to generate a new file id
716
746
    :returns: None
717
747
    """
 
748
    # if the parent exists, but isn't a directory, we have to do the
 
749
    # kind change now -- really the inventory shouldn't pretend to know
 
750
    # the kind of wt files, but it does.
 
751
    if parent_ie.kind != 'directory':
 
752
        # nb: this relies on someone else checking that the path we're using
 
753
        # doesn't contain symlinks.
 
754
        new_parent_ie = inventory.make_entry('directory', parent_ie.name,
 
755
            parent_ie.parent_id, parent_ie.file_id)
 
756
        del inv[parent_ie.file_id]
 
757
        inv.add(new_parent_ie)
 
758
        parent_ie = new_parent_ie
718
759
    file_id = file_id_callback(inv, parent_ie, path, kind)
719
760
    entry = inv.make_entry(kind, path.base_path, parent_ie.file_id,
720
761
        file_id=file_id)