~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

  • Committer: Martin Pool
  • Date: 2005-08-24 08:59:32 UTC
  • Revision ID: mbp@sourcefrog.net-20050824085932-c61f1f1f1c930e13
- Add a simple UIFactory 

  The idea of this is to let a client of bzrlib set some 
  policy about how output is displayed.

  In this revision all that's done is that progress bars
  are constructed by a policy established by the application
  rather than being randomly constructed in the library 
  or passed down the calls.  This avoids progress bars
  popping up while running the test suite and cleans up
  some code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
        basis_inv = basis.inventory
86
86
 
87
87
        if verbose:
88
 
            note('looking for changes...')
 
88
            # note('looking for changes...')
 
89
            # print 'looking for changes...'
 
90
            # disabled; should be done at a higher level
 
91
            pass
89
92
 
90
93
        pending_merges = branch.pending_merges()
91
94
 
115
118
            if work_inv.has_id(file_id):
116
119
                del work_inv[file_id]
117
120
 
118
 
 
119
121
        if rev_id is None:
120
 
            rev_id = _gen_revision_id(time.time())
 
122
            rev_id = _gen_revision_id(branch, time.time())
121
123
        inv_id = rev_id
122
124
 
123
125
        inv_tmp = tempfile.TemporaryFile()
137
139
            timestamp = time.time()
138
140
 
139
141
        if committer == None:
140
 
            committer = username()
 
142
            committer = username(branch)
141
143
 
142
144
        if timezone == None:
143
145
            timezone = local_time_offset()
180
182
        branch.set_pending_merges([])
181
183
 
182
184
        if verbose:
183
 
            note("commited r%d" % branch.revno())
 
185
            # disabled; should go through logging
 
186
            # note("commited r%d" % branch.revno())
 
187
            # print ("commited r%d" % branch.revno())
 
188
            pass
184
189
    finally:
185
190
        branch.unlock()
186
191
 
187
192
 
188
193
 
189
 
def _gen_revision_id(when):
 
194
def _gen_revision_id(branch, when):
190
195
    """Return new revision-id."""
191
196
    from binascii import hexlify
192
 
    from osutils import rand_bytes, compact_date, user_email
 
197
    from bzrlib.osutils import rand_bytes, compact_date, user_email
193
198
 
194
 
    s = '%s-%s-' % (user_email(), compact_date(when))
 
199
    s = '%s-%s-' % (user_email(branch), compact_date(when))
195
200
    s += hexlify(rand_bytes(8))
196
201
    return s
197
202