OLD | NEW |
1 # Copyright (c) 2009, 2010, 2011 Google Inc. All rights reserved. | 1 # Copyright (c) 2009, 2010, 2011 Google Inc. All rights reserved. |
2 # Copyright (c) 2009 Apple Inc. All rights reserved. | 2 # Copyright (c) 2009 Apple Inc. All rights reserved. |
3 # | 3 # |
4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
6 # met: | 6 # met: |
7 # | 7 # |
8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 # FIXME: What about files which are not committed yet? | 113 # FIXME: What about files which are not committed yet? |
114 return self._run_svn(["diff"], cwd=self.checkout_root, decode_output=Fal
se) != "" | 114 return self._run_svn(["diff"], cwd=self.checkout_root, decode_output=Fal
se) != "" |
115 | 115 |
116 def status_command(self): | 116 def status_command(self): |
117 return [self.executable_name, 'status'] | 117 return [self.executable_name, 'status'] |
118 | 118 |
119 def _status_regexp(self, expected_types): | 119 def _status_regexp(self, expected_types): |
120 field_count = 6 if self._svn_version() > "1.6" else 5 | 120 field_count = 6 if self._svn_version() > "1.6" else 5 |
121 return "^(?P<status>[%s]).{%s} (?P<filename>.+)$" % (expected_types, fie
ld_count) | 121 return "^(?P<status>[%s]).{%s} (?P<filename>.+)$" % (expected_types, fie
ld_count) |
122 | 122 |
123 def _add_parent_directories(self, path): | 123 def _add_parent_directories(self, path, recurse): |
124 """Does 'svn add' to the path and its parents.""" | 124 """Does 'svn add' to the path and its parents.""" |
125 if self.in_working_directory(path): | 125 if self.in_working_directory(path): |
126 return | 126 return |
127 self.add(path) | 127 self.add(path, recurse=recurse) |
128 | 128 |
129 def add_list(self, paths, return_exit_code=False): | 129 def add_list(self, paths, return_exit_code=False, recurse=True): |
130 for path in paths: | 130 for path in paths: |
131 self._add_parent_directories(os.path.dirname(os.path.abspath(path))) | 131 self._add_parent_directories(os.path.dirname(os.path.abspath(path)), |
132 return self._run_svn(["add"] + paths, return_exit_code=return_exit_code) | 132 recurse=False) |
| 133 if recurse: |
| 134 cmd = ["add"] + paths |
| 135 else: |
| 136 cmd = ["add", "--depth", "empty"] + paths |
| 137 return self._run_svn(cmd, return_exit_code=return_exit_code) |
133 | 138 |
134 def _delete_parent_directories(self, path): | 139 def _delete_parent_directories(self, path): |
135 if not self.in_working_directory(path): | 140 if not self.in_working_directory(path): |
136 return | 141 return |
137 if set(os.listdir(path)) - self._svn_metadata_files: | 142 if set(os.listdir(path)) - self._svn_metadata_files: |
138 return # Directory has non-trivial files in it. | 143 return # Directory has non-trivial files in it. |
139 self.delete(path) | 144 self.delete(path) |
140 | 145 |
141 def delete_list(self, paths): | 146 def delete_list(self, paths): |
142 for path in paths: | 147 for path in paths: |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 if changed_files == []: | 193 if changed_files == []: |
189 return "" | 194 return "" |
190 elif changed_files == None: | 195 elif changed_files == None: |
191 changed_files = [] | 196 changed_files = [] |
192 return self._run([self._filesystem.join(self.checkout_root, 'Tools', 'Sc
ripts', 'svn-create-patch')] + changed_files, | 197 return self._run([self._filesystem.join(self.checkout_root, 'Tools', 'Sc
ripts', 'svn-create-patch')] + changed_files, |
193 cwd=self.checkout_root, return_stderr=False, | 198 cwd=self.checkout_root, return_stderr=False, |
194 decode_output=False) | 199 decode_output=False) |
195 | 200 |
196 def blame(self, path): | 201 def blame(self, path): |
197 return self._run_svn(['blame', path]) | 202 return self._run_svn(['blame', path]) |
OLD | NEW |