Title: [270769] trunk/Tools
Revision
270769
Author
[email protected]
Date
2020-12-14 08:34:33 -0800 (Mon, 14 Dec 2020)

Log Message

[webkitscmpy] Load mock repository data from json file
https://bugs.webkit.org/show_bug.cgi?id=219803
<rdar://problem/72236132>

Reviewed by Stephanie Lewis.

* Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Bump version.
* Scripts/libraries/webkitscmpy/webkitscmpy/mocks/git-repo.json: Added.
* Scripts/libraries/webkitscmpy/webkitscmpy/mocks/local/git.py:
(Git.__init__): Move mock data into git-repo.json.
* Scripts/libraries/webkitscmpy/webkitscmpy/mocks/local/svn.py:
(Svn.__init__): Move mock data into git-repo.json.
* Scripts/libraries/webkitscmpy/webkitscmpy/mocks/remote/svn.py:
(Svn.__init__): Move mock data into git-repo.json.
* Scripts/libraries/webkitscmpy/webkitscmpy/mocks/svn-repo.json: Added.
* Scripts/libraries/webkitscmpy/webkitscmpy/test/find_unittest.py:
* Scripts/libraries/webkitscmpy/webkitscmpy/test/git_unittest.py:
(TestGit.test_tags): Specify tags.
(TestGit.test_tag): Ditto.
(TestGit.test_checkout): Ditto.
* Scripts/libraries/webkitscmpy/webkitscmpy/test/svn_unittest.py:
(TestLocalSvn.test_branches): Remove branch specification.

Modified Paths

Added Paths

Diff

Modified: trunk/Tools/ChangeLog (270768 => 270769)


--- trunk/Tools/ChangeLog	2020-12-14 16:26:26 UTC (rev 270768)
+++ trunk/Tools/ChangeLog	2020-12-14 16:34:33 UTC (rev 270769)
@@ -1,3 +1,28 @@
+2020-12-14  Jonathan Bedard  <[email protected]>
+
+        [webkitscmpy] Load mock repository data from json file
+        https://bugs.webkit.org/show_bug.cgi?id=219803
+        <rdar://problem/72236132>
+
+        Reviewed by Stephanie Lewis.
+
+        * Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Bump version.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/mocks/git-repo.json: Added.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/mocks/local/git.py:
+        (Git.__init__): Move mock data into git-repo.json.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/mocks/local/svn.py:
+        (Svn.__init__): Move mock data into git-repo.json.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/mocks/remote/svn.py:
+        (Svn.__init__): Move mock data into git-repo.json.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/mocks/svn-repo.json: Added.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/test/find_unittest.py:
+        * Scripts/libraries/webkitscmpy/webkitscmpy/test/git_unittest.py:
+        (TestGit.test_tags): Specify tags.
+        (TestGit.test_tag): Ditto.
+        (TestGit.test_checkout): Ditto.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/test/svn_unittest.py:
+        (TestLocalSvn.test_branches): Remove branch specification.
+
 2020-12-13  Andy Estes  <[email protected]>
 
         [Mac] Create a MediaToolbox format reader plug-in for WebM

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py (270768 => 270769)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py	2020-12-14 16:26:26 UTC (rev 270768)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py	2020-12-14 16:34:33 UTC (rev 270769)
@@ -46,7 +46,7 @@
         "Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`"
     )
 
-version = Version(0, 5, 2)
+version = Version(0, 5, 3)
 
 AutoInstall.register(Package('fasteners', Version(0, 15, 0)))
 AutoInstall.register(Package('monotonic', Version(1, 5)))

