~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/generate_ids.py

  • Committer: Aaron Bentley
  • Date: 2007-02-06 14:52:16 UTC
  • mfrom: (2266 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2268.
  • Revision ID: abentley@panoramicfeedback.com-20070206145216-fcpi8o3ufvuzwbp9
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
    give a highly probably globally unique number. Then each call in the same
48
48
    process adds 1 to a serial number we append to that unique value.
49
49
    """
50
 
    # XXX TODO: change bzrlib.add.smart_add_tree to call workingtree.add() rather 
 
50
    # XXX TODO: change bzrlib.add.smart_add to call workingtree.add() rather 
51
51
    # than having to move the id randomness out of the inner loop like this.
52
52
    # XXX TODO: for the global randomness this uses we should add the thread-id
53
53
    # before the serial #.
80
80
    #    filesystems
81
81
    # 4) Removing starting '.' characters to prevent the file ids from
82
82
    #    being considered hidden.
83
 
    ascii_word_only = str(_file_id_chars_re.sub('', name.lower()))
 
83
    ascii_word_only = _file_id_chars_re.sub('', name.lower())
84
84
    short_no_dots = ascii_word_only.lstrip('.')[:20]
85
85
    return short_no_dots + _next_id_suffix()
86
86
 
114
114
    if timestamp is None:
115
115
        timestamp = time.time()
116
116
 
117
 
    rev_id = u'-'.join((user_or_email,
118
 
                        osutils.compact_date(timestamp),
119
 
                        unique_chunk))
120
 
    return rev_id.encode('utf8')
 
117
    return '-'.join((user_or_email,
 
118
                    osutils.compact_date(timestamp),
 
119
                    unique_chunk))