OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 # Copyright (C) 2008 Evan Martin <martine@danga.com> | 6 # Copyright (C) 2008 Evan Martin <martine@danga.com> |
7 | 7 |
8 """A git-command for integrating reviews on Rietveld and Gerrit.""" | 8 """A git-command for integrating reviews on Rietveld and Gerrit.""" |
9 | 9 |
10 from __future__ import print_function | 10 from __future__ import print_function |
(...skipping 1443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1454 def GetApprovingReviewers(self): | 1454 def GetApprovingReviewers(self): |
1455 return self._codereview_impl.GetApprovingReviewers() | 1455 return self._codereview_impl.GetApprovingReviewers() |
1456 | 1456 |
1457 def GetMostRecentPatchset(self): | 1457 def GetMostRecentPatchset(self): |
1458 return self._codereview_impl.GetMostRecentPatchset() | 1458 return self._codereview_impl.GetMostRecentPatchset() |
1459 | 1459 |
1460 def __getattr__(self, attr): | 1460 def __getattr__(self, attr): |
1461 # This is because lots of untested code accesses Rietveld-specific stuff | 1461 # This is because lots of untested code accesses Rietveld-specific stuff |
1462 # directly, and it's hard to fix for sure. So, just let it work, and fix | 1462 # directly, and it's hard to fix for sure. So, just let it work, and fix |
1463 # on a case by case basis. | 1463 # on a case by case basis. |
1464 return getattr(self._codereview_impl, attr) | 1464 # Note that child method defines __getattr__ as well, and forwards it here, |
| 1465 # because _RietveldChangelistImpl is not cleaned up yet, and given |
| 1466 # deprecation of Rietveld, it should probably be just removed. |
| 1467 # Until that time, avoid infinite recursion by bypassing __getattr__ |
| 1468 # of implementation class. |
| 1469 return self._codereview_impl.__getattribute__(attr) |
1465 | 1470 |
1466 | 1471 |
1467 class _ChangelistCodereviewBase(object): | 1472 class _ChangelistCodereviewBase(object): |
1468 """Abstract base class encapsulating codereview specifics of a changelist.""" | 1473 """Abstract base class encapsulating codereview specifics of a changelist.""" |
1469 def __init__(self, changelist): | 1474 def __init__(self, changelist): |
1470 self._changelist = changelist # instance of Changelist | 1475 self._changelist = changelist # instance of Changelist |
1471 | 1476 |
1472 def __getattr__(self, attr): | 1477 def __getattr__(self, attr): |
1473 # Forward methods to changelist. | 1478 # Forward methods to changelist. |
1474 # TODO(tandrii): maybe clean up _GerritChangelistImpl and | 1479 # TODO(tandrii): maybe clean up _GerritChangelistImpl and |
(...skipping 3673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5148 if __name__ == '__main__': | 5153 if __name__ == '__main__': |
5149 # These affect sys.stdout so do it outside of main() to simplify mocks in | 5154 # These affect sys.stdout so do it outside of main() to simplify mocks in |
5150 # unit testing. | 5155 # unit testing. |
5151 fix_encoding.fix_encoding() | 5156 fix_encoding.fix_encoding() |
5152 setup_color.init() | 5157 setup_color.init() |
5153 try: | 5158 try: |
5154 sys.exit(main(sys.argv[1:])) | 5159 sys.exit(main(sys.argv[1:])) |
5155 except KeyboardInterrupt: | 5160 except KeyboardInterrupt: |
5156 sys.stderr.write('interrupted\n') | 5161 sys.stderr.write('interrupted\n') |
5157 sys.exit(1) | 5162 sys.exit(1) |
OLD | NEW |