Added: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/git-repo.json (0 => 270769)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/git-repo.json	                        (rev 0)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/git-repo.json	2020-12-14 16:34:33 UTC (rev 270769)
@@ -0,0 +1,134 @@
+{
+    "main": [
+        {
+            "hash": "9b8311f25a77ba14923d9d5a6532103f54abefcb", 
+            "author": {
+                "name": "Jonathan Bedard", 
+                "emails": [
+                    "[email protected]"
+                ]
+            }, 
+            "timestamp": 1601660000, 
+            "branch": "main", 
+            "message": "1st commit\n", 
+            "identifier": "1@main", 
+            "revision": 1
+        }, 
+        {
+            "hash": "fff83bb2d9171b4d9196e977eb0508fd57e7a08d", 
+            "author": {
+                "name": "Jonathan Bedard", 
+                "emails": [
+                    "[email protected]"
+                ]
+            }, 
+            "timestamp": 1601661000, 
+            "branch": "main", 
+            "message": "2nd commit\n", 
+            "identifier": "2@main", 
+            "revision": 2
+        }, 
+        {
+            "hash": "1abe25b443e985f93b90d830e4a7e3731336af4d", 
+            "author": {
+                "name": "Jonathan Bedard", 
+                "emails": [
+                    "[email protected]"
+                ]
+            }, 
+            "timestamp": 1601663000, 
+            "branch": "main", 
+            "message": "4th commit\n", 
+            "identifier": "3@main", 
+            "revision": 4
+        }, 
+        {
+            "hash": "bae5d1e90999d4f916a8a15810ccfa43f37a2fd6", 
+            "author": {
+                "name": "Jonathan Bedard", 
+                "emails": [
+                    "[email protected]"
+                ]
+            }, 
+            "timestamp": 1601665000, 
+            "branch": "main", 
+            "message": "6th commit\n", 
+            "identifier": "4@main", 
+            "revision": 6
+        }
+    ], 
+    "branch-b": [
+        {
+            "hash": "a30ce8494bf1ac2807a69844f726be4a9843ca55", 
+            "author": {
+                "name": "Jonathan Bedard", 
+                "emails": [
+                    "[email protected]"
+                ]
+            }, 
+            "timestamp": 1601662000, 
+            "branch": "branch-a", 
+            "message": "3rd commit\n", 
+            "identifier": "2.1@branch-a", 
+            "revision": 3
+        }, 
+        {
+            "hash": "3cd32e352410565bb543821fbf856a6d3caad1c4", 
+            "author": {
+                "name": "Jonathan Bedard", 
+                "emails": [
+                    "[email protected]"
+                ]
+            }, 
+            "timestamp": 1601664000, 
+            "branch": "branch-b", 
+            "message": "5th commit\n", 
+            "identifier": "2.2@branch-b", 
+            "revision": 5
+        }, 
+        {
+            "hash": "790725a6d79e28db2ecdde29548d2262c0bd059d", 
+            "author": {
+                "name": "Jonathan Bedard", 
+                "emails": [
+                    "[email protected]"
+                ]
+            }, 
+            "timestamp": 1601667000, 
+            "branch": "branch-b", 
+            "message": "8th commit\n", 
+            "identifier": "2.3@branch-b", 
+            "revision": 8
+        }
+    ], 
+    "branch-a": [
+        {
+            "hash": "a30ce8494bf1ac2807a69844f726be4a9843ca55", 
+            "author": {
+                "name": "Jonathan Bedard", 
+                "emails": [
+                    "[email protected]"
+                ]
+            }, 
+            "timestamp": 1601662000, 
+            "branch": "branch-a", 
+            "message": "3rd commit\n", 
+            "identifier": "2.1@branch-a", 
+            "revision": 3
+        }, 
+        {
+            "hash": "621652add7fc416099bd2063366cc38ff61afe36", 
+            "author": {
+                "name": "Jonathan Bedard", 
+                "emails": [
+                    "[email protected]"
+                ]
+            }, 
+            "timestamp": 1601666000, 
+            "branch": "branch-a", 
+            "message": "7th commit\n", 
+            "identifier": "2.2@branch-a", 
+            "revision": 7
+        }
+    ]
+}
\ No newline at end of file

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/local/git.py (270768 => 270769)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/local/git.py	2020-12-14 16:26:26 UTC (rev 270768)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/local/git.py	2020-12-14 16:34:33 UTC (rev 270769)
@@ -20,6 +20,7 @@
 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+import json
 import os
 import re
 
