~ubuntu-branches/ubuntu/vivid/dulwich/vivid

« back to all changes in this revision

Viewing changes to dulwich/fastexport.py

  • Committer: Package Import Robot
  • Author(s): Jelmer Vernooij
  • Date: 2014-04-25 02:29:17 UTC
  • mfrom: (1.5.6)
  • Revision ID: package-import@ubuntu.com-20140425022917-ivhlhvgfjkvfpocq
Tags: 0.9.7-1
* New upstream release.
* Use canonical URL in Vcs-Git.

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
        return marker
71
71
 
72
72
    def _iter_files(self, base_tree, new_tree):
73
 
        for (old_path, new_path), (old_mode, new_mode), (old_hexsha, new_hexsha) in \
 
73
        for ((old_path, new_path), (old_mode, new_mode),
 
74
            (old_hexsha, new_hexsha)) in \
74
75
                self.store.tree_changes(base_tree, new_tree):
75
76
            if new_path is None:
76
77
                yield commands.FileDeleteCommand(old_path)
81
82
            if old_path != new_path and old_path is not None:
82
83
                yield commands.FileRenameCommand(old_path, new_path)
83
84
            if old_mode != new_mode or old_hexsha != new_hexsha:
84
 
                yield commands.FileModifyCommand(new_path, new_mode, marker, None)
 
85
                yield commands.FileModifyCommand(new_path, new_mode, marker,
 
86
                    None)
85
87
 
86
88
    def _export_commit(self, commit, ref, base_tree=None):
87
89
        file_cmds = list(self._iter_files(base_tree, commit.tree))
96
98
        committer, committer_email = split_email(commit.committer)
97
99
        cmd = commands.CommitCommand(ref, marker,
98
100
            (author, author_email, commit.author_time, commit.author_timezone),
99
 
            (committer, committer_email, commit.commit_time, commit.commit_timezone),
 
101
            (committer, committer_email, commit.commit_time,
 
102
                commit.commit_timezone),
100
103
            commit.message, from_, merges, file_cmds)
101
104
        return (cmd, marker)
102
105
 
143
146
        else:
144
147
            author = cmd.committer
145
148
        (author_name, author_email, author_timestamp, author_timezone) = author
146
 
        (committer_name, committer_email, commit_timestamp, commit_timezone) = cmd.committer
 
149
        (committer_name, committer_email, commit_timestamp,
 
150
            commit_timezone) = cmd.committer
147
151
        commit.author = "%s <%s>" % (author_name, author_email)
148
152
        commit.author_timezone = author_timezone
149
153
        commit.author_time = int(author_timestamp)
161
165
                    self.repo.object_store.add(blob)
162
166
                    blob_id = blob.id
163
167
                else:
164
 
                    assert filecmd.dataref[0] == ":", "non-marker refs not supported yet"
 
168
                    assert filecmd.dataref[0] == ":", \
 
169
                        "non-marker refs not supported yet"
165
170
                    blob_id = self.markers[filecmd.dataref[1:]]
166
171
                self._contents[filecmd.path] = (filecmd.mode, blob_id)
167
172
            elif filecmd.name == "filedelete":
168
173
                del self._contents[filecmd.path]
169
174
            elif filecmd.name == "filecopy":
170
 
                self._contents[filecmd.dest_path] = self._contents[filecmd.src_path]
 
175
                self._contents[filecmd.dest_path] = self._contents[
 
176
                    filecmd.src_path]
171
177
            elif filecmd.name == "filerename":
172
 
                self._contents[filecmd.new_path] = self._contents[filecmd.old_path]
 
178
                self._contents[filecmd.new_path] = self._contents[
 
179
                    filecmd.old_path]
173
180
                del self._contents[filecmd.old_path]
174
181
            elif filecmd.name == "filedeleteall":
175
182
                self._contents = {}