OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # This file is part of Adblock Plus <https://adblockplus.org/>, | 3 # This file is part of Adblock Plus <https://adblockplus.org/>, |
4 # Copyright (C) 2006-present eyeo GmbH | 4 # Copyright (C) 2006-present eyeo GmbH |
5 # | 5 # |
6 # Adblock Plus is free software: you can redistribute it and/or modify | 6 # Adblock Plus is free software: you can redistribute it and/or modify |
7 # it under the terms of the GNU General Public License version 3 as | 7 # it under the terms of the GNU General Public License version 3 as |
8 # published by the Free Software Foundation. | 8 # published by the Free Software Foundation. |
9 # | 9 # |
10 # Adblock Plus is distributed in the hope that it will be useful, | 10 # Adblock Plus is distributed in the hope that it will be useful, |
(...skipping 21 matching lines...) Expand all Loading... |
32 Rietveld format looks similar to SVN patch format but it can also | 32 Rietveld format looks similar to SVN patch format but it can also |
33 contain Git extensions if it was produced by `upload.py` run from | 33 contain Git extensions if it was produced by `upload.py` run from |
34 a project managed by Git or Mercurial. The output format is the | 34 a project managed by Git or Mercurial. The output format is the |
35 original Git patch as produced by `git diff` or `hg diff --git`. | 35 original Git patch as produced by `git diff` or `hg diff --git`. |
36 It can be applied by `hg import` or `git apply`. | 36 It can be applied by `hg import` or `git apply`. |
37 | 37 |
38 Arguments: | 38 Arguments: |
39 lines -- lines of the patch. | 39 lines -- lines of the patch. |
40 Returns: | 40 Returns: |
41 Lines of the converted patch. | 41 Lines of the converted patch. |
| 42 |
42 """ | 43 """ |
43 state = NORMAL | 44 state = NORMAL |
44 new_name = None | 45 new_name = None |
45 | 46 |
46 for line in lines: | 47 for line in lines: |
47 if state is NORMAL: | 48 if state is NORMAL: |
48 if line.startswith('Index: '): | 49 if line.startswith('Index: '): |
49 new_name = line[7:].strip('\n') | 50 new_name = line[7:].strip('\n') |
50 state = INDEX | 51 state = INDEX |
51 else: | 52 else: |
(...skipping 21 matching lines...) Expand all Loading... |
73 state = NORMAL | 74 state = NORMAL |
74 | 75 |
75 | 76 |
76 def main(): | 77 def main(): |
77 for line in rietveld_to_git(sys.stdin): | 78 for line in rietveld_to_git(sys.stdin): |
78 sys.stdout.write(line) | 79 sys.stdout.write(line) |
79 | 80 |
80 | 81 |
81 if __name__ == '__main__': | 82 if __name__ == '__main__': |
82 main() | 83 main() |
OLD | NEW |