103
103
class NullCommitReporter(object):
104
104
"""I report on progress of a commit."""
105
def added(self, path):
108
def removed(self, path):
111
def renamed(self, old_path, new_path):
106
def snapshot_change(self, change, path):
109
def completed(self, revno, rev_id):
112
def deleted(self, file_id):
115
def escaped(self, escape_count, message):
118
def missing(self, path):
115
121
class ReportCommitToLog(NullCommitReporter):
116
def added(self, path):
117
note('added %s', path)
119
def removed(self, path):
120
note('removed %s', path)
122
def renamed(self, old_path, new_path):
123
note('renamed %s => %s', old_path, new_path)
123
def snapshot_change(self, change, path):
124
note("%s %s", change, path)
126
def completed(self, revno, rev_id):
127
note('committed r%d {%s}', revno, rev_id)
129
def deleted(self, file_id):
130
note('deleted %s', file_id)
132
def escaped(self, escape_count, message):
133
note("replaced %d control characters in message", escape_count)
135
def missing(self, path):
136
note('missing %s', path)
126
138
class Commit(object):
127
139
"""Task of committing a new revision.
226
238
self._record_inventory()
227
239
self._record_ancestry()
228
240
self._make_revision()
229
note('committed r%d {%s}', (self.branch.revno() + 1),
241
self.reporter.completed(self.branch.revno()+1, self.rev_id)
231
242
self.branch.append_revision(self.rev_id)
232
243
self.branch.set_pending_merges([])
258
269
lambda match: match.group(0).encode('unicode_escape'),
261
note("replaced %d control characters in message", escape_count)
272
self.reporter.escaped(escape_count, self.message)
263
274
def _record_ancestry(self):
264
275
"""Append merged revision ancestry to the ancestry file.
338
349
if specific and not is_inside_any(specific, path):
340
351
if not self.work_tree.has_filename(path):
341
note('missing %s', path)
352
self.reporter.missing(path)
342
353
deleted_ids.append((path, ie.file_id))
344
355
deleted_ids.sort(reverse=True)
393
404
self.work_tree, self.weave_store)
395
406
change = "unchanged"
396
note("%s %s", change, path)
407
self.reporter.snapshot_change(change, path)
398
409
def _populate_new_inv(self):
399
410
"""Build revision inventory.
428
439
def _report_deletes(self):
429
440
for file_id in self.basis_inv:
430
441
if file_id not in self.new_inv:
431
note('deleted %s', self.basis_inv.id2path(file_id))
442
self.reporter.deleted(self.basis_inv.id2path(file_id))