Metadata-Version: 2.4
Name: commit-updater
Version: 0.6.0
Summary: Update Podfile.lock component commits from local git repos and push
Author: Aron
License: MIT
Keywords: cocoapods,podfile,git,lockfile
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Version Control
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# CommitUpdater

用于在主工程中批量更新 `Podfile.lock` 里的组件 commit，并自动提交推送主工程仓库。

## 功能概述

- 拉取主工程最新代码
- 获取组件仓库最新 commit
- 更新 `Podfile.lock` 中对应组件的 `:commit:`
- 自动提交并推送主工程改动

另有 `bbpull` 命令：自动识别当前开发者配置，批量拉取更新 `:method => LOCAL` 的本地组件仓库代码（不做任何 lock 文件改动）。

## 安装

### 本地安装

```bash
cd CommitUpdater
pip install -e .
```

安装后会提供命令：`bbcu`、`bbpull`

### 外网安装

发布到 PyPI 后，可直接安装：

```bash
# 跟新pip源
python -m pip install --upgrade pip
# pip安装
pip install commit-updater
# pip命令没有找到，使用 python3 -m pip  命令安装
python3 -m pip install commit-updater
# 更新
python3 -m pip install -U commit-updater
```

## 使用方式

进入包含 `Podfile.lock` 的主工程目录后执行：

```bash
bbcu BBUnlock BBEngine
# 如果命令没有找到，查询安装位置，把安装路径中lib文件夹平级的bin文件夹添加到PATH中重新试下
python3 -m pip show commit-updater
```

也可以更新单个组件：

```bash
bbcu BBUnlock
```

## bbpull：批量拉取本地组件

在主工程目录下执行，自动识别当前机器对应的成员配置（`:pathes` 在本机存在的第一份配置），
更新其中 `:method => LOCAL` 的组件仓库：

```bash
bbpull                                  # 更新全部 LOCAL 组件
bbpull BBUIKit BRUserModule             # 只更新指定组件
bbpull --branch develop                 # 先切分支再更新
bbpull --dry-run                        # 检查并标记每个组件是否有更新，不改动工作区与本地分支
bbpull --dry-run --no-fetch             # 离线检查：基于上次 fetch 的缓存引用判断更新
bbpull --config cocoapods/Member_modules/zyt_modules.rb   # 指定成员配置
```

拉取策略与 `scripts/update_local_modules.sh` 一致：

- 工作区有未提交改动的仓库跳过，不做任何改动
- 只 fetch 当前目标分支引用（`+refs/heads/<分支>:refs/remotes/origin/<分支>`，避开远端
  大小写冲突引用导致的全量 fetch 失败），再 `git merge --ff-only` 纯本地快进更新，本地领先时跳过
- 无上游分支的仓库跳过
- `--dry-run` 模式：执行 fetch 后按领先/落后标记各组件（有更新 N 个提交 / 已是最新 / 本地领先），
  不执行 checkout/pull；结尾列出存在更新的组件清单
- 有组件拉到新代码时，结尾提示需手动执行 `bundle exec pod install`

## 适用场景

适用于基于 CocoaPods 管理组件依赖、并使用 `Podfile.lock` 锁定 commit 的工程。

## 更多说明

实现细节、PyCharm 运行说明、提交规则、发布流程和维护注意事项见：`DEVELOPMENT.md`
