]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: add repo name option to SetupGit.py
authorRebecca Cran <rebecca@bsdio.com>
Fri, 1 May 2020 20:00:44 +0000 (04:00 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 8 May 2020 03:59:29 +0000 (03:59 +0000)
Allow users who didn't clone one of the TianoCore repos from a
canonical URL to specify the name of the repo (edk2, edk2-platforms
or edk2-non-osi) when running SetupGit.py to allow them to configure
their repo properly.

The new option is:

  -n repo, --name repo  set the repo name to configure for, if not
                        detected automatically

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
BaseTools/Scripts/SetupGit.py

index e320ba2f887e36bb537ae0efc28332a87c206774..4416111ac0a5b7df5eefd8432208f9e8e7817e0d 100644 (file)
@@ -106,10 +106,11 @@ def fuzzy_match_repo_url(one, other):
     return False\r
 \r
 \r
-def get_upstream(url):\r
+def get_upstream(url, name):\r
     """Extracts the dict for the current repo origin."""\r
     for upstream in UPSTREAMS:\r
-        if fuzzy_match_repo_url(upstream['repo'], url):\r
+        if (fuzzy_match_repo_url(upstream['repo'], url) or\r
+                upstream['name'] == name):\r
             return upstream\r
     print("Unknown upstream '%s' - aborting!" % url)\r
     sys.exit(3)\r
@@ -143,6 +144,11 @@ if __name__ == '__main__':
                         help='overwrite existing settings conflicting with program defaults',\r
                         action='store_true',\r
                         required=False)\r
+    PARSER.add_argument('-n', '--name', type=str, metavar='repo',\r
+                        choices=['edk2', 'edk2-platforms', 'edk2-non-osi'],\r
+                        help='set the repo name to configure for, if not '\r
+                             'detected automatically',\r
+                        required=False)\r
     PARSER.add_argument('-v', '--verbose',\r
                         help='enable more detailed output',\r
                         action='store_true',\r
@@ -156,7 +162,7 @@ if __name__ == '__main__':
 \r
     URL = REPO.remotes.origin.url\r
 \r
-    UPSTREAM = get_upstream(URL)\r
+    UPSTREAM = get_upstream(URL, ARGS.name)\r
     if not UPSTREAM:\r
         print("Upstream '%s' unknown, aborting!" % URL)\r
         sys.exit(7)\r