Chromium Code Reviews| Index: gclient_scm.py |
| =================================================================== |
| --- gclient_scm.py (revision 107937) |
| +++ gclient_scm.py (working copy) |
| @@ -476,6 +476,24 @@ |
| files = self._Capture(['diff', '--name-only', merge_base]).split() |
| file_list.extend([os.path.join(self.checkout_path, f) for f in files]) |
| + def FindSafesyncRev(self, rev): |
| + # If this doesn't look like a Subversion revision (just numbers), pass it |
|
M-A Ruel
2011/10/31 13:46:51
Please add a proper docstring.
Dan Beam
2011/11/06 07:34:08
Done.
|
| + # back as maybe somebody's made a git LKGR page? TODO(dbeam): Test if sha1? |
| + if not rev.isdigit(): |
|
M-A Ruel
2011/10/31 13:46:51
Also look for "or len(rev) > 7"
We'll revision onc
Dan Beam
2011/11/06 07:34:08
Done.
|
| + return rev |
| + # This probably only works if using git-svn, as the LKGR is only based on |
| + # SVN revisions at the moment. |
| + if not scm.GIT.IsGitSvn(cwd=self.checkout_path): |
| + help_url = ''.join(['http://code.google.com/p/chromium/wiki/UsingNewGit', |
| + '#Initial_checkout']) |
| + print('WARNING: Safesync URLs currently require a git-svn remote.\n' |
| + ' Please add a git-svn remote or remove the safesync_url.\n' |
| + ' %s\n' % help_url) |
| + return '' |
|
M-A Ruel
2011/10/31 13:46:51
No, '01234567' could still be a valid short hash.
Dan Beam
2011/11/06 07:34:08
Done.
|
| + # Otherwise, if using git-svn, let's search the index for a sha1 that |
| + # matches this Subversion revision (the current LKGR format). |
| + return scm.GIT.GetSha1ForSvnRev(cwd=self.checkout_path, rev=rev) |
| + |
| def FullUrlForRelativeUrl(self, url): |
| # Strip from last '/' |
| # Equivalent to unix basename |
| @@ -986,6 +1004,20 @@ |
| else: |
| self._RunAndGetFileList(command, options, file_list) |
| + # pylint: disable-msg=r0201 |
| + def FindSafesyncRev(self, rev): |
|
M-A Ruel
2011/10/31 13:46:51
Make it a @staticmethod instead of disabling the w
Dan Beam
2011/11/06 07:34:08
Done.
|
| + # If the SCM currently being used is Subversion, and it appears we were |
| + # passed a Subversion |rev| number, just return the same |rev|. |
| + if rev.isdigit(): |
| + return rev |
| + # If the SCM currently being used is Subversion, but we receieved a |
| + # non-numeric response, ignore the safesync_url's response in this case. |
| + print('WARNING: The content of safesync_url is currently assumed to be\n' |
| + ' only a Subversion revision when using a Subversion check\n' |
| + ' out, but the response was not a number.\n' |
| + ' Ignoring for now.\n') |
| + return '' |
| + |
| def FullUrlForRelativeUrl(self, url): |
| # Find the forth '/' and strip from there. A bit hackish. |
| return '/'.join(self.url.split('/')[:4]) + url |