@@ -31,7 +32,7 @@
 class Git(mocks.Subprocess):
 
     def __init__(
-        self, path='/.invalid-git',
+        self, path='/.invalid-git', datafile=None,
         remote=None, branches=None, tags=None,
         detached=None, default_branch='main',
         git_svn=False,
@@ -49,78 +50,16 @@
         except (OSError, AssertionError):
             self.executable = '/usr/bin/git'
 
-        # Provide a reasonable set of commits to test against
-        contributor = Contributor(name='Jonathan Bedard', emails=['[email protected]'])
-        self.commits = {
-            default_branch: [
-                Commit(
-                    identifier='1@{}'.format(default_branch),
-                    hash='9b8311f25a77ba14923d9d5a6532103f54abefcb',
-                    revision=1 if git_svn else None,
-                    author=contributor,
-                    timestamp=1601660000,
-                    message='1st commit\n',
-                ), Commit(
-                    identifier='2@{}'.format(default_branch),
-                    hash='fff83bb2d9171b4d9196e977eb0508fd57e7a08d',
-                    revision=2 if git_svn else None,
-                    author=contributor,
-                    timestamp=1601661000,
-                    message='2nd commit\n',
-                ), Commit(
-                    identifier='3@{}'.format(default_branch),
-                    hash='1abe25b443e985f93b90d830e4a7e3731336af4d',
-                    revision=4 if git_svn else None,
-                    author=contributor,
-                    timestamp=1601663000,
-                    message='4th commit\n',
-                ), Commit(
-                    identifier='4@{}'.format(default_branch),
-                    hash='bae5d1e90999d4f916a8a15810ccfa43f37a2fd6',
-                    revision=6 if git_svn else None,
-                    author=contributor,
-                    timestamp=1601665000,
-                    message='6th commit\n',
-                ),
-            ], 'branch-a': [
-                Commit(
-                    identifier='2.1@branch-a',
-                    hash='a30ce8494bf1ac2807a69844f726be4a9843ca55',
-                    revision=3 if git_svn else None,
-                    author=contributor,
-                    timestamp=1601662000,
-                    message='3rd commit\n',
-                ), Commit(
-                    identifier='2.2@branch-a',
-                    hash='621652add7fc416099bd2063366cc38ff61afe36',
-                    revision=7 if git_svn else None,
-                    author=contributor,
-                    timestamp=1601666000,
-                    message='7th commit\n',
-                ),
-            ],
-        }
-        self.commits['branch-b'] = [
-            self.commits['branch-a'][0], Commit(
-                identifier='2.2@branch-b',
-                hash='3cd32e352410565bb543821fbf856a6d3caad1c4',
-                revision=5 if git_svn else None,
-                author=contributor,
-                timestamp=1601664000,
-                message='5th commit\n',
-            ), Commit(
-                identifier='2.3@branch-b',
-                hash='790725a6d79e28db2ecdde29548d2262c0bd059d',
-                revision=8 if git_svn else None,
-                author=contributor,
-                timestamp=1601667000,
-                message='8th commit\n',
-            ),
-        ]
-        self.head = self.commits[self.default_branch][3]
+        with open(datafile or os.path.join(os.path.dirname(os.path.dirname(__file__)), 'git-repo.json')) as file:
+            self.commits = json.load(file)
+        for key, commits in self.commits.items():
+            self.commits[key] = [Commit(**kwargs) for kwargs in commits]
+            if not git_svn:
+                for commit in self.commits[key]:
+                    commit.revision = None
 
-        self.tags['tag-1'] = self.commits['branch-a'][-1]
-        self.tags['tag-2'] = self.commits['branch-b'][-1]
+        self.head = self.commits[self.default_branch][-1]
+        self.tags = {}
 
         if git_svn:
             git_svn_routes = [

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/local/svn.py (270768 => 270769)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/local/svn.py	2020-12-14 16:26:26 UTC (rev 270768)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/local/svn.py	2020-12-14 16:34:33 UTC (rev 270769)
@@ -20,6 +20,7 @@
 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+import json
 import os
 import re
 
@@ -43,12 +44,11 @@
             date=datetime.utcfromtimestamp(commit.timestamp).strftime('%Y-%m-%d %H:%M:%S {} (%a, %d %b %Y)'.format(self.utc_offset)),
         )
 
-    def __init__(self, path='/.invalid-svn', remote=None, branches=None, utc_offset=None):
+    def __init__(self, path='/.invalid-svn', datafile=None, remote=None, utc_offset=None):
         self.path = path
         self.remote = remote or 'https://svn.mock.org/repository/{}'.format(os.path.basename(path))
         self.utc_offset = utc_offset or '0000'
 
-        self.branches = branches or []
         self.connected = True
 
         try:
@@ -56,89 +56,12 @@
         except (OSError, AssertionError):
             self.executable = '/usr/bin/svn'
 
-        # Provide a reasonable set of commits to test against
-        contributor = Contributor(name='Jonathan Bedard', emails=['[email protected]'])
-        self.commits = {
-            'trunk': [
-                Commit(
-                    identifier='1@trunk',
-                    revision=1,
-                    author=contributor,
-                    timestamp=1601660100,
-                    message='1st commit\n',
-                ), Commit(
-                    identifier='2@trunk',
-                    revision=2,
-                    author=contributor,
-                    timestamp=1601661100,
-                    message='2nd commit\n',
-                ), Commit(
-                    identifier='3@trunk',
-                    revision=4,
-                    author=contributor,
-                    timestamp=1601663100,
-                    message='4th commit\n',
-                ), Commit(
-                    identifier='4@trunk',
-                    revision=6,
-                    author=contributor,
-                    timestamp=1601665100,
-                    message='6th commit\n',
-                ),
-            ], 'branch-a': [
-                Commit(
-                    identifier='2.1@branch-a',
-                    revision=3,
-                    author=contributor,
-                    timestamp=1601662100,
-                    message='3rd commit\n',
-                ), Commit(
-                    identifier='2.2@branch-a',
-                    revision=7,
-                    author=contributor,
-                    timestamp=1601666100,
-                    message='7th commit\n',
-                ),
-            ],
-        }
-        self.commits['branch-b'] = [
-            self.commits['branch-a'][0], Commit(
-                identifier='2.2@branch-b',
-                revision=5,
-                author=contributor,
-                timestamp=1601664100,
-                message='5th commit\n',
-            ), Commit(
-                identifier='2.3@branch-b',
-                revision=8,
-                author=contributor,
-                timestamp=1601667100,
-                message='8th commit\n',
-            ),
-        ]
+        with open(datafile or os.path.join(os.path.dirname(os.path.dirname(__file__)), 'svn-repo.json')) as file:
+            self.commits = json.load(file)
+        for key, commits in self.commits.items():
+            self.commits[key] = [Commit(**kwargs) for kwargs in commits]
 
-        self.commits['tags/tag-1'] = [
-            self.commits['branch-a'][0],
-            self.commits['branch-a'][1], Commit(
-                identifier='2.3@tags/tag-1',
-                revision=9,
-                author=contributor,
-                timestamp=1601668100,
-                message='9th commit\n',
-            ),
-        ]
-        self.commits['tags/tag-2'] = [
-            self.commits['branch-b'][0],
-            self.commits['branch-b'][1],
-            self.commits['branch-b'][2], Commit(
-                identifier='2.4@tags/tag-2',
-                revision=10,
-                author=contributor,
-                timestamp=1601669100,
-                message='10th commit\n',
-            ),
-        ]
-        self.head = self.commits['trunk'][3]
+        self.head = self.commits['trunk'][-1]
 
         super(Svn, self).__init__(
             mocks.Subprocess.Route(
@@ -160,7 +83,7 @@
                 cwd=self.path,
                 generator=lambda *args, **kwargs: mocks.ProcessCompletion(
                     returncode=0,
-                    stdout='/\n'.join(sorted(set(self.branches) | set(self.commits.keys()) - {'trunk'} - self.tags)) + '/\n',
+                    stdout='/\n'.join(sorted(set(self.commits.keys()) - {'trunk'} - self.tags)) + '/\n',
                 ) if self.connected else mocks.ProcessCompletion(returncode=1),
             ), mocks.Subprocess.Route(
                 self.executable, 'list', '^/tags',

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/remote/svn.py (270768 => 270769)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/remote/svn.py	2020-12-14 16:26:26 UTC (rev 270768)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/remote/svn.py	2020-12-14 16:34:33 UTC (rev 270769)
@@ -20,6 +20,7 @@
 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+import json
 import os
 import re
 import xmltodict
@@ -34,7 +35,7 @@
     top = None
     REVISION_REQUEST_RE = re.compile(r'svn/rvr/(?P<revision>\d+)(/(?P<category>\S+))?$')
 
-    def __init__(self, remote='svn.example.org/repository/webkit'):
+    def __init__(self, remote='svn.example.org/repository/webkit', datafile=None):
         if not scmremote.Svn.is_webserver('https://{}'.format(remote)):
             raise ValueError('"{}" is not a valid Svn remote'.format(remote))
 
@@ -45,89 +46,11 @@
         self._cache_contents = None
         self.patches.append(scmremote.Svn('http://{}'.format(self.remote))._cache_lock())
 
-        # Provide a reasonable set of commits to test against
-        contributor = Contributor(name='Jonathan Bedard', emails=['[email protected]'])
-        self.commits = {
-            'trunk': [
-                Commit(
-                    identifier='1@trunk',
-                    revision=1,
-                    author=contributor,
-                    timestamp=1601660100,
-                    message='1st commit\n',
-                ), Commit(
-                    identifier='2@trunk',
-                    revision=2,
-                    author=contributor,
-                    timestamp=1601661100,
-                    message='2nd commit\n',
-                ), Commit(
-                    identifier='3@trunk',
-                    revision=4,
-                    author=contributor,
-                    timestamp=1601663100,
-                    message='4th commit\n',
-                ), Commit(
-                    identifier='4@trunk',
-                    revision=6,
-                    author=contributor,
-                    timestamp=1601665100,
-                    message='6th commit\n',
-                ),
-            ], 'branch-a': [
-                Commit(
-                    identifier='2.1@branch-a',
-                    revision=3,
-                    author=contributor,
-                    timestamp=1601662100,
-                    message='3rd commit\n',
-                ), Commit(
-                    identifier='2.2@branch-a',
-                    revision=7,
-                    author=contributor,
-                    timestamp=1601666100,
-                    message='7th commit\n',
-                ),
-            ],
-        }
-        self.commits['branch-b'] = [
-            self.commits['branch-a'][0], Commit(
-                identifier='2.2@branch-b',
-                revision=5,
-                author=contributor,
-                timestamp=1601664100,
-                message='5th commit\n',
-            ), Commit(
-                identifier='2.3@branch-b',
-                revision=8,
-                author=contributor,
-                timestamp=1601667100,
-                message='8th commit\n',
-            ),
-        ]
+        with open(datafile or os.path.join(os.path.dirname(os.path.dirname(__file__)), 'svn-repo.json')) as file:
+            self.commits = json.load(file)
+        for key, commits in self.commits.items():
+            self.commits[key] = [Commit(**kwargs) for kwargs in commits]
 
-        self.commits['tags/tag-1'] = [
-            self.commits['branch-a'][0],
-            self.commits['branch-a'][1], Commit(
-                identifier='2.3@tags/tag-1',
-                revision=9,
-                author=contributor,
-                timestamp=1601668100,
-                message='9th commit\n',
-            ),
-        ]
-        self.commits['tags/tag-2'] = [
-            self.commits['branch-b'][0],
-            self.commits['branch-b'][1],
-            self.commits['branch-b'][2], Commit(
-                identifier='2.4@tags/tag-2',
-                revision=10,
-                author=contributor,
-                timestamp=1601669100,
-                message='10th commit\n',
-            ),
-        ]
-
     def __enter__(self):
         super(Svn, self).__enter__()
 

Added: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/svn-repo.json (0 => 270769)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/svn-repo.json	                        (rev 0)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/svn-repo.json	2020-12-14 16:34:33 UTC (rev 270769)
@@ -0,0 +1,220 @@
+{
+    "tags/tag-1": [
+        {
+            "author": {
+                "name": "Jonathan Bedard", 
+                "emails": [
+                    "[email protected]"
+                ]
+            }, 
+            "timestamp": 1601662100, 
+            "branch": "branch-a", 
+            "message": "3rd commit\n", 
+            "identifier": "2.1@branch-a", 
+            "revision": 3
+        }, 
+        {
+            "author": {
+                "name": "Jonathan Bedard", 
+                "emails": [
+                    "[email protected]"
+                ]
+            }, 
+            "timestamp": 1601666100, 
+            "branch": "branch-a", 
+            "message": "7th commit\n", 
+            "identifier": "2.2@branch-a", 
+            "revision": 7
+        }, 
+        {
+            "author": {
+                "name": "Jonathan Bedard", 
+                "emails": [
+                    "[email protected]"
+                ]
+            }, 
+            "timestamp": 1601668100, 
+            "branch": "tags/tag-1", 
+            "message": "9th commit\n", 
+            "identifier": "2.3@tags/tag-1", 
+            "revision": 9
+        }
+    ], 
+    "tags/tag-2": [
+        {
+            "author": {
+                "name": "Jonathan Bedard", 
+                "emails": [
+                    "[email protected]"
+                ]
+            }, 
+            "timestamp": 1601662100, 
+            "branch": "branch-a", 
+            "message": "3rd commit\n", 
+            "identifier": "2.1@branch-a", 
+            "revision": 3
+        }, 
+        {
+            "author": {
+                "name": "Jonathan Bedard", 
+                "emails": [
+                    "[email protected]"
+                ]
+            }, 
+            "timestamp": 1601664100, 
+            "branch": "branch-b", 
+            "message": "5th commit\n", 
+            "identifier": "2.2@branch-b", 
+            "revision": 5
+        }, 
+        {
+            "author": {
+                "name": "Jonathan Bedard", 
+                "emails": [
+                    "[email protected]"
+                ]
+            }, 
+            "timestamp": 1601667100, 
+            "branch": "branch-b", 
+            "message": "8th commit\n", 
+            "identifier": "2.3@branch-b", 
+            "revision": 8
+        }, 
+        {
+            "author": {
+                "name": "Jonathan Bedard", 
+                "emails": [
+                    "[email protected]"
+                ]
+            }, 
+            "timestamp": 1601669100, 
+            "branch": "tags/tag-2", 
+            "message": "10th commit\n", 
+            "identifier": "2.4@tags/tag-2", 
+            "revision": 10
+        }
+    ], 
+    "branch-b": [
+        {
+            "author": {
+                "name": "Jonathan Bedard", 
+                "emails": [
+                    "[email protected]"
+                ]
+            }, 
+            "timestamp": 1601662100, 
+            "branch": "branch-a", 
+            "message": "3rd commit\n", 
+            "identifier": "2.1@branch-a", 
+            "revision": 3
+        }, 
+        {
+            "author": {
+                "name": "Jonathan Bedard", 
+                "emails": [
+                    "[email protected]"
+                ]
+            }, 
+            "timestamp": 1601664100, 
+            "branch": "branch-b", 
+            "message": "5th commit\n", 
+            "identifier": "2.2@branch-b", 
+            "revision": 5
+        }, 
+        {
+            "author": {
+                "name": "Jonathan Bedard", 
+                "emails": [
+                    "[email protected]"
+                ]
+            }, 
+            "timestamp": 1601667100, 
+            "branch": "branch-b", 
+            "message": "8th commit\n", 
+            "identifier": "2.3@branch-b", 
+            "revision": 8
+        }
+    ], 
+    "branch-a": [
+        {
+            "author": {
+                "name": "Jonathan Bedard", 
+                "emails": [
+                    "[email protected]"
+                ]
+            }, 
+            "timestamp": 1601662100, 
+            "branch": "branch-a", 
+            "message": "3rd commit\n", 
+            "identifier": "2.1@branch-a", 
+            "revision": 3
+        }, 
+        {
+            "author": {
+                "name": "Jonathan Bedard", 
+                "emails": [
+                    "[email protected]"
+                ]
+            }, 
+            "timestamp": 1601666100, 
+            "branch": "branch-a", 
+            "message": "7th commit\n", 
+            "identifier": "2.2@branch-a", 
+            "revision": 7
+        }
+    ], 
+    "trunk": [
+        {
+            "author": {
+                "name": "Jonathan Bedard", 
+                "emails": [
+                    "[email protected]"
+                ]
+            }, 
+            "timestamp": 1601660100, 
+            "branch": "trunk", 
+            "message": "1st commit\n", 
+            "identifier": "1@trunk", 
+            "revision": 1
+        }, 
+        {
+            "author": {
+                "name": "Jonathan Bedard", 
+                "emails": [
+                    "[email protected]"
+                ]
+            }, 
+            "timestamp": 1601661100, 
+            "branch": "trunk", 
+            "message": "2nd commit\n", 
+            "identifier": "2@trunk", 
+            "revision": 2
+        }, 
+        {
+            "author": {
+                "name": "Jonathan Bedard", 
+                "emails": [
+                    "[email protected]"
+                ]
+            }, 
+            "timestamp": 1601663100, 
+            "branch": "trunk", 
+            "message": "4th commit\n", 
+            "identifier": "3@trunk", 
+            "revision": 4
+        }, 
+        {
+            "author": {
+                "name": "Jonathan Bedard", 
+                "emails": [
+                    "[email protected]"
+                ]
+            }, 
+            "timestamp": 1601665100, 
+            "branch": "trunk", 
+            "message": "6th commit\n", 
+            "identifier": "4@trunk", 
+            "revision": 6
+        }
+    ]
+}
\ No newline at end of file

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/find_unittest.py (270768 => 270769)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/find_unittest.py	2020-12-14 16:26:26 UTC (rev 270768)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/find_unittest.py	2020-12-14 16:34:33 UTC (rev 270769)
@@ -186,7 +186,9 @@
         self.assertEqual(captured.stdout.getvalue(), '2.3@tags/tag-1 | r9 | 9th commit\n')
 
     def test_tag_git(self):
-        with mocks.local.Git(self.path, git_svn=True), mocks.local.Svn(), MockTime, OutputCapture() as captured:
+        with mocks.local.Git(self.path, git_svn=True) as mock, mocks.local.Svn(), MockTime, OutputCapture() as captured:
+            mock.tags['tag-1'] = mock.commits['branch-a'][-1]
+
             self.assertEqual(0, program.main(
                 args=('find', 'tag-1', '-q'),
                 path=self.path,

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/git_unittest.py (270768 => 270769)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/git_unittest.py	2020-12-14 16:26:26 UTC (rev 270768)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/git_unittest.py	2020-12-14 16:34:33 UTC (rev 270769)
@@ -63,7 +63,10 @@
             )
 
     def test_tags(self):
-        with mocks.local.Git(self.path):
+        with mocks.local.Git(self.path) as mock:
+            mock.tags['tag-1'] = mock.commits['branch-a'][-1]
+            mock.tags['tag-2'] = mock.commits['branch-b'][-1]
+
             self.assertEqual(
                 local.Git(self.path).tags,
                 ['tag-1', 'tag-2'],
@@ -220,6 +223,8 @@
     def test_tag(self):
         for mock in [mocks.local.Git(self.path), mocks.local.Git(self.path, git_svn=True)]:
             with mock:
+                mock.tags['tag-1'] = mock.commits['branch-a'][-1]
+
                 self.assertEqual(
                     '621652add7fc416099bd2063366cc38ff61afe36',
                     local.Git(self.path).commit(tag='tag-1').hash,
@@ -228,6 +233,8 @@
     def test_checkout(self):
         for mock in [mocks.local.Git(self.path), mocks.local.Git(self.path, git_svn=True)]:
             with mock:
+                mock.tags['tag-1'] = mock.commits['branch-a'][-1]
+
                 repository = local.Git(self.path)
                 self.assertEqual('bae5d1e90999d4f916a8a15810ccfa43f37a2fd6', repository.commit().hash)
                 self.assertEqual('3cd32e352410565bb543821fbf856a6d3caad1c4', repository.checkout('3cd32e3524').hash)

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/svn_unittest.py (270768 => 270769)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/svn_unittest.py	2020-12-14 16:26:26 UTC (rev 270768)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/svn_unittest.py	2020-12-14 16:34:33 UTC (rev 270769)
@@ -54,10 +54,10 @@
             self.assertEqual(local.Svn(self.path).remote(), repo.remote)
 
     def test_branches(self):
-        with mocks.local.Svn(self.path, branches=('branch-1', 'branch-2')):
+        with mocks.local.Svn(self.path):
             self.assertEqual(
                 local.Svn(self.path).branches,
-                ['trunk', 'branch-1', 'branch-2', 'branch-a', 'branch-b'],
+                ['trunk', 'branch-a', 'branch-b'],
             )
 
     def test_tags(self):
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to