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

  • Committer: John Arbash Meinel
  • Date: 2010-01-06 22:17:10 UTC
  • mto: This revision was merged to the branch mainline in revision 4940.
  • Revision ID: john@arbash-meinel.com-20100106221710-3shwzqvrfne5mlyi
Revert all of the extension code.

Instead, just stick with os.utime. It is *much* simpler, and I couldn't
find a performance impact of not using it.
The one small difference is that you should call it after closing
the file, but that is reasonable to do anyway.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1133
1133
                raise
1134
1134
 
1135
1135
            f.writelines(contents)
1136
 
            # We have to flush before calling _set_mtime, otherwise buffered
1137
 
            # data can be written after we force the mtime. This shouldn't have
1138
 
            # a huge performance impact, because 'close()' will flush anyway
1139
 
            f.flush()
1140
 
            self._set_mtime(f)
1141
1136
        finally:
1142
1137
            f.close()
 
1138
        self._set_mtime(name)
1143
1139
        self._set_mode(trans_id, mode_id, S_ISREG)
1144
1140
 
1145
1141
    def _read_file_chunks(self, trans_id):
1152
1148
    def _read_symlink_target(self, trans_id):
1153
1149
        return os.readlink(self._limbo_name(trans_id))
1154
1150
 
1155
 
    def _set_mtime(self, f):
 
1151
    def _set_mtime(self, path):
1156
1152
        """All files that are created get the same mtime.
1157
1153
 
1158
1154
        This time is set by the first object to be created.
1159
1155
        """
1160
1156
        if self._creation_mtime is None:
1161
1157
            self._creation_mtime = time.time()
1162
 
        osutils.fset_mtime(f, self._creation_mtime)
 
1158
        os.utime(path, (self._creation_mtime, self._creation_mtime))
1163
1159
 
1164
1160
    def create_hardlink(self, path, trans_id):
1165
1161
        """Schedule creation of a hard link"""