The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2008 The Android Open Source Project |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | from command import PagedCommand |
| 17 | |
| 18 | class Diff(PagedCommand): |
| 19 | common = True |
| 20 | helpSummary = "Show changes between commit and working tree" |
| 21 | helpUsage = """ |
| 22 | %prog [<project>...] |
pelya | d67872d | 2012-03-28 14:49:58 +0300 | [diff] [blame] | 23 | |
| 24 | The -u option causes '%prog' to generate diff output with file paths |
| 25 | relative to the repository root, so the output can be applied |
| 26 | to the Unix 'patch' command. |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 27 | """ |
| 28 | |
pelya | d67872d | 2012-03-28 14:49:58 +0300 | [diff] [blame] | 29 | def _Options(self, p): |
| 30 | def cmd(option, opt_str, value, parser): |
| 31 | setattr(parser.values, option.dest, list(parser.rargs)) |
| 32 | while parser.rargs: |
| 33 | del parser.rargs[0] |
| 34 | p.add_option('-u', '--absolute', |
| 35 | dest='absolute', action='store_true', |
| 36 | help='Paths are relative to the repository root') |
| 37 | |
The Android Open Source Project | cf31fe9 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 38 | def Execute(self, opt, args): |
| 39 | for project in self.GetProjects(args): |
pelya | d67872d | 2012-03-28 14:49:58 +0300 | [diff] [blame] | 40 | project.PrintWorkTreeDiff(opt.absolute) |