diff options
author | Andrew Wheeler <agwheeler@gmail.com> | 2012-02-27 13:52:22 -0600 |
---|---|---|
committer | Andrew Wheeler <agwheeler@gmail.com> | 2016-10-17 15:24:09 -0500 |
commit | 4d5bb68d58f12885ea06fb73d5e17d8c780c9ff8 (patch) | |
tree | 9388a9c030c05bb8780a8bfaa1ff962f2dac1afb /subcmds/status.py | |
parent | 82f67987a3e665f9c66e8fb944042a1b4815b61b (diff) | |
download | git-repo-4d5bb68d58f12885ea06fb73d5e17d8c780c9ff8.tar.gz |
status: add -q/--quiet option
The --quiet option reduces the output to just
a list of projects with modified workspaces (and
orphans if -o is specified)
A common use case is when performing a full-workspace
merge. The integrator will kick-off a merge via:
repo forall -c git merge <some tag>
And then produce a short list of conflicted projects via:
repo status -q
The integrator can then iteratively fix and clean up all conficted
components. The merge is complete when:
repo status -q
returns no output.
Change-Id: Ibbba8713eac35befd8287c95948874e23fd5c7e2
Diffstat (limited to 'subcmds/status.py')
-rw-r--r-- | subcmds/status.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/subcmds/status.py b/subcmds/status.py index 38c229b1..60e26ff4 100644 --- a/subcmds/status.py +++ b/subcmds/status.py | |||
@@ -89,8 +89,10 @@ the following meanings: | |||
89 | p.add_option('-o', '--orphans', | 89 | p.add_option('-o', '--orphans', |
90 | dest='orphans', action='store_true', | 90 | dest='orphans', action='store_true', |
91 | help="include objects in working directory outside of repo projects") | 91 | help="include objects in working directory outside of repo projects") |
92 | p.add_option('-q', '--quiet', action='store_true', | ||
93 | help="only print the name of modified projects") | ||
92 | 94 | ||
93 | def _StatusHelper(self, project, clean_counter, sem): | 95 | def _StatusHelper(self, project, clean_counter, sem, quiet): |
94 | """Obtains the status for a specific project. | 96 | """Obtains the status for a specific project. |
95 | 97 | ||
96 | Obtains the status for a project, redirecting the output to | 98 | Obtains the status for a project, redirecting the output to |
@@ -104,7 +106,7 @@ the following meanings: | |||
104 | output: Where to output the status. | 106 | output: Where to output the status. |
105 | """ | 107 | """ |
106 | try: | 108 | try: |
107 | state = project.PrintWorkTreeStatus() | 109 | state = project.PrintWorkTreeStatus(quiet=quiet) |
108 | if state == 'CLEAN': | 110 | if state == 'CLEAN': |
109 | next(clean_counter) | 111 | next(clean_counter) |
110 | finally: | 112 | finally: |
@@ -132,7 +134,7 @@ the following meanings: | |||
132 | 134 | ||
133 | if opt.jobs == 1: | 135 | if opt.jobs == 1: |
134 | for project in all_projects: | 136 | for project in all_projects: |
135 | state = project.PrintWorkTreeStatus() | 137 | state = project.PrintWorkTreeStatus(quiet=opt.quiet) |
136 | if state == 'CLEAN': | 138 | if state == 'CLEAN': |
137 | next(counter) | 139 | next(counter) |
138 | else: | 140 | else: |
@@ -142,13 +144,13 @@ the following meanings: | |||
142 | sem.acquire() | 144 | sem.acquire() |
143 | 145 | ||
144 | t = _threading.Thread(target=self._StatusHelper, | 146 | t = _threading.Thread(target=self._StatusHelper, |
145 | args=(project, counter, sem)) | 147 | args=(project, counter, sem, opt.quiet)) |
146 | threads.append(t) | 148 | threads.append(t) |
147 | t.daemon = True | 149 | t.daemon = True |
148 | t.start() | 150 | t.start() |
149 | for t in threads: | 151 | for t in threads: |
150 | t.join() | 152 | t.join() |
151 | if len(all_projects) == next(counter): | 153 | if not opt.quiet and len(all_projects) == next(counter): |
152 | print('nothing to commit (working directory clean)') | 154 | print('nothing to commit (working directory clean)') |
153 | 155 | ||
154 | if opt.orphans: | 156 | if opt.orphans: |