OLD | NEW |
---|---|
1 ''' | 1 ''' |
2 Copyright 2011 Google Inc. | 2 Copyright 2011 Google Inc. |
3 | 3 |
4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
5 found in the LICENSE file. | 5 found in the LICENSE file. |
6 ''' | 6 ''' |
7 | 7 |
8 import fnmatch | 8 import fnmatch |
9 import os | 9 import os |
10 import re | 10 import re |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
88 def Checkout(self, url, path): | 88 def Checkout(self, url, path): |
89 """Check out a working copy from a repository. | 89 """Check out a working copy from a repository. |
90 Returns stdout as a single string. | 90 Returns stdout as a single string. |
91 | 91 |
92 @param url URL from which to check out the working copy | 92 @param url URL from which to check out the working copy |
93 @param path path (within self._directory) where the local copy will be | 93 @param path path (within self._directory) where the local copy will be |
94 written | 94 written |
95 """ | 95 """ |
96 return self._RunCommand([SVN, 'checkout', url, path]) | 96 return self._RunCommand([SVN, 'checkout', url, path]) |
97 | 97 |
98 def Update(self, path): | 98 def Update(self, path, revision='HEAD'): |
99 """Update the working copy. | 99 """Update the working copy. |
100 Returns stdout as a single string. | 100 Returns stdout as a single string. |
101 | 101 |
102 @param path path (within self._directory) within which to run | 102 @param path path (within self._directory) within which to run |
103 "svn update" | 103 "svn update" |
104 @param revision revision to update to | |
104 """ | 105 """ |
105 return self._RunCommand([SVN, 'update', path]) | 106 return self._RunCommand([SVN, 'update', path, '--revision', revision]) |
borenet
2014/03/10 18:01:12
Does "--revision HEAD" do the right thing? Or sho
epoger
2014/03/10 18:08:54
Yup, it works fine. From "svn help update":
-r
| |
106 | 107 |
107 def ListSubdirs(self, url): | 108 def ListSubdirs(self, url): |
108 """Returns a list of all subdirectories (not files) within a given SVN | 109 """Returns a list of all subdirectories (not files) within a given SVN |
109 url. | 110 url. |
110 | 111 |
111 @param url remote directory to list subdirectories of | 112 @param url remote directory to list subdirectories of |
112 """ | 113 """ |
113 subdirs = [] | 114 subdirs = [] |
114 filenames = self._RunCommand([SVN, 'ls', url]).split('\n') | 115 filenames = self._RunCommand([SVN, 'ls', url]).split('\n') |
115 for filename in filenames: | 116 for filename in filenames: |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
185 def ExportBaseVersionOfFile(self, file_within_repo, dest_path): | 186 def ExportBaseVersionOfFile(self, file_within_repo, dest_path): |
186 """Retrieves a copy of the base version (what you would get if you ran | 187 """Retrieves a copy of the base version (what you would get if you ran |
187 'svn revert') of a file within the repository. | 188 'svn revert') of a file within the repository. |
188 | 189 |
189 @param file_within_repo path to the file within the repo whose base | 190 @param file_within_repo path to the file within the repo whose base |
190 version you wish to obtain | 191 version you wish to obtain |
191 @param dest_path destination to which to write the base content | 192 @param dest_path destination to which to write the base content |
192 """ | 193 """ |
193 self._RunCommand([SVN, 'export', '--revision', 'BASE', '--force', | 194 self._RunCommand([SVN, 'export', '--revision', 'BASE', '--force', |
194 file_within_repo, dest_path]) | 195 file_within_repo, dest_path]) |
OLD | NEW |