Add a way to ascertain the SVN URL associated with a Git branch.
authormatthew_hanson@apple.com <matthew_hanson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Nov 2014 04:49:49 +0000 (04:49 +0000)
committermatthew_hanson@apple.com <matthew_hanson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Nov 2014 04:49:49 +0000 (04:49 +0000)
https://bugs.webkit.org/show_bug.cgi?id=138374

The svn_url method returns the SVN URL associated with the current Git branch.

Reviewed by NOBODY (OOPS!).

* Scripts/webkitpy/common/checkout/scm/git.py:
(Git.svn_url): Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175605 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/common/checkout/scm/git.py

index 3e237b0ef6b63116b49d15d37c0aafd9091294c3..ac81dd39d2899614d89eb0c02552cc5fba1575aa 100644 (file)
@@ -1,3 +1,15 @@
+2014-11-04  Matthew Hanson  <matthew_hanson@apple.com>
+
+        Add a way to ascertain the SVN URL associated with a Git branch.
+        https://bugs.webkit.org/show_bug.cgi?id=138374
+
+        Reviewed by Ryosuke Niwa.
+
+        The svn_url method returns the SVN URL associated with the current Git branch.
+
+        * Scripts/webkitpy/common/checkout/scm/git.py:
+        (Git.svn_url): Added.
+
 2014-11-04  Matthew Hanson  <matthew_hanson@apple.com>
 
         Add the ability to search for modifications that are staged for commit.
index 1775fe3a27045241f6524658ba26440476454452..ae614d2a4293633d791ac8749fe501d26d78d358 100644 (file)
@@ -272,6 +272,14 @@ class Git(SCM, SVNRepository):
             return ""
         return str(match.group('svn_revision'))
 
+    def svn_url(self):
+        git_command = ['svn', 'info']
+        status = self._run_git(git_command)
+        match = re.search(r'^URL: (?P<url>.*)$', status, re.MULTILINE)
+        if not match:
+            return ""
+        return match.group('url')
+
     def timestamp_of_revision(self, path, revision):
         git_log = self._most_recent_log_matching('git-svn-id:.*@%s' % revision, path)
         match = re.search("^Date:\s*(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2}) ([+-])(\d{2})(\d{2})$", git_log, re.MULTILINE)