The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1 | # Copyright (C) 2008 The Android Open Source Project |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
Mike Frysinger | b5d075d | 2021-03-01 00:56:38 -0500 | [diff] [blame] | 15 | import multiprocessing |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 16 | import os |
| 17 | import optparse |
Conley Owens | d21720d | 2012-04-16 11:02:21 -0700 | [diff] [blame] | 18 | import platform |
Colin Cross | 5acde75 | 2012-03-28 20:15:45 -0700 | [diff] [blame] | 19 | import re |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 20 | import sys |
| 21 | |
David Riley | e0684ad | 2017-04-05 00:02:59 -0700 | [diff] [blame] | 22 | from event_log import EventLog |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 23 | from error import NoSuchProjectError |
Colin Cross | 5acde75 | 2012-03-28 20:15:45 -0700 | [diff] [blame] | 24 | from error import InvalidProjectGroupsError |
Mike Frysinger | b5d075d | 2021-03-01 00:56:38 -0500 | [diff] [blame] | 25 | import progress |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 26 | |
David Pursehouse | b148ac9 | 2012-11-16 09:33:39 +0900 | [diff] [blame] | 27 | |
Mike Frysinger | 7c87116 | 2021-02-16 01:45:39 -0500 | [diff] [blame] | 28 | # Number of projects to submit to a single worker process at a time. |
| 29 | # This number represents a tradeoff between the overhead of IPC and finer |
| 30 | # grained opportunity for parallelism. This particular value was chosen by |
| 31 | # iterating through powers of two until the overall performance no longer |
| 32 | # improved. The performance of this batch size is not a function of the |
| 33 | # number of cores on the system. |
| 34 | WORKER_BATCH_SIZE = 32 |
| 35 | |
| 36 | |
Mike Frysinger | 6a2400a | 2021-02-16 01:43:31 -0500 | [diff] [blame] | 37 | # How many jobs to run in parallel by default? This assumes the jobs are |
| 38 | # largely I/O bound and do not hit the network. |
| 39 | DEFAULT_LOCAL_JOBS = min(os.cpu_count(), 8) |
| 40 | |
| 41 | |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 42 | class Command(object): |
| 43 | """Base class for any command line action in repo. |
| 44 | """ |
| 45 | |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 46 | manifest = None |
| 47 | _optparse = None |
| 48 | |
Mike Frysinger | d88b369 | 2021-06-14 16:09:29 -0400 | [diff] [blame^] | 49 | # Singleton for all commands to track overall repo command execution and |
| 50 | # provide event summary to callers. Only used by sync subcommand currently. |
| 51 | # |
| 52 | # NB: This is being replaced by git trace2 events. See git_trace2_event_log. |
| 53 | event_log = EventLog() |
| 54 | |
Mike Frysinger | 4f21054 | 2021-06-14 16:05:19 -0400 | [diff] [blame] | 55 | # Whether this command is a "common" one, i.e. whether the user would commonly |
| 56 | # use it or it's a more uncommon command. This is used by the help command to |
| 57 | # show short-vs-full summaries. |
| 58 | COMMON = False |
| 59 | |
Mike Frysinger | 6a2400a | 2021-02-16 01:43:31 -0500 | [diff] [blame] | 60 | # Whether this command supports running in parallel. If greater than 0, |
| 61 | # it is the number of parallel jobs to default to. |
| 62 | PARALLEL_JOBS = None |
| 63 | |
Mark E. Hamilton | 8ccfa74 | 2016-02-10 10:44:30 -0700 | [diff] [blame] | 64 | def WantPager(self, _opt): |
Shawn O. Pearce | db45da1 | 2009-04-18 13:49:13 -0700 | [diff] [blame] | 65 | return False |
| 66 | |
David Pursehouse | b148ac9 | 2012-11-16 09:33:39 +0900 | [diff] [blame] | 67 | def ReadEnvironmentOptions(self, opts): |
| 68 | """ Set options from environment variables. """ |
| 69 | |
| 70 | env_options = self._RegisteredEnvironmentOptions() |
| 71 | |
| 72 | for env_key, opt_key in env_options.items(): |
| 73 | # Get the user-set option value if any |
| 74 | opt_value = getattr(opts, opt_key) |
| 75 | |
| 76 | # If the value is set, it means the user has passed it as a command |
| 77 | # line option, and we should use that. Otherwise we can try to set it |
| 78 | # with the value from the corresponding environment variable. |
| 79 | if opt_value is not None: |
| 80 | continue |
| 81 | |
| 82 | env_value = os.environ.get(env_key) |
| 83 | if env_value is not None: |
| 84 | setattr(opts, opt_key, env_value) |
| 85 | |
| 86 | return opts |
| 87 | |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 88 | @property |
| 89 | def OptionParser(self): |
| 90 | if self._optparse is None: |
| 91 | try: |
| 92 | me = 'repo %s' % self.NAME |
| 93 | usage = self.helpUsage.strip().replace('%prog', me) |
| 94 | except AttributeError: |
| 95 | usage = 'repo %s' % self.NAME |
Mike Frysinger | 72ebf19 | 2020-02-19 01:20:18 -0500 | [diff] [blame] | 96 | epilog = 'Run `repo help %s` to view the detailed manual.' % self.NAME |
| 97 | self._optparse = optparse.OptionParser(usage=usage, epilog=epilog) |
Mike Frysinger | 9180a07 | 2021-04-13 14:57:40 -0400 | [diff] [blame] | 98 | self._CommonOptions(self._optparse) |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 99 | self._Options(self._optparse) |
| 100 | return self._optparse |
| 101 | |
Mike Frysinger | 9180a07 | 2021-04-13 14:57:40 -0400 | [diff] [blame] | 102 | def _CommonOptions(self, p, opt_v=True): |
| 103 | """Initialize the option parser with common options. |
| 104 | |
| 105 | These will show up for *all* subcommands, so use sparingly. |
| 106 | NB: Keep in sync with repo:InitParser(). |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 107 | """ |
Mike Frysinger | 9180a07 | 2021-04-13 14:57:40 -0400 | [diff] [blame] | 108 | g = p.add_option_group('Logging options') |
| 109 | opts = ['-v'] if opt_v else [] |
| 110 | g.add_option(*opts, '--verbose', |
| 111 | dest='output_mode', action='store_true', |
| 112 | help='show all output') |
| 113 | g.add_option('-q', '--quiet', |
| 114 | dest='output_mode', action='store_false', |
| 115 | help='only show errors') |
| 116 | |
Mike Frysinger | 6a2400a | 2021-02-16 01:43:31 -0500 | [diff] [blame] | 117 | if self.PARALLEL_JOBS is not None: |
| 118 | p.add_option( |
| 119 | '-j', '--jobs', |
| 120 | type=int, default=self.PARALLEL_JOBS, |
| 121 | help='number of jobs to run in parallel (default: %s)' % self.PARALLEL_JOBS) |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 122 | |
Mike Frysinger | 9180a07 | 2021-04-13 14:57:40 -0400 | [diff] [blame] | 123 | def _Options(self, p): |
| 124 | """Initialize the option parser with subcommand-specific options.""" |
| 125 | |
David Pursehouse | b148ac9 | 2012-11-16 09:33:39 +0900 | [diff] [blame] | 126 | def _RegisteredEnvironmentOptions(self): |
| 127 | """Get options that can be set from environment variables. |
| 128 | |
| 129 | Return a dictionary mapping environment variable name |
| 130 | to option key name that it can override. |
| 131 | |
| 132 | Example: {'REPO_MY_OPTION': 'my_option'} |
| 133 | |
| 134 | Will allow the option with key value 'my_option' to be set |
| 135 | from the value in the environment variable named 'REPO_MY_OPTION'. |
| 136 | |
| 137 | Note: This does not work properly for options that are explicitly |
| 138 | set to None by the user, or options that are defined with a |
| 139 | default value other than None. |
| 140 | |
| 141 | """ |
| 142 | return {} |
| 143 | |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 144 | def Usage(self): |
| 145 | """Display usage and terminate. |
| 146 | """ |
| 147 | self.OptionParser.print_usage() |
| 148 | sys.exit(1) |
| 149 | |
Mike Frysinger | 9180a07 | 2021-04-13 14:57:40 -0400 | [diff] [blame] | 150 | def CommonValidateOptions(self, opt, args): |
| 151 | """Validate common options.""" |
| 152 | opt.quiet = opt.output_mode is False |
| 153 | opt.verbose = opt.output_mode is True |
| 154 | |
Mike Frysinger | ae6cb08 | 2019-08-27 01:10:59 -0400 | [diff] [blame] | 155 | def ValidateOptions(self, opt, args): |
| 156 | """Validate the user options & arguments before executing. |
| 157 | |
| 158 | This is meant to help break the code up into logical steps. Some tips: |
| 159 | * Use self.OptionParser.error to display CLI related errors. |
| 160 | * Adjust opt member defaults as makes sense. |
| 161 | * Adjust the args list, but do so inplace so the caller sees updates. |
| 162 | * Try to avoid updating self state. Leave that to Execute. |
| 163 | """ |
| 164 | |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 165 | def Execute(self, opt, args): |
| 166 | """Perform the action, after option parsing is complete. |
| 167 | """ |
| 168 | raise NotImplementedError |
Conley Owens | 971de8e | 2012-04-16 10:36:08 -0700 | [diff] [blame] | 169 | |
Mike Frysinger | b5d075d | 2021-03-01 00:56:38 -0500 | [diff] [blame] | 170 | @staticmethod |
| 171 | def ExecuteInParallel(jobs, func, inputs, callback, output=None, ordered=False): |
| 172 | """Helper for managing parallel execution boiler plate. |
| 173 | |
| 174 | For subcommands that can easily split their work up. |
| 175 | |
| 176 | Args: |
| 177 | jobs: How many parallel processes to use. |
| 178 | func: The function to apply to each of the |inputs|. Usually a |
| 179 | functools.partial for wrapping additional arguments. It will be run |
| 180 | in a separate process, so it must be pickalable, so nested functions |
| 181 | won't work. Methods on the subcommand Command class should work. |
| 182 | inputs: The list of items to process. Must be a list. |
| 183 | callback: The function to pass the results to for processing. It will be |
| 184 | executed in the main thread and process the results of |func| as they |
| 185 | become available. Thus it may be a local nested function. Its return |
| 186 | value is passed back directly. It takes three arguments: |
| 187 | - The processing pool (or None with one job). |
| 188 | - The |output| argument. |
| 189 | - An iterator for the results. |
| 190 | output: An output manager. May be progress.Progess or color.Coloring. |
| 191 | ordered: Whether the jobs should be processed in order. |
| 192 | |
| 193 | Returns: |
| 194 | The |callback| function's results are returned. |
| 195 | """ |
| 196 | try: |
| 197 | # NB: Multiprocessing is heavy, so don't spin it up for one job. |
| 198 | if len(inputs) == 1 or jobs == 1: |
| 199 | return callback(None, output, (func(x) for x in inputs)) |
| 200 | else: |
| 201 | with multiprocessing.Pool(jobs) as pool: |
| 202 | submit = pool.imap if ordered else pool.imap_unordered |
| 203 | return callback(pool, output, submit(func, inputs, chunksize=WORKER_BATCH_SIZE)) |
| 204 | finally: |
| 205 | if isinstance(output, progress.Progress): |
| 206 | output.end() |
| 207 | |
Che-Liang Chiou | b2bd91c | 2012-01-11 11:28:42 +0800 | [diff] [blame] | 208 | def _ResetPathToProjectMap(self, projects): |
| 209 | self._by_path = dict((p.worktree, p) for p in projects) |
| 210 | |
| 211 | def _UpdatePathToProjectMap(self, project): |
| 212 | self._by_path[project.worktree] = project |
| 213 | |
Simran Basi | b9a1b73 | 2015-08-20 12:19:28 -0700 | [diff] [blame] | 214 | def _GetProjectByPath(self, manifest, path): |
Che-Liang Chiou | b2bd91c | 2012-01-11 11:28:42 +0800 | [diff] [blame] | 215 | project = None |
| 216 | if os.path.exists(path): |
| 217 | oldpath = None |
David Pursehouse | 5a2517f | 2020-02-12 14:55:01 +0900 | [diff] [blame] | 218 | while (path and |
| 219 | path != oldpath and |
| 220 | path != manifest.topdir): |
Che-Liang Chiou | b2bd91c | 2012-01-11 11:28:42 +0800 | [diff] [blame] | 221 | try: |
| 222 | project = self._by_path[path] |
| 223 | break |
| 224 | except KeyError: |
| 225 | oldpath = path |
| 226 | path = os.path.dirname(path) |
Mark E. Hamilton | f9fe3e1 | 2016-02-23 18:10:42 -0700 | [diff] [blame] | 227 | if not project and path == manifest.topdir: |
| 228 | try: |
| 229 | project = self._by_path[path] |
| 230 | except KeyError: |
| 231 | pass |
Che-Liang Chiou | b2bd91c | 2012-01-11 11:28:42 +0800 | [diff] [blame] | 232 | else: |
| 233 | try: |
| 234 | project = self._by_path[path] |
| 235 | except KeyError: |
| 236 | pass |
| 237 | return project |
| 238 | |
Simran Basi | b9a1b73 | 2015-08-20 12:19:28 -0700 | [diff] [blame] | 239 | def GetProjects(self, args, manifest=None, groups='', missing_ok=False, |
| 240 | submodules_ok=False): |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 241 | """A list of projects that match the arguments. |
| 242 | """ |
Simran Basi | b9a1b73 | 2015-08-20 12:19:28 -0700 | [diff] [blame] | 243 | if not manifest: |
| 244 | manifest = self.manifest |
| 245 | all_projects_list = manifest.projects |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 246 | result = [] |
| 247 | |
Simran Basi | b9a1b73 | 2015-08-20 12:19:28 -0700 | [diff] [blame] | 248 | mp = manifest.manifestProject |
Colin Cross | 5acde75 | 2012-03-28 20:15:45 -0700 | [diff] [blame] | 249 | |
Graham Christensen | 0369a06 | 2015-07-29 17:02:54 -0500 | [diff] [blame] | 250 | if not groups: |
Raman Tenneti | 080877e | 2021-03-09 15:19:06 -0800 | [diff] [blame] | 251 | groups = manifest.GetGroupsStr() |
David Pursehouse | 1d947b3 | 2012-10-25 12:23:11 +0900 | [diff] [blame] | 252 | groups = [x for x in re.split(r'[,\s]+', groups) if x] |
Colin Cross | 5acde75 | 2012-03-28 20:15:45 -0700 | [diff] [blame] | 253 | |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 254 | if not args: |
Che-Liang Chiou | b2bd91c | 2012-01-11 11:28:42 +0800 | [diff] [blame] | 255 | derived_projects = {} |
| 256 | for project in all_projects_list: |
| 257 | if submodules_ok or project.sync_s: |
| 258 | derived_projects.update((p.name, p) |
| 259 | for p in project.GetDerivedSubprojects()) |
| 260 | all_projects_list.extend(derived_projects.values()) |
| 261 | for project in all_projects_list: |
Mark E. Hamilton | 8ccfa74 | 2016-02-10 10:44:30 -0700 | [diff] [blame] | 262 | if (missing_ok or project.Exists) and project.MatchesGroups(groups): |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 263 | result.append(project) |
| 264 | else: |
David James | 8d20116 | 2013-10-11 17:03:19 -0700 | [diff] [blame] | 265 | self._ResetPathToProjectMap(all_projects_list) |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 266 | |
| 267 | for arg in args: |
Mike Frysinger | e778e57 | 2019-10-04 14:21:41 -0400 | [diff] [blame] | 268 | # We have to filter by manifest groups in case the requested project is |
| 269 | # checked out multiple times or differently based on them. |
| 270 | projects = [project for project in manifest.GetProjectsWithName(arg) |
| 271 | if project.MatchesGroups(groups)] |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 272 | |
David James | 8d20116 | 2013-10-11 17:03:19 -0700 | [diff] [blame] | 273 | if not projects: |
Anthony Newnam | df14a70 | 2011-01-09 17:31:57 -0800 | [diff] [blame] | 274 | path = os.path.abspath(arg).replace('\\', '/') |
Simran Basi | b9a1b73 | 2015-08-20 12:19:28 -0700 | [diff] [blame] | 275 | project = self._GetProjectByPath(manifest, path) |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 276 | |
Che-Liang Chiou | b2bd91c | 2012-01-11 11:28:42 +0800 | [diff] [blame] | 277 | # If it's not a derived project, update path->project mapping and |
| 278 | # search again, as arg might actually point to a derived subproject. |
Mark E. Hamilton | 8ccfa74 | 2016-02-10 10:44:30 -0700 | [diff] [blame] | 279 | if (project and not project.Derived and (submodules_ok or |
| 280 | project.sync_s)): |
Che-Liang Chiou | b2bd91c | 2012-01-11 11:28:42 +0800 | [diff] [blame] | 281 | search_again = False |
| 282 | for subproject in project.GetDerivedSubprojects(): |
| 283 | self._UpdatePathToProjectMap(subproject) |
| 284 | search_again = True |
| 285 | if search_again: |
Simran Basi | b9a1b73 | 2015-08-20 12:19:28 -0700 | [diff] [blame] | 286 | project = self._GetProjectByPath(manifest, path) or project |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 287 | |
David James | 8d20116 | 2013-10-11 17:03:19 -0700 | [diff] [blame] | 288 | if project: |
| 289 | projects = [project] |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 290 | |
David James | 8d20116 | 2013-10-11 17:03:19 -0700 | [diff] [blame] | 291 | if not projects: |
| 292 | raise NoSuchProjectError(arg) |
| 293 | |
| 294 | for project in projects: |
| 295 | if not missing_ok and not project.Exists: |
Mike Frysinger | e778e57 | 2019-10-04 14:21:41 -0400 | [diff] [blame] | 296 | raise NoSuchProjectError('%s (%s)' % (arg, project.relpath)) |
David James | 8d20116 | 2013-10-11 17:03:19 -0700 | [diff] [blame] | 297 | if not project.MatchesGroups(groups): |
| 298 | raise InvalidProjectGroupsError(arg) |
| 299 | |
| 300 | result.extend(projects) |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 301 | |
| 302 | def _getpath(x): |
| 303 | return x.relpath |
| 304 | result.sort(key=_getpath) |
| 305 | return result |
| 306 | |
Takeshi Kanemoto | 1f05644 | 2016-01-26 14:11:35 +0900 | [diff] [blame] | 307 | def FindProjects(self, args, inverse=False): |
Zhiguang Li | a8864fb | 2013-03-15 10:32:10 +0800 | [diff] [blame] | 308 | result = [] |
David Pursehouse | 84c4d3c | 2013-04-30 10:57:37 +0900 | [diff] [blame] | 309 | patterns = [re.compile(r'%s' % a, re.IGNORECASE) for a in args] |
Zhiguang Li | a8864fb | 2013-03-15 10:32:10 +0800 | [diff] [blame] | 310 | for project in self.GetProjects(''): |
David Pursehouse | 84c4d3c | 2013-04-30 10:57:37 +0900 | [diff] [blame] | 311 | for pattern in patterns: |
Takeshi Kanemoto | 1f05644 | 2016-01-26 14:11:35 +0900 | [diff] [blame] | 312 | match = pattern.search(project.name) or pattern.search(project.relpath) |
| 313 | if not inverse and match: |
Zhiguang Li | a8864fb | 2013-03-15 10:32:10 +0800 | [diff] [blame] | 314 | result.append(project) |
| 315 | break |
Takeshi Kanemoto | 1f05644 | 2016-01-26 14:11:35 +0900 | [diff] [blame] | 316 | if inverse and match: |
| 317 | break |
| 318 | else: |
| 319 | if inverse: |
| 320 | result.append(project) |
Zhiguang Li | a8864fb | 2013-03-15 10:32:10 +0800 | [diff] [blame] | 321 | result.sort(key=lambda project: project.relpath) |
| 322 | return result |
| 323 | |
Mark E. Hamilton | 8ccfa74 | 2016-02-10 10:44:30 -0700 | [diff] [blame] | 324 | |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 325 | class InteractiveCommand(Command): |
| 326 | """Command which requires user interaction on the tty and |
| 327 | must not run within a pager, even if the user asks to. |
| 328 | """ |
David Pursehouse | 819827a | 2020-02-12 15:20:19 +0900 | [diff] [blame] | 329 | |
Mark E. Hamilton | 8ccfa74 | 2016-02-10 10:44:30 -0700 | [diff] [blame] | 330 | def WantPager(self, _opt): |
Shawn O. Pearce | db45da1 | 2009-04-18 13:49:13 -0700 | [diff] [blame] | 331 | return False |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 332 | |
Mark E. Hamilton | 8ccfa74 | 2016-02-10 10:44:30 -0700 | [diff] [blame] | 333 | |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 334 | class PagedCommand(Command): |
| 335 | """Command which defaults to output in a pager, as its |
| 336 | display tends to be larger than one screen full. |
| 337 | """ |
David Pursehouse | 819827a | 2020-02-12 15:20:19 +0900 | [diff] [blame] | 338 | |
Mark E. Hamilton | 8ccfa74 | 2016-02-10 10:44:30 -0700 | [diff] [blame] | 339 | def WantPager(self, _opt): |
Shawn O. Pearce | db45da1 | 2009-04-18 13:49:13 -0700 | [diff] [blame] | 340 | return True |
Shawn O. Pearce | c95583b | 2009-03-03 17:47:06 -0800 | [diff] [blame] | 341 | |
Mark E. Hamilton | 8ccfa74 | 2016-02-10 10:44:30 -0700 | [diff] [blame] | 342 | |
Shawn O. Pearce | c95583b | 2009-03-03 17:47:06 -0800 | [diff] [blame] | 343 | class MirrorSafeCommand(object): |
| 344 | """Command permits itself to run within a mirror, |
| 345 | and does not require a working directory. |
| 346 | """ |
Dan Willemsen | 9ff2ece | 2015-08-31 15:45:06 -0700 | [diff] [blame] | 347 | |
Mark E. Hamilton | 8ccfa74 | 2016-02-10 10:44:30 -0700 | [diff] [blame] | 348 | |
Dan Willemsen | 7936064 | 2015-08-31 15:45:06 -0700 | [diff] [blame] | 349 | class GitcAvailableCommand(object): |
Dan Willemsen | 9ff2ece | 2015-08-31 15:45:06 -0700 | [diff] [blame] | 350 | """Command that requires GITC to be available, but does |
| 351 | not require the local client to be a GITC client. |
| 352 | """ |
Dan Willemsen | 7936064 | 2015-08-31 15:45:06 -0700 | [diff] [blame] | 353 | |
Mark E. Hamilton | 8ccfa74 | 2016-02-10 10:44:30 -0700 | [diff] [blame] | 354 | |
Dan Willemsen | 7936064 | 2015-08-31 15:45:06 -0700 | [diff] [blame] | 355 | class GitcClientCommand(object): |
| 356 | """Command that requires the local client to be a GITC |
| 357 | client. |
| 358 | """ |