mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-03 23:56:44 +02:00
feat(git): allow cherry-pick to suppress tag altogether
This commit is contained in:
@@ -201,6 +201,27 @@ describe('Git Graph diagram', () => {
|
||||
{}
|
||||
);
|
||||
});
|
||||
it('11: should render a gitgraph with cherry pick commit with no tag', () => {
|
||||
imgSnapshotTest(
|
||||
`
|
||||
gitGraph
|
||||
commit id: "ZERO"
|
||||
branch develop
|
||||
commit id:"A"
|
||||
checkout main
|
||||
commit id:"ONE"
|
||||
checkout develop
|
||||
commit id:"B"
|
||||
checkout main
|
||||
commit id:"TWO"
|
||||
cherry-pick id:"A" tag: ""
|
||||
commit id:"THREE"
|
||||
checkout develop
|
||||
commit id:"C"
|
||||
`,
|
||||
{}
|
||||
);
|
||||
});
|
||||
it('11: should render a simple gitgraph with two cherry pick commit', () => {
|
||||
imgSnapshotTest(
|
||||
`
|
||||
|
@@ -429,6 +429,8 @@ By default, the cherry-picked commit from commit with id `A` will be labeled `ch
|
||||
commit id:"C"
|
||||
```
|
||||
|
||||
To suppress the tag entirely, use `tag:""` (empty string).
|
||||
|
||||
## Gitgraph specific configuration options
|
||||
|
||||
In Mermaid, you have the option to configure the gitgraph diagram. You can configure the following options:
|
||||
|
@@ -262,6 +262,10 @@ export const cherryPick = function (sourceId, targetId, tag) {
|
||||
log.debug('Entering cherryPick:', sourceId, targetId, tag);
|
||||
sourceId = common.sanitizeText(sourceId, configApi.getConfig());
|
||||
targetId = common.sanitizeText(targetId, configApi.getConfig());
|
||||
|
||||
if (tag === 'cherry-pick:<id>') {
|
||||
tag = 'cherry-pick:' + sourceCommit.id;
|
||||
}
|
||||
tag = common.sanitizeText(tag, configApi.getConfig());
|
||||
|
||||
if (!sourceId || typeof commits[sourceId] === 'undefined') {
|
||||
@@ -330,7 +334,7 @@ export const cherryPick = function (sourceId, targetId, tag) {
|
||||
parents: [head == null ? null : head.id, sourceCommit.id],
|
||||
branch: curBranch,
|
||||
type: commitType.CHERRY_PICK,
|
||||
tag: tag ? tag : 'cherry-pick:' + sourceCommit.id,
|
||||
tag: tag,
|
||||
};
|
||||
head = commit;
|
||||
commits[commit.id] = commit;
|
||||
|
@@ -117,7 +117,7 @@ branchStatement
|
||||
;
|
||||
|
||||
cherryPickStatement
|
||||
: CHERRY_PICK COMMIT_ID STR {yy.cherryPick($3, '', '')}
|
||||
: CHERRY_PICK COMMIT_ID STR {yy.cherryPick($3, '', 'cherry-pick:<id>')}
|
||||
| CHERRY_PICK COMMIT_ID STR COMMIT_TAG STR {yy.cherryPick($3, '', $5)}
|
||||
| CHERRY_PICK COMMIT_TAG STR COMMIT_ID STR {yy.cherryPick($5, '', $3)}
|
||||
;
|
||||
|
Reference in New Issue
Block a user