From db45da12089bf131579d100ff7990cbc18d07325 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Sat, 18 Apr 2009 13:49:13 -0700 Subject: Add -p to `repo forall` to improve output formatting When trying to read log output from many projects at once it can be difficult to make sense of which messages came from where. For many professional developers it is common to want to view the last week's worth of your work, so you can write a weekly summary of your activity for your status report. This is easier with the new -p option: repo forall -pc git log --reverse --since=1.week.ago --author=sop produces a report of all commits written by me in the last week, formatted in a paged output display, with headers inserted in front of each project's output. Where this can be even more useful is with git log's pickaxe, e.g. now we can use: repo forall -pc git log -Sbar v1.0..v1.1 to locate all additions or removals of the symbol 'bar' since v1.0, up to and including v1.1. Before displaying the matching commits in a project, a project header is shown, giving the user some context information for the matching results. Signed-off-by: Shawn O. Pearce --- command.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'command.py') diff --git a/command.py b/command.py index c3cad5ea..a941b95a 100644 --- a/command.py +++ b/command.py @@ -27,6 +27,9 @@ class Command(object): manifest = None _optparse = None + def WantPager(self, opt): + return False + @property def OptionParser(self): if self._optparse is None: @@ -109,11 +112,15 @@ class InteractiveCommand(Command): """Command which requires user interaction on the tty and must not run within a pager, even if the user asks to. """ + def WantPager(self, opt): + return False class PagedCommand(Command): """Command which defaults to output in a pager, as its display tends to be larger than one screen full. """ + def WantPager(self, opt): + return True class MirrorSafeCommand(object): """Command permits itself to run within a mirror, -- cgit v1.2.3-54-g00ecf