mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-09-30 11:23:44 +08:00
limited branches to those available from updated
This commit is contained in:
@@ -64,11 +64,12 @@ SoftwarePanel::SoftwarePanel(QWidget* parent) : ListWidget(parent) {
|
||||
connect(targetBranchBtn, &ButtonControl::clicked, [=]() {
|
||||
auto current = params.get("GitBranch");
|
||||
QStringList branches = QString::fromStdString(params.get("UpdaterAvailableBranches")).split(",");
|
||||
for (QString b : {current.c_str(), "devel-staging", "devel", "nightly", "master-ci", "master"}) {
|
||||
auto i = branches.indexOf(b);
|
||||
if (i >= 0) {
|
||||
branches.removeAt(i);
|
||||
branches.insert(0, b);
|
||||
if (!branches.isEmpty()) {
|
||||
QString current = QString::fromStdString(params.get("CurrentBranch"));
|
||||
int currentIndex = branches.indexOf(current);
|
||||
if (currentIndex >= 0) {
|
||||
branches.removeAt(currentIndex);
|
||||
branches.insert(0, current);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -271,13 +271,18 @@ class Updater:
|
||||
def get_commit_hash(self, path: str = OVERLAY_MERGED) -> str:
|
||||
return run(["git", "rev-parse", "HEAD"], path).rstrip()
|
||||
|
||||
def filter_branches(self, branches, prefixes):
|
||||
return [branch for branch in branches if any(branch.startswith(prefix) for prefix in prefixes)]
|
||||
|
||||
def set_params(self, update_success: bool, failed_count: int, exception: str | None) -> None:
|
||||
self.params.put("UpdateFailedCount", str(failed_count))
|
||||
self.params.put("UpdaterTargetBranch", self.target_branch)
|
||||
|
||||
self.params.put_bool("UpdaterFetchAvailable", self.update_available)
|
||||
if len(self.branches):
|
||||
self.params.put("UpdaterAvailableBranches", ','.join(self.branches.keys()))
|
||||
allowed_prefixes = ['beta3', 'release3']
|
||||
filtered_branches = self.filter_branches(self.branches.keys(), allowed_prefixes)
|
||||
self.params.put("UpdaterAvailableBranches", ','.join(filtered_branches))
|
||||
|
||||
last_update = datetime.datetime.now(datetime.UTC).replace(tzinfo=None)
|
||||
if update_success:
|
||||
|
||||
Reference in New Issue
Block a user