~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/shelf.py

(jelmer) Use the absolute_import feature everywhere in bzrlib,
 and add a source test to make sure it's used everywhere. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008 Canonical Ltd
 
1
# Copyright (C) 2008, 2009, 2010 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
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
 
17
from __future__ import absolute_import
17
18
 
18
19
import errno
19
20
import re
20
21
 
 
22
from bzrlib.lazy_import import lazy_import
 
23
lazy_import(globals(), """
21
24
from bzrlib import (
22
25
    bencode,
23
26
    errors,
24
27
    merge,
25
28
    merge3,
26
 
    osutils,
27
29
    pack,
28
30
    transform,
29
 
    ui,
30
 
    workingtree,
31
31
)
 
32
""")
32
33
 
33
34
 
34
35
class ShelfCreator(object):
65
66
        """Iterable of tuples describing shelvable changes.
66
67
 
67
68
        As well as generating the tuples, this updates several members.
68
 
        Tuples may be:
 
69
        Tuples may be::
 
70
 
69
71
           ('add file', file_id, work_kind, work_path)
70
72
           ('delete file', file_id, target_kind, target_path)
71
73
           ('rename', file_id, target_path, work_path)
81
83
            # when a tree root was deleted / renamed.
82
84
            if kind[0] is None and names[1] == '':
83
85
                continue
 
86
            # Also don't shelve deletion of tree root.
 
87
            if kind[1] is None and names[0] == '':
 
88
                continue
84
89
            if kind[0] is None or versioned[0] == False:
85
90
                self.creation[file_id] = (kind[1], names[1], parents[1],
86
91
                                          versioned)