1

我正在尝试找出简单的 Mainline 开发模式。

我的观察如下。

  1. 主分支上的每个直接提交都会增加补丁版本。
  2. 当我创建一个特性分支,然后在这个特性分支上提交时,补丁并没有增加。我想知道为什么?只有 PreReleaseTag 正在增加。每次提交的示例 featureBranchName.1、featureBranchName.2 等等。补丁不会改变。

为什么提交功能分支时补丁版本不增加?功能分支是否总是意味着预发布?

有没有办法增加提交功能分支的补丁?

我的 GitVersion.yml 文件如下。-diag 输出如下,如果有帮助的话。

next-version: 0.1.0
mode: MainLine
assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-scheme: MajorMinorPatchTag
increment: Inherit
continuous-delivery-fallback-tag: ci
tag-prefix: '[vV]'
major-version-bump-message: '\+semver:\s?(breaking|major)'
minor-version-bump-message: '\+semver:\s?(feature|minor)'
patch-version-bump-message: '\+semver:\s?(fix|patch)'
no-bump-message: '\+semver:\s?(none|skip)'
legacy-semver-padding: 4
build-metadata-padding: 4
commits-since-version-source-padding: 4
commit-message-incrementing: Enabled
commit-date-format: 'yyyy-MM-dd'
branches:
  master:
    tag: ''
    increment: Patch
    prevent-increment-of-merged-branch-version: true
    track-merge-target: false
    regex: ^master
    tracks-release-branches: false
    is-release-branch: false
  release:
    mode: ContinuousDelivery
    tag: beta
    increment: Patch
    prevent-increment-of-merged-branch-version: true
    track-merge-target: false
    regex: ^releases?[/-]
    tracks-release-branches: false
    is-release-branch: true
    pre-release-weight: 1000
  feature:
    tag: useBranchName
    increment: Inherit
    prevent-increment-of-merged-branch-version: false
    track-merge-target: false
    regex: ^features?[/-]
    tracks-release-branches: false
    is-release-branch: false
  pull-request:
    mode: ContinuousDelivery
    tag: PullRequest
    increment: Inherit
    prevent-increment-of-merged-branch-version: false
    tag-number-pattern: '[/-](?<number>\d+)[-/]'
    track-merge-target: false
    regex: ^(pull|pull\-requests|pr)[/-]
    tracks-release-branches: false
    is-release-branch: false
  hotfix:
    mode: ContinuousDelivery
    tag: beta
    increment: Patch
    prevent-increment-of-merged-branch-version: false
    track-merge-target: false
    regex: ^hotfix(es)?[/-]
    tracks-release-branches: false
    is-release-branch: false
  support:
    mode: ContinuousDelivery
    tag: ''
    increment: Patch
    prevent-increment-of-merged-branch-version: true
    track-merge-target: false
    regex: ^support[/-]
    tracks-release-branches: false
    is-release-branch: false
  develop:
    mode: ContinuousDeployment
    tag: unstable
    increment: Minor
    prevent-increment-of-merged-branch-version: false
    track-merge-target: true
    regex: ^dev(elop)?(ment)?$
    tracks-release-branches: true
    is-release-branch: false
ignore:
  sha: []
merge-message-formats: {}


INFO [01/26/20 22:13:23:28] Dumping commit graph:
INFO [01/26/20 22:13:23:45] * c7eeed9 21 minutes ago  (HEAD -> feature/fet2)
* 97227bd 46 minutes ago  (master)
* 26f8b7b 55 minutes ago
* 59ba070 60 minutes ago
* 948b86f 84 minutes ago  (origin/master, origin/HEAD)
* b45349d 87 minutes ago
* 7e48b14 2 hours ago
* 4da28e2 2 hours ago
* 0b0eabd 2 hours ago
* 8106caa 2 hours ago
* 013cbca 3 hours ago
* 5f26e19 3 hours ago  (tag: 1.0.0)
* 052b643 3 hours ago
* 0f0f4cf 6 hours ago  (tag: v0.1.0)

