~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Martin Pool
  • Date: 2006-02-21 08:03:27 UTC
  • mto: This revision was merged to the branch mainline in revision 1569.
  • Revision ID: mbp@sourcefrog.net-20060221080327-b1723b722187fb63
Change fancy_rename to use rand_chars rather than reinvent it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
129
129
    import random
130
130
    base = os.path.basename(new)
131
131
    dirname = os.path.dirname(new)
132
 
    tmp_name = u'tmp.%s.%.9f.%d.%d' % (base, time.time(), os.getpid(), random.randint(0, 0x7FFFFFFF))
 
132
    tmp_name = u'tmp.%s.%.9f.%d.%s' % (base, time.time(), os.getpid(), rand_chars(10))
133
133
    tmp_name = pathjoin(dirname, tmp_name)
134
134
 
135
135
    # Rename the file out of the way, but keep track if it didn't exist