Skip to content

Commit 65de31a

Browse files
authored
Merge pull request #326 from yungwine/dev
fix update/upgrade commit
2 parents 7e90e26 + dc45cd2 commit 65de31a

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

mytonctrl/mytonctrl.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
)
4343
from mytoncore.telemetry import is_host_virtual
4444
from mytonctrl.migrate import run_migrations
45-
from mytonctrl.utils import GetItemFromList, timestamp2utcdatetime, fix_git_config
45+
from mytonctrl.utils import GetItemFromList, timestamp2utcdatetime, fix_git_config, is_hex
4646

4747
import sys, getopt, os
4848

@@ -334,8 +334,11 @@ def check_git(input_args, default_repo, text, default_branch='master'):
334334
#end define
335335

336336
def check_branch_exists(author, repo, branch):
337+
if is_hex(branch):
338+
print('Hex name detected, skip branch existence check.')
339+
return
337340
url = f"https://github.com/{author}/{repo}.git"
338-
args = ["git", "ls-remote", "--heads", url, branch]
341+
args = ["git", "ls-remote", "--heads", "--tags", url, branch]
339342
process = subprocess.run(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=3)
340343
output = process.stdout.decode("utf-8")
341344
if branch not in output:

mytonctrl/scripts/upgrade.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ rm -rf ${srcdir}/${repo}
6363

6464
# Update code
6565
echo "https://github.com/${author}/${repo}.git -> ${branch}"
66-
git clone --branch ${branch} --recursive https://github.com/${author}/${repo}.git
67-
cd ${repo}
66+
git clone --recursive https://github.com/${author}/${repo}.git
67+
cd ${repo} && git checkout ${branch}
6868
export CC=/usr/bin/clang
6969
export CXX=/usr/bin/clang++
7070
export CCACHE_DISABLE=1

mytonctrl/utils.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ def GetItemFromList(data, index):
1515
pass
1616

1717

18+
def is_hex(s):
19+
try:
20+
int(s, 16)
21+
return True
22+
except ValueError:
23+
return False
24+
25+
1826
def fix_git_config(git_path: str):
1927
args = ["git", "status"]
2028
try:

0 commit comments

Comments
 (0)