~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Martin Pool
  • Date: 2005-09-13 08:20:13 UTC
  • Revision ID: mbp@sourcefrog.net-20050913082013-15b0ffec911f2a0c
- fix up imports

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
18
 
19
19
import os, types, re, time, errno, sys
 
20
import sha
20
21
from cStringIO import StringIO
21
22
 
22
23
from stat import S_ISREG, S_ISDIR, S_ISLNK, ST_MODE, ST_SIZE
89
90
 
90
91
    If the file is already a backup, it's not copied.
91
92
    """
92
 
    import os
93
93
    if fn[-1] == '~':
94
94
        return
95
95
    bfn = fn + '~'
197
197
 
198
198
 
199
199
def sha_file(f):
200
 
    import sha
201
200
    if hasattr(f, 'tell'):
202
201
        assert f.tell() == 0
203
202
    s = sha.new()
219
218
 
220
219
 
221
220
def sha_string(f):
222
 
    import sha
223
221
    s = sha.new()
224
222
    s.update(f)
225
223
    return s.hexdigest()
227
225
 
228
226
 
229
227
def fingerprint_file(f):
230
 
    import sha
231
228
    s = sha.new()
232
229
    b = f.read()
233
230
    s.update(b)