Skip to content

Commit a4ccfc6

Browse files
committed
GUI - Remove Switch Branch option
Installers - Pin to r1.0
1 parent 59023ad commit a4ccfc6

3 files changed

Lines changed: 8 additions & 103 deletions

File tree

.install/linux/faceswap_setup_x64.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ clone_faceswap() {
368368
# Clone the faceswap repo
369369
delete_faceswap
370370
info "Downloading Faceswap..."
371-
yellow ; git clone --depth 1 --no-single-branch "$DL_FACESWAP" "$DIR_FACESWAP"
371+
yellow ; git clone --depth 1 --single-branch --branch r1.0 "$DL_FACESWAP" "$DIR_FACESWAP"
372372
}
373373

374374
setup_faceswap() {

.install/windows/install.nsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ InstallDir $PROFILE\faceswap
2121

2222
# Install cli flags
2323
!define flagsConda "/S /RegisterPython=0 /AddToPath=0 /D=$PROFILE\MiniConda3"
24-
!define flagsRepo "--depth 1 --no-single-branch ${wwwRepo}"
24+
!define flagsRepo "--depth 1 --single-branch --branch r1.0 ${wwwRepo}"
2525
!define flagsEnv "-y python=3.7"
2626

2727
# Folders

lib/gui/menu.py

Lines changed: 6 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,6 @@ def build(self):
248248
self.add_command(label="Update Faceswap...",
249249
underline=0,
250250
command=lambda action="update": self.in_thread(action))
251-
if self._build_branches_menu():
252-
self.add_cascade(label="Switch Branch", underline=7, menu=self._branches_menu)
253251
self.add_separator()
254252
self._build_recources_menu()
255253
self.add_cascade(label="Resources", underline=0, menu=self.recources_menu)
@@ -259,105 +257,6 @@ def build(self):
259257
command=lambda action="output_sysinfo": self.in_thread(action))
260258
logger.debug("Built help menu")
261259

262-
def _build_branches_menu(self):
263-
""" Build branch selection menu.
264-
265-
Queries git for available branches and builds a menu based on output.
266-
267-
Returns
268-
-------
269-
bool
270-
``True`` if menu was successfully built otherwise ``False``
271-
"""
272-
stdout = self._get_branches()
273-
if stdout is None:
274-
return False
275-
276-
branches = self._filter_branches(stdout)
277-
if not branches:
278-
return False
279-
280-
for branch in branches:
281-
self._branches_menu.add_command(
282-
label=branch,
283-
command=lambda b=branch: self._switch_branch(b))
284-
return True
285-
286-
@staticmethod
287-
def _get_branches():
288-
""" Get the available github branches
289-
290-
Returns
291-
-------
292-
str
293-
The list of branches available. If no branches were found or there was an
294-
error then `None` is returned
295-
"""
296-
gitcmd = "git branch -a"
297-
cmd = Popen(gitcmd, shell=True, stdout=PIPE, stderr=STDOUT, cwd=_WORKING_DIR)
298-
stdout, _ = cmd.communicate()
299-
retcode = cmd.poll()
300-
if retcode != 0:
301-
logger.debug("Unable to list git branches. return code: %s, message: %s",
302-
retcode, stdout.decode().strip().replace("\n", " - "))
303-
return None
304-
return stdout.decode(locale.getpreferredencoding())
305-
306-
@staticmethod
307-
def _filter_branches(stdout):
308-
""" Filter the branches, remove duplicates and the current branch and return a sorted
309-
list.
310-
311-
Parameters
312-
----------
313-
stdout: str
314-
The output from the git branch query converted to a string
315-
316-
Returns
317-
-------
318-
list
319-
Unique list of available branches sorted in alphabetical order
320-
"""
321-
current = None
322-
branches = set()
323-
for line in stdout.splitlines():
324-
branch = line[line.rfind("/") + 1:] if "/" in line else line.strip()
325-
if branch.startswith("*"):
326-
branch = branch.replace("*", "").strip()
327-
current = branch
328-
continue
329-
branches.add(branch)
330-
logger.debug("Found branches: %s", branches)
331-
if current in branches:
332-
logger.debug("Removing current branch from output: %s", current)
333-
branches.remove(current)
334-
335-
branches = sorted(list(branches), key=str.casefold)
336-
logger.debug("Final branches: %s", branches)
337-
return branches
338-
339-
@staticmethod
340-
def _switch_branch(branch):
341-
""" Change the currently checked out branch, and return a notification.
342-
343-
Parameters
344-
----------
345-
str
346-
The branch to switch to
347-
"""
348-
logger.info("Switching branch to '%s'...", branch)
349-
gitcmd = "git checkout {}".format(branch)
350-
cmd = Popen(gitcmd, shell=True, stdout=PIPE, stderr=STDOUT, cwd=_WORKING_DIR)
351-
stdout, _ = cmd.communicate()
352-
retcode = cmd.poll()
353-
if retcode != 0:
354-
logger.error("Unable to switch branch. return code: %s, message: %s",
355-
retcode, stdout.decode().strip().replace("\n", " - "))
356-
return
357-
logger.info("Succesfully switched to '%s'. You may want to check for updates to make sure "
358-
"that you have the latest code.", branch)
359-
logger.info("Please restart Faceswap to complete the switch.")
360-
361260
def _build_recources_menu(self):
362261
""" Build resources menu """
363262
# pylint: disable=cell-var-from-loop
@@ -402,6 +301,9 @@ def check(self):
402301
encoding = locale.getpreferredencoding()
403302
logger.debug("Encoding: %s", encoding)
404303
self.check_for_updates(encoding, check=True)
304+
logger.info("NB: You are on release 1.0 of Faceswap, which is unlikely to receive further "
305+
"updates. You can upgrade to the latest Faceswap by visiting "
306+
"https://faceswap.dev")
405307
self.root.config(cursor="")
406308

407309
def update(self):
@@ -416,6 +318,9 @@ def update(self):
416318
update_deps.main(logger=logger)
417319
if success:
418320
logger.info("Please restart Faceswap to complete the update.")
321+
logger.info("NB: You are on release 1.0 of Faceswap, which is unlikely to receive further "
322+
"updates. You can upgrade to the latest Faceswap by visiting "
323+
"https://faceswap.dev")
419324
self.root.config(cursor="")
420325

421326
@staticmethod

0 commit comments

Comments
 (0)