~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to upstream_import.py

  • Committer: Aaron Bentley
  • Date: 2007-06-15 19:44:04 UTC
  • Revision ID: abentley@panoramicfeedback.com-20070615194404-aftg1b9up4ve1t3y
Update graph-ancestry to support new graph API

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
 
41
41
 
42
42
class ZipInfoWrapper(object):
43
 
    
 
43
 
44
44
    def __init__(self, zipfile, info):
45
45
        self.info = info
46
46
        self.type = None
108
108
    def isdir(self):
109
109
        return stat.S_ISDIR(self.mode)
110
110
 
111
 
        
 
111
    def issym(self):
 
112
        if stat.S_ISLNK(self.mode):
 
113
            self.linkname = os.readlink(self.fullpath)
 
114
            return True
 
115
        else:
 
116
            return False
 
117
 
 
118
 
112
119
def top_directory(path):
113
120
    """Return the top directory given in a path."""
114
121
    dirname = os.path.dirname(path)
184
191
        tt.delete_contents(trans_id)
185
192
        removed.add(path)
186
193
 
187
 
    added = set() 
 
194
    added = set()
188
195
    implied_parents = set()
189
196
    seen = set()
190
197
    for member in archive_file.getmembers():
191
198
        if member.type == 'g':
192
199
            # type 'g' is a header
193
200
            continue
194
 
        relative_path = member.name 
 
201
        relative_path = member.name
195
202
        if prefix is not None:
196
203
            relative_path = relative_path[len(prefix)+1:]
197
204
            relative_path = relative_path.rstrip('/')
207
214
            tt.cancel_creation(trans_id)
208
215
        seen.add(member.name)
209
216
        if member.isreg():
210
 
            tt.create_file(file_iterator(archive_file.extractfile(member)), 
 
217
            tt.create_file(file_iterator(archive_file.extractfile(member)),
211
218
                           trans_id)
212
219
            executable = (member.mode & 0111) != 0
213
220
            tt.set_executability(executable, trans_id)
257
264
        if tree.changes_from(tree.basis_tree()).has_changed():
258
265
            raise BzrCommandError("Working tree has uncommitted changes.")
259
266
 
260
 
        if (source.endswith('.tar') or source.endswith('.tar.gz') or 
 
267
        if (source.endswith('.tar') or source.endswith('.tar.gz') or
261
268
            source.endswith('.tar.bz2')) or source.endswith('.tgz'):
262
269
            try:
263
270
                if source.endswith('.bz2'):