Explore Enterprise Education Gitee Premium Gitee AI AI teammates
Fetch the repository succeeded.
Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
Already have an account? Sign in
文件
master
Branches (7)
Tags (50)
master
dev
bug_fix
feature
refactor/webapp/main
v2021.10.24
v2020.07.15
v2024.04.26
v2024.04.18
v2023.12.29
v2023.12.25
v0.5.2
v0.5.1
v2023.09.10
v2023.08.28
v2023.08.20
v2023.06.04
v2023.04.19
v2023.03.28.2
v2023.03.28
v2023.03.05
v2022.10.24
v2022.06.26
v2022.01.12
v2021.10.31
v2021.10.28
v0.3.1
master
Branches (7)
Tags (50)
master
dev
bug_fix
feature
refactor/webapp/main
v2021.10.24
v2020.07.15
v2024.04.26
v2024.04.18
v2023.12.29
v2023.12.25
v0.5.2
v0.5.1
v2023.09.10
v2023.08.28
v2023.08.20
v2023.06.04
v2023.04.19
v2023.03.28.2
v2023.03.28
v2023.03.05
v2022.10.24
v2022.06.26
v2022.01.12
v2021.10.31
v2021.10.28
v0.3.1
Clone or Download
Clone/Download
Prompt
To download the code, please copy the following command and execute it in the terminal
To ensure that your submitted code identity is correctly recognized by Gitee, please execute the following command.
When using the SSH protocol for the first time to clone or push code, follow the prompts below to complete the SSH configuration.
1 Generate RSA keys.
2 Obtain the content of the RSA public key and configure it in SSH Public Keys
To use SVN on Gitee, please visit the usage guide
When using the HTTPS protocol, the command line will prompt for account and password verification as follows. For security reasons, Gitee recommends configure and use personal access tokens instead of login passwords for cloning, pushing, and other operations.
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # Private Token
master
Branches (7)
Tags (50)
master
dev
bug_fix
feature
refactor/webapp/main
v2021.10.24
v2020.07.15
v2024.04.26
v2024.04.18
v2023.12.29
v2023.12.25
v0.5.2
v0.5.1
v2023.09.10
v2023.08.28
v2023.08.20
v2023.06.04
v2023.04.19
v2023.03.28.2
v2023.03.28
v2023.03.05
v2022.10.24
v2022.06.26
v2022.01.12
v2021.10.31
v2021.10.28
v0.3.1
git.py 5.09 KB
Copy Edit Raw Blame History
LmeSzinc authored 2025年09月02日 00:59 +08:00 . Refactor: Gitpython preparations
import configparser
import os
from deploy.Windows.config import DeployConfig
from deploy.Windows.logger import Progress, logger
from deploy.Windows.utils import cached_property
from deploy.git_over_cdn.client import GitOverCdnClient
class GitConfigParser(configparser.ConfigParser):
def check(self, section, option, value):
result = self.get(section, option, fallback=None)
if result == value:
logger.info(f'Git config {section}.{option} = {value}')
return True
else:
return False
class GitOverCdnClientWindows(GitOverCdnClient):
def update(self, *args, **kwargs):
Progress.GitInit()
_ = super().update(*args, **kwargs)
Progress.GitShowVersion()
return _
@cached_property
def latest_commit(self) -> str:
_ = super().latest_commit
Progress.GitLatestCommit()
return _
def download_pack(self):
_ = super().download_pack()
Progress.GitDownloadPack()
return _
class GitManager(DeployConfig):
@staticmethod
def remove(file):
try:
os.remove(file)
logger.info(f'Removed file: {file}')
except FileNotFoundError:
logger.info(f'File not found: {file}')
@cached_property
def git_config(self):
conf = GitConfigParser()
conf.read('./.git/config')
return conf
def git_repository_init(
self, repo, source='origin', branch='master', proxy='', ssl_verify=True
):
logger.hr('Git Init', 1)
if not self.execute(f'"{self.git}" init', allow_failure=True):
self.remove('./.git/config')
self.remove('./.git/index')
self.remove('./.git/HEAD')
self.remove('./.git/ORIG_HEAD')
self.execute(f'"{self.git}" init')
Progress.GitInit()
logger.hr('Set Git Proxy', 1)
if proxy:
if not self.git_config.check('http', 'proxy', value=proxy):
self.execute(f'"{self.git}" config --local http.proxy {proxy}')
if not self.git_config.check('https', 'proxy', value=proxy):
self.execute(f'"{self.git}" config --local https.proxy {proxy}')
else:
if not self.git_config.check('http', 'proxy', value=None):
self.execute(f'"{self.git}" config --local --unset http.proxy', allow_failure=True)
if not self.git_config.check('https', 'proxy', value=None):
self.execute(f'"{self.git}" config --local --unset https.proxy', allow_failure=True)
if ssl_verify:
if not self.git_config.check('http', 'sslVerify', value='true'):
self.execute(f'"{self.git}" config --local http.sslVerify true', allow_failure=True)
else:
if not self.git_config.check('http', 'sslVerify', value='false'):
self.execute(f'"{self.git}" config --local http.sslVerify false', allow_failure=True)
Progress.GitSetConfig()
logger.hr('Set Git Repository', 1)
if not self.git_config.check(f'remote "{source}"', 'url', value=repo):
if not self.execute(f'"{self.git}" remote set-url {source}{repo}', allow_failure=True):
self.execute(f'"{self.git}" remote add {source}{repo}')
Progress.GitSetRepo()
logger.hr('Fetch Repository Branch', 1)
self.execute(f'"{self.git}" fetch {source}{branch}')
Progress.GitFetch()
logger.hr('Pull Repository Branch', 1)
# Remove git lock
for lock_file in [
'./.git/index.lock',
'./.git/HEAD.lock',
'./.git/refs/heads/master.lock',
]:
if os.path.exists(lock_file):
logger.info(f'Lock file {lock_file} exists, removing')
os.remove(lock_file)
self.execute(f'"{self.git}" reset --hard {source}/{branch}')
Progress.GitReset()
# Since `git fetch` is already called, checkout is faster
if not self.execute(f'"{self.git}" checkout {branch}', allow_failure=True):
self.execute(f'"{self.git}" pull --ff-only {source}{branch}')
Progress.GitCheckout()
logger.hr('Show Version', 1)
self.execute(f'"{self.git}" --no-pager log --no-merges -1')
Progress.GitShowVersion()
@property
def goc_client(self):
client = GitOverCdnClient(
url='https://vip.123pan.cn/1815343254/pack/LmeSzinc_StarRailCopilot_master',
folder=self.root_filepath,
source='origin',
branch='master',
git=self.git,
)
client.logger = logger
return client
def git_install(self):
logger.hr('Update Alas', 0)
if not self.AutoUpdate:
logger.info('AutoUpdate is disabled, skip')
Progress.GitShowVersion()
return
if self.GitOverCdn:
if self.goc_client.update():
return
self.git_repository_init(
repo=self.Repository,
source='origin',
branch=self.Branch,
proxy=self.GitProxy,
ssl_verify=self.SSLVerify,
)
Loading...
Report
Report success
We will send you the feedback within 2 working days through the letter!
Please fill in the reason for the report carefully. Provide as detailed a description as possible.
Please select a report type
Cancel
Send
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

About

Cancel

Releases

No release

Contributors

All

Activities

can not load any more
Edit
About
Homepage
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/coding10000/AzurLaneAutoScript.git
git@gitee.com:coding10000/AzurLaneAutoScript.git
coding10000
AzurLaneAutoScript
AzurLaneAutoScript
master
Going to Help Center

Search

Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register

AltStyle によって変換されたページ (->オリジナル) /