+ @Strip
+ # Copied from bot_update.py and modified for svn-like numbers only.
+ def GetCommitPositionNumber(self, git_hash, **kwargs):
+ """Dumps the 'git' log for a specific revision and parses out the commit
+ position number.
+
+ If a commit position metadata key is found, its number will be returned.
+
+ Otherwise, we will search for a 'git-svn' metadata entry. If one is found,
+ its SVN revision value is returned.
+ """
+ git_log = self.GitLog(format='%B', n=1, git_hash=git_hash, **kwargs)
+ footer_map = GetCommitMessageFooterMap(git_log)
+
+ # Search for commit position metadata
+ value = footer_map.get(COMMIT_POSITION_FOOTER_KEY)
+ if value:
+ match = COMMIT_POSITION_RE.match(value)
+ if match:
+ return match.group(2)
+
+ # Extract the svn revision from 'git-svn' metadata
+ value = footer_map.get(GIT_SVN_ID_FOOTER_KEY)
+ if value:
+ match = GIT_SVN_ID_RE.match(value)
+ if match:
+ return match.group(2)
+ return None
+
+ ### Git svn stuff
+
+ def GitSVNFetch(self, **kwargs):
+ self.Git("svn fetch", **kwargs)
+
+ def GitSVNRebase(self, **kwargs):
+ self.Git("svn rebase", **kwargs)