diff options
author | AUTOMATIC <16777216c@gmail.com> | 2023-05-15 18:22:35 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2023-05-15 18:22:35 +0000 |
commit | a47abe1b7b667374e9df1932172230132d3fe8db (patch) | |
tree | 85952e9515481e7a768f6dc7a179359ce7754368 | |
parent | 0d2a4b608c075daa3a4d1a1c9df01a763ae4793a (diff) | |
download | stable-diffusion-webui-gfx803-a47abe1b7b667374e9df1932172230132d3fe8db.tar.gz stable-diffusion-webui-gfx803-a47abe1b7b667374e9df1932172230132d3fe8db.tar.bz2 stable-diffusion-webui-gfx803-a47abe1b7b667374e9df1932172230132d3fe8db.zip |
update extensions table: show branch, show date in separate column, and show version from tags if available
-rw-r--r-- | modules/extensions.py | 6 | ||||
-rw-r--r-- | modules/ui_extensions.py | 7 |
2 files changed, 8 insertions, 5 deletions
diff --git a/modules/extensions.py b/modules/extensions.py index 1053253e..f16f059e 100644 --- a/modules/extensions.py +++ b/modules/extensions.py @@ -66,13 +66,11 @@ class Extension: try:
self.status = 'unknown'
self.remote = next(repo.remote().urls, None)
- head = repo.head.commit
self.commit_date = repo.head.commit.committed_date
- ts = time.asctime(time.gmtime(self.commit_date))
if repo.active_branch:
self.branch = repo.active_branch.name
- self.commit_hash = head.hexsha
- self.version = f'{self.commit_hash[:8]} ({ts})'
+ self.commit_hash = repo.head.commit.hexsha
+ self.version = repo.git.describe("--always", "--tags") # compared to `self.commit_hash[:8]` this takes about 30% more time total but since we run it in parallel we don't care
except Exception as ex:
print(f"Failed reading extension data from Git repository ({self.name}): {ex}", file=sys.stderr)
diff --git a/modules/ui_extensions.py b/modules/ui_extensions.py index aaa7e571..6ad9a97c 100644 --- a/modules/ui_extensions.py +++ b/modules/ui_extensions.py @@ -141,7 +141,9 @@ def extension_table(): <tr>
<th><abbr title="Use checkbox to enable the extension; it will be enabled or disabled when you click apply button">Extension</abbr></th>
<th>URL</th>
- <th><abbr title="Extension version">Version</abbr></th>
+ <th>Branch</th>
+ <th>Version</th>
+ <th>Date</th>
<th><abbr title="Use checkbox to mark the extension for update; it will be updated when you click apply button">Update</abbr></th>
</tr>
</thead>
@@ -149,6 +151,7 @@ def extension_table(): """
for ext in extensions.extensions:
+ ext: extensions.Extension
ext.read_info_from_repo()
remote = f"""<a href="{html.escape(ext.remote or '')}" target="_blank">{html.escape("built-in" if ext.is_builtin else ext.remote or '')}</a>"""
@@ -170,7 +173,9 @@ def extension_table(): <tr>
<td><label{style}><input class="gr-check-radio gr-checkbox" name="enable_{html.escape(ext.name)}" type="checkbox" {'checked="checked"' if ext.enabled else ''}>{html.escape(ext.name)}</label></td>
<td>{remote}</td>
+ <td>{ext.branch}</td>
<td>{version_link}</td>
+ <td>{time.asctime(time.gmtime(ext.commit_date))}</td>
<td{' class="extension_status"' if ext.remote is not None else ''}>{ext_status}</td>
</tr>
"""
|