liuyuqi-dellpc 3 years ago
commit
8b15da80f9
9 changed files with 175 additions and 0 deletions
  1. 4 0
      .gitignore
  2. 25 0
      README.md
  3. 25 0
      README_cn.md
  4. 45 0
      checkGit.py
  5. 33 0
      checkGit.spec
  6. 43 0
      checkGit_shell.py
  7. BIN
      favicon.ico
  8. 0 0
      requirements.txt
  9. BIN
      screenshot/3.gif

+ 4 - 0
.gitignore

@@ -0,0 +1,4 @@
+/build
+/dist
+/.vscode
+/__pycache__

+ 25 - 0
README.md

@@ -0,0 +1,25 @@
+
+## checkGitStatus
+
+Batch check projects in current path whether it is updated.
+
+As a developer for many years, there are many collaborative projects in the computer. in order to know that someone has updated origin code, we need to perform many steps.
+
+this project was developed to realize batch detection of multiple projects remote update.
+
+## usage
+
+```
+python checkGit_shell.py D:\xx\yy
+```
+
+or you can donwload the .exe file open it with cmd:
+
+```
+checkGit.exe D:\xx\yy
+```
+
+![](screenshot/3.gif)
+
+
+

+ 25 - 0
README_cn.md

@@ -0,0 +1,25 @@
+
+## checkGitStatus
+
+批量检测 git 项目是否有更新。
+
+作为一个多年开发人员,电脑中有很多协作项目。往往需要配合各自的项目系统进行更新推送,才能知道有某某项目更新。为此开发这个项目,实现一键批量检测多个项目远程更新。
+
+## usage
+
+python源码执行:
+
+```
+python checkGit_shell.py D:\xx\yy
+```
+
+或者打包成exe命令行执行:
+
+```
+checkGit.exe D:\xx\yy
+```
+
+![](screenshot/3.gif)
+
+
+

+ 45 - 0
checkGit.py

@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+# -*- encoding: utf-8 -*-
+'''
+@Author  :   liuyuqi
+@Contact :   liuyuqi.gov@msn.cn
+@Time    :   2020/06/08 04:32:47
+@Version :   1.0
+@License :   Copyright © 2017-2020 liuyuqi. All Rights Reserved.
+@Desc    :   批量查询git远程状态是否有代码更新,打包成可执行文件
+'''
+
+import os
+import sys
+import time
+import re
+
+depth = 2
+
+
+def getStatus(root):
+    files = os.listdir(root)
+    dirs = []
+    for file in files:
+        file_path = os.path.join(root, file)
+        if os.path.isdir(file_path):
+            dirs.append(file)
+    if ".git" in dirs:
+        os.chdir(root)
+        with os.popen("git status") as p:
+            output = p.read()
+            resData = re.split("\n", output)
+            if len(resData) > 2:
+                print(root, "", resData[1])
+    else:
+        for dir in dirs:
+            getStatus(os.path.join(root, dir))
+
+
+if __name__ == "__main__":
+    parms=sys.argv
+    if len(parms)!=2:
+        print("请输入路径:eg:D:/xx/github/")
+    else:
+        getStatus(parms[1])
+    os.system("pause")

+ 33 - 0
checkGit.spec

@@ -0,0 +1,33 @@
+# -*- mode: python ; coding: utf-8 -*-
+
+block_cipher = None
+
+
+a = Analysis(['checkGit.py'],
+             pathex=['D:\\liuyuqi\\fishsource\\python\\checkGitStatus'],
+             binaries=[],
+             datas=[],
+             hiddenimports=[],
+             hookspath=[],
+             runtime_hooks=[],
+             excludes=[],
+             win_no_prefer_redirects=False,
+             win_private_assemblies=False,
+             cipher=block_cipher,
+             noarchive=False)
+pyz = PYZ(a.pure, a.zipped_data,
+             cipher=block_cipher)
+exe = EXE(pyz,
+          a.scripts,
+          a.binaries,
+          a.zipfiles,
+          a.datas,
+          [],
+          name='checkGit',
+          debug=False,
+          bootloader_ignore_signals=False,
+          strip=False,
+          upx=True,
+          upx_exclude=[],
+          runtime_tmpdir=None,
+          console=True , icon='favicon.ico')

+ 43 - 0
checkGit_shell.py

@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+# -*- encoding: utf-8 -*-
+'''
+@Author  :   liuyuqi
+@Contact :   liuyuqi.gov@msn.cn
+@Time    :   2020/06/08 04:32:47
+@Version :   1.0
+@License :   Copyright © 2017-2020 liuyuqi. All Rights Reserved.
+@Desc    :   批量查询git远程状态是否有代码更新
+'''
+
+import os
+import sys
+import time
+import re
+
+depth = 2
+
+
+def getStatus(root):
+    files = os.listdir(root)
+    dirs = []
+    for file in files:
+        file_path = os.path.join(root, file)
+        if os.path.isdir(file_path):
+            dirs.append(file)
+    if ".git" in dirs:
+        os.chdir(root)
+        with os.popen("git status") as p:
+            output = p.read()
+            resData = re.split("\n", output)
+            if len(resData) > 2:
+                print(root, "", resData[1])
+    else:
+        for dir in dirs:
+            getStatus(os.path.join(root, dir))
+
+
+if __name__ == "__main__":
+    folders = ['D:/liuyuqi/github/vue.js']
+    for stuff in folders:
+        stuff = os.path.abspath(os.path.expanduser(os.path.expandvars(stuff)))
+        getStatus(stuff)

BIN
favicon.ico


+ 0 - 0
requirements.txt


BIN
screenshot/3.gif