Mercurial > hg
comparison mercurial/commands.py @ 3572:fe03c9a476f6
log speedup: use only ui.write in changeset_printer.show
- ui.status is not very useful, since this code is never
executed when ui.quiet is true.
- explicitly checking for ui.debug allows a regular hg log to
run without looking at the manifest index
- the calls to ui.note were converted for consistency
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Sat, 28 Oct 2006 20:21:54 -0300 |
parents | 736a78469a85 |
children | 31401776153f |
comparison
equal
deleted
inserted
replaced
3571:736a78469a85 | 3572:fe03c9a476f6 |
---|---|
327 parents = [] | 327 parents = [] |
328 | 328 |
329 self.ui.write(_("changeset: %d:%s\n") % (rev, hexfunc(changenode))) | 329 self.ui.write(_("changeset: %d:%s\n") % (rev, hexfunc(changenode))) |
330 | 330 |
331 if branch: | 331 if branch: |
332 self.ui.status(_("branch: %s\n") % branch) | 332 self.ui.write(_("branch: %s\n") % branch) |
333 for tag in self.repo.nodetags(changenode): | 333 for tag in self.repo.nodetags(changenode): |
334 self.ui.status(_("tag: %s\n") % tag) | 334 self.ui.write(_("tag: %s\n") % tag) |
335 for parent in parents: | 335 for parent in parents: |
336 self.ui.write(_("parent: %d:%s\n") % parent) | 336 self.ui.write(_("parent: %d:%s\n") % parent) |
337 | 337 |
338 if brinfo and changenode in brinfo: | 338 if brinfo and changenode in brinfo: |
339 br = brinfo[changenode] | 339 br = brinfo[changenode] |
340 self.ui.write(_("branch: %s\n") % " ".join(br)) | 340 self.ui.write(_("branch: %s\n") % " ".join(br)) |
341 | 341 |
342 self.ui.debug(_("manifest: %d:%s\n") % | 342 if self.ui.debugflag: |
343 (self.repo.manifest.rev(changes[0]), hex(changes[0]))) | 343 self.ui.write(_("manifest: %d:%s\n") % |
344 self.ui.status(_("user: %s\n") % changes[1]) | 344 (self.repo.manifest.rev(changes[0]), hex(changes[0]))) |
345 self.ui.status(_("date: %s\n") % date) | 345 self.ui.write(_("user: %s\n") % changes[1]) |
346 self.ui.write(_("date: %s\n") % date) | |
346 | 347 |
347 if self.ui.debugflag: | 348 if self.ui.debugflag: |
348 files = self.repo.status(log.parents(changenode)[0], changenode)[:3] | 349 files = self.repo.status(log.parents(changenode)[0], changenode)[:3] |
349 for key, value in zip([_("files:"), _("files+:"), _("files-:")], | 350 for key, value in zip([_("files:"), _("files+:"), _("files-:")], |
350 files): | 351 files): |
351 if value: | 352 if value: |
352 self.ui.note("%-12s %s\n" % (key, " ".join(value))) | 353 self.ui.write("%-12s %s\n" % (key, " ".join(value))) |
353 elif changes[3]: | 354 elif changes[3] and self.ui.verbose: |
354 self.ui.note(_("files: %s\n") % " ".join(changes[3])) | 355 self.ui.write(_("files: %s\n") % " ".join(changes[3])) |
355 if copies: | 356 if copies and self.ui.verbose: |
356 copies = ['%s (%s)' % c for c in copies] | 357 copies = ['%s (%s)' % c for c in copies] |
357 self.ui.note(_("copies: %s\n") % ' '.join(copies)) | 358 self.ui.write(_("copies: %s\n") % ' '.join(copies)) |
358 | 359 |
359 if extra and self.ui.debugflag: | 360 if extra and self.ui.debugflag: |
360 extraitems = extra.items() | 361 extraitems = extra.items() |
361 extraitems.sort() | 362 extraitems.sort() |
362 for key, value in extraitems: | 363 for key, value in extraitems: |
363 self.ui.debug(_("extra: %s=%s\n") | 364 self.ui.write(_("extra: %s=%s\n") |
364 % (key, value.encode('string_escape'))) | 365 % (key, value.encode('string_escape'))) |
365 | 366 |
366 description = changes[4].strip() | 367 description = changes[4].strip() |
367 if description: | 368 if description: |
368 if self.ui.verbose: | 369 if self.ui.verbose: |
369 self.ui.status(_("description:\n")) | 370 self.ui.write(_("description:\n")) |
370 self.ui.status(description) | 371 self.ui.write(description) |
371 self.ui.status("\n\n") | 372 self.ui.write("\n\n") |
372 else: | 373 else: |
373 self.ui.status(_("summary: %s\n") % | 374 self.ui.write(_("summary: %s\n") % |
374 description.splitlines()[0]) | 375 description.splitlines()[0]) |
375 self.ui.status("\n") | 376 self.ui.write("\n") |
376 | 377 |
377 def show_changeset(ui, repo, opts): | 378 def show_changeset(ui, repo, opts): |
378 """show one changeset using template or regular display. | 379 """show one changeset using template or regular display. |
379 | 380 |
380 Display format will be the first non-empty hit of: | 381 Display format will be the first non-empty hit of: |