forked from IronLanguages/ironpython3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate-stdlib.cmd
More file actions
53 lines (41 loc) · 1.05 KB
/
update-stdlib.cmd
File metadata and controls
53 lines (41 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
@echo off
setlocal
if [%1]==[] goto usage
set _pyrepo=%1
if not exist "%_pyrepo%\Lib" (
echo "%_pyrepo% does not look like a CPython repo (no Lib directory)."
goto :fail
)
for /f %%I in ('hg -R "%_pyrepo%" id -i') do set _hgrev=%%I
set _stdlibdir=%~dp0
pushd "%_stdlibdir%"
git diff-index --quiet HEAD
if "%ERRORLEVEL%" NEQ "0" (
echo "There are uncomitted changes. Commit or stash before proceeding."
goto :fail
)
for /f %%I in ('git rev-parse --abbrev-ref HEAD') do set _curbranch=%%I
if "%_curbranch%" NEQ "python-stdlib" (
echo "This should only be run on the python-stdlib branch (on %_curbranch%)."
goto :fail
)
robocopy "%_pyrepo%\Lib" "%_stdlibdir%Lib" /MIR /R:1 /W:1 /XD plat-* /XD __pycache__ /XF *.pyc
git update-index --refresh -q > NUL
git add -A "%_stdlibdir%/Lib"
git diff-index --quiet HEAD
if "%ERRORLEVEL%" EQU "0" (
echo "No changes found."
) else (
git commit -am "Import python stdlib @ %_hgrev%"
)
goto :exit
:usage
echo %~n0 ^<path^\to^\cpython^>
exit /B 1
:fail
popd
endlocal
exit /B 1
:exit
popd
endlocal