blob: c987bf231c92d030ed78c4278335b23d40d9cc52 [file] [log] [blame]
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -07001# 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
15from command import PagedCommand
16
David Pursehouse819827a2020-02-12 15:20:19 +090017
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070018class Diff(PagedCommand):
19 common = True
20 helpSummary = "Show changes between commit and working tree"
21 helpUsage = """
22%prog [<project>...]
pelyad67872d2012-03-28 14:49:58 +030023
24The -u option causes '%prog' to generate diff output with file paths
25relative to the repository root, so the output can be applied
26to the Unix 'patch' command.
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070027"""
28
pelyad67872d2012-03-28 14:49:58 +030029 def _Options(self, p):
pelyad67872d2012-03-28 14:49:58 +030030 p.add_option('-u', '--absolute',
31 dest='absolute', action='store_true',
32 help='Paths are relative to the repository root')
33
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070034 def Execute(self, opt, args):
Mike Frysinger0a9265e2019-09-30 23:59:27 -040035 ret = 0
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070036 for project in self.GetProjects(args):
Mike Frysinger0a9265e2019-09-30 23:59:27 -040037 if not project.PrintWorkTreeDiff(opt.absolute):
38 ret = 1
39 return ret