OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2007 Google Inc. | 3 # Copyright 2007 Google Inc. |
4 # | 4 # |
5 # Licensed under the Apache License, Version 2.0 (the "License"); | 5 # Licensed under the Apache License, Version 2.0 (the "License"); |
6 # you may not use this file except in compliance with the License. | 6 # you may not use this file except in compliance with the License. |
7 # You may obtain a copy of the License at | 7 # You may obtain a copy of the License at |
8 # | 8 # |
9 # http://www.apache.org/licenses/LICENSE-2.0 | 9 # http://www.apache.org/licenses/LICENSE-2.0 |
10 # | 10 # |
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 super(GitVCS, self).__init__(options) | 997 super(GitVCS, self).__init__(options) |
998 # Map of filename -> hash of base file. | 998 # Map of filename -> hash of base file. |
999 self.base_hashes = {} | 999 self.base_hashes = {} |
1000 | 1000 |
1001 def GenerateDiff(self, extra_args): | 1001 def GenerateDiff(self, extra_args): |
1002 # This is more complicated than svn's GenerateDiff because we must convert | 1002 # This is more complicated than svn's GenerateDiff because we must convert |
1003 # the diff output to include an svn-style "Index:" line as well as record | 1003 # the diff output to include an svn-style "Index:" line as well as record |
1004 # the hashes of the base files, so we can upload them along with our diff. | 1004 # the hashes of the base files, so we can upload them along with our diff. |
1005 if self.options.revision: | 1005 if self.options.revision: |
1006 extra_args = [self.options.revision] + extra_args | 1006 extra_args = [self.options.revision] + extra_args |
1007 gitdiff = RunShell(["git", "diff", "--full-index"] + extra_args) | 1007 gitdiff = RunShell(["git", "diff", "--no-ext-diff", "--full-index"] + |
| 1008 extra_args) |
1008 svndiff = [] | 1009 svndiff = [] |
1009 filecount = 0 | 1010 filecount = 0 |
1010 filename = None | 1011 filename = None |
1011 for line in gitdiff.splitlines(): | 1012 for line in gitdiff.splitlines(): |
1012 match = re.match(r"diff --git a/(.*) b/.*$", line) | 1013 match = re.match(r"diff --git a/(.*) b/.*$", line) |
1013 if match: | 1014 if match: |
1014 filecount += 1 | 1015 filecount += 1 |
1015 filename = match.group(1) | 1016 filename = match.group(1) |
1016 svndiff.append("Index: %s\n" % filename) | 1017 svndiff.append("Index: %s\n" % filename) |
1017 else: | 1018 else: |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1371 try: | 1372 try: |
1372 RealMain(sys.argv) | 1373 RealMain(sys.argv) |
1373 except KeyboardInterrupt: | 1374 except KeyboardInterrupt: |
1374 print | 1375 print |
1375 StatusUpdate("Interrupted.") | 1376 StatusUpdate("Interrupted.") |
1376 sys.exit(1) | 1377 sys.exit(1) |
1377 | 1378 |
1378 | 1379 |
1379 if __name__ == "__main__": | 1380 if __name__ == "__main__": |
1380 main() | 1381 main() |
OLD | NEW |