INFO [01/26/20 22:13:23:45] Working directory: D:\Trials\Git\GitVer\MainLineDevT1
INFO [01/26/20 22:13:23:45] IsDynamicGitRepository: False
INFO [01/26/20 22:13:23:48] Returning Project Root from DotGitDirectory: D:\Trials\Git\GitVer\MainLineDevT1\.git\ - D:\Trials\Git\GitVer\MainLineDevT1\
INFO [01/26/20 22:13:23:48] Running on Windows.
INFO [01/26/20 22:13:23:48] Project root is: D:\Trials\Git\GitVer\MainLineDevT1\
INFO [01/26/20 22:13:23:48] DotGit directory is: D:\Trials\Git\GitVer\MainLineDevT1\.git
INFO [01/26/20 22:13:23:69] Using latest commit on specified branch
INFO [01/26/20 22:13:23:71] Begin: Attempting to inherit branch configuration from parent branch
  INFO [01/26/20 22:13:23:72] Begin: Finding branch source of 'feature/fet2'
    INFO [01/26/20 22:13:23:75] Begin: Finding merge base between 'feature/fet2' and 'master'.
      INFO [01/26/20 22:13:23:77] Found merge base of 97227bd0043bf85078313ea20b0b03e8e7c7263b
      INFO [01/26/20 22:13:23:78] Merge base of feature/fet2' and 'master is 97227bd0043bf85078313ea20b0b03e8e7c7263b
    INFO [01/26/20 22:13:23:78] End: Finding merge base between 'feature/fet2' and 'master'. (Took: 30.87ms)
  INFO [01/26/20 22:13:23:79] End: Finding branch source of 'feature/fet2' (Took: 67.29ms)
  INFO [01/26/20 22:13:23:79] Begin: Getting branches containing the commit '97227bd0043bf85078313ea20b0b03e8e7c7263b'.
    INFO [01/26/20 22:13:23:79] Trying to find direct branches.
    INFO [01/26/20 22:13:23:80] Direct branch found: 'master'.
  INFO [01/26/20 22:13:23:80] End: Getting branches containing the commit '97227bd0043bf85078313ea20b0b03e8e7c7263b'. (Took: 3.24ms)
  INFO [01/26/20 22:13:23:80] Found possible parent branches: master
  INFO [01/26/20 22:13:23:80] End: Attempting to inherit branch configuration from parent branch (Took: 87.76ms)
  INFO [01/26/20 22:13:23:81] Running against branch: feature/fet2 (c7eeed9e3c0cd0379804fab4c7fa137b533a5c64)
  INFO [01/26/20 22:13:23:81] Begin: Calculating base versions
    INFO [01/26/20 22:13:23:82] Fallback base version: 0.1.0 with commit count source 0f0f4cfc7313bfb24f542f33eb14486708ce97a1 (Incremented: None)
    INFO [01/26/20 22:13:23:92] NextVersion in GitVersion configuration file: 0.1.0 with commit count source External Source (Incremented: None)
    INFO [01/26/20 22:13:23:94] Git tag '1.0.0': 1.0.0 with commit count source 5f26e1972c25ee131706aaf0ab91f6bb42a41c49 (Incremented: 1.1.0)
    INFO [01/26/20 22:13:23:94] Git tag 'v0.1.0': 0.1.0 with commit count source 0f0f4cfc7313bfb24f542f33eb14486708ce97a1 (Incremented: 0.2.0)
    INFO [01/26/20 22:13:23:99] Found multiple base versions which will produce the same SemVer (1.1.0), taking oldest source for commit counting (Git tag '1.0.0')
    INFO [01/26/20 22:13:23:99] Base version used: Git tag '1.0.0': 1.0.0 with commit count source 5f26e1972c25ee131706aaf0ab91f6bb42a41c49 (Incremented: 1.1.0)
  INFO [01/26/20 22:13:23:99] End: Calculating base versions (Took: 180.31ms)
  INFO [01/26/20 22:13:23:99] Begin: Using mainline development mode to calculate current version
    INFO [01/26/20 22:13:24:01] Found possible mainline branches: master
    INFO [01/26/20 22:13:24:01] Mainline for current branch is master
    INFO [01/26/20 22:13:24:02] Found branch merge point; choosing 97227bd0043bf85078313ea20b0b03e8e7c7263b as effective mainline tip
    INFO [01/26/20 22:13:24:02] Current branch (feature/fet2) was branch from 97227bd0043bf85078313ea20b0b03e8e7c7263b
    INFO [01/26/20 22:13:24:02] Direct commit on master 013cbca52c56952a5deecdf0dcc1f0ea9fd7b9e3 incremented base versions Patch, now 1.0.1
    INFO [01/26/20 22:13:24:02] Direct commit on master 8106caa0e355d696899876bb6f96533f8421cee6 incremented base versions Patch, now 1.0.2
    INFO [01/26/20 22:13:24:02] Direct commit on master 0b0eabdf3e9be9f93b0c777c909b866c7f1b6f24 incremented base versions Patch, now 1.0.3
    INFO [01/26/20 22:13:24:04] Direct commit on master 4da28e2a2c7cf785458d94717ea54e3cda4f17c8 incremented base versions Patch, now 1.0.4
    INFO [01/26/20 22:13:24:04] Direct commit on master 7e48b14da1fdb71747174502d4f113b8b0aa7671 incremented base versions Patch, now 1.0.5
    INFO [01/26/20 22:13:24:04] Direct commit on master b45349dbc02e9dadd235669c69d1469bae6776d2 incremented base versions Patch, now 1.0.6
    INFO [01/26/20 22:13:24:04] Direct commit on master 948b86fb2d2d1c4bed0033b6670efbd036222f53 incremented base versions Minor, now 1.1.0
    INFO [01/26/20 22:13:24:04] Direct commit on master 59ba070ad8a2ada5c298aef4ca0f2a364e89248f incremented base versions Patch, now 1.1.1
    INFO [01/26/20 22:13:24:04] Direct commit on master 26f8b7b06062da0a0811d3c9a3b4ff52d4b00065 incremented base versions Patch, now 1.1.2
    INFO [01/26/20 22:13:24:04] Direct commit on master 97227bd0043bf85078313ea20b0b03e8e7c7263b incremented base versions Patch, now 1.1.3
    INFO [01/26/20 22:13:24:04] 1 commits found between 97227bd0043bf85078313ea20b0b03e8e7c7263b and c7eeed9e3c0cd0379804fab4c7fa137b533a5c64
    INFO [01/26/20 22:13:24:05] Performing Patch increment for current branch
  INFO [01/26/20 22:13:24:05] End: Using mainline development mode to calculate current version (Took: 52.54ms)
  INFO [01/26/20 22:13:24:05] Using branch name to calculate version tag
  INFO [01/26/20 22:13:24:05] Begin: Getting version tags from branch 'refs/heads/feature/fet2'.
  INFO [01/26/20 22:13:24:06] End: Getting version tags from branch 'refs/heads/feature/fet2'. (Took: 8.20ms)


4

1 回答 1

2

您没有mode为您的feature分支配置设置 a,因此它继承了Mainline. 在Mainline交付模式下,版本控制是基于对分支的合并计算的(通常,Mainline 仅用于master分支)。

尝试设置mode: ContinuousDeployment以达到预期的效果。

于 2020-03-10T14:02:05.930 回答