Skip to content

Commit e64ca6b

Browse files
authored
refactor(gerrit): remove deprecated source branch as hashtags support (#33329)
1 parent 05ebbf3 commit e64ca6b

File tree

6 files changed

+1
-67
lines changed

6 files changed

+1
-67
lines changed

lib/modules/platform/gerrit/client.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ describe('modules/platform/gerrit/client', () => {
102102
'footer:Renovate-Branch=dependency-xyz',
103103
{ branchName: 'dependency-xyz' },
104104
],
105-
['hashtag:sourceBranch-dependency-xyz', { branchName: 'dependency-xyz' }], // for backwards compatibility
106105
['label:Code-Review=-2', { branchName: 'dependency-xyz', label: '-2' }],
107106
[
108107
'branch:otherTarget',

lib/modules/platform/gerrit/client.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -233,16 +233,7 @@ class GerritClient {
233233
const filterState = mapPrStateToGerritFilter(searchConfig.state);
234234
const filters = ['owner:self', 'project:' + repository, filterState];
235235
if (searchConfig.branchName) {
236-
filters.push(
237-
...[
238-
'(',
239-
`footer:Renovate-Branch=${searchConfig.branchName}`,
240-
// for backwards compatibility
241-
'OR',
242-
`hashtag:sourceBranch-${searchConfig.branchName}`,
243-
')',
244-
],
245-
);
236+
filters.push(`footer:Renovate-Branch=${searchConfig.branchName}`);
246237
}
247238
if (searchConfig.targetBranch) {
248239
filters.push(`branch:${searchConfig.targetBranch}`);

lib/modules/platform/gerrit/readme.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ Support for Gerrit is currently _experimental_, meaning that it _might_ still ha
88

99
Renovate stores its metadata in the _commit message footer_.
1010

11-
Previously Renovate stored metadata in Gerrit's _hashtags_.
12-
To keep backwards compatibility, Renovate still reads metadata from hashtags.
13-
But Renovate _always_ puts its metadata in the _commit message footer_!
14-
When the Renovate maintainers mark Gerrit support as stable, the maintainers will remove the "read metadata from hashtags" feature.
15-
This means changes without metadata in the commit message footer will be "forgotten" by Renovate.
16-
1711
## Authentication
1812

1913
<figure markdown>

lib/modules/platform/gerrit/types.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ export type GerritReviewersType = 'REVIEWER' | 'CC' | 'REMOVED';
3434

3535
export interface GerritChange {
3636
branch: string;
37-
/**
38-
* for backwards compatibility
39-
*/
40-
hashtags?: string[];
4137
change_id: string;
4238
subject: string;
4339
status: GerritChangeStatus;

lib/modules/platform/gerrit/utils.spec.ts

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -184,47 +184,6 @@ describe('modules/platform/gerrit/utils', () => {
184184
});
185185
expect(utils.extractSourceBranch(change)).toBe('renovate/dependency-1.x');
186186
});
187-
188-
// for backwards compatibility
189-
it('no commit message but with hashtags', () => {
190-
const change = partial<GerritChange>({
191-
hashtags: ['sourceBranch-renovate/dependency-1.x'],
192-
});
193-
expect(utils.extractSourceBranch(change)).toBe('renovate/dependency-1.x');
194-
});
195-
196-
// for backwards compatibility
197-
it('commit message with no footer but with hashtags', () => {
198-
const change = partial<GerritChange>({
199-
hashtags: ['sourceBranch-renovate/dependency-1.x'],
200-
current_revision: 'abc',
201-
revisions: {
202-
abc: partial<GerritRevisionInfo>({
203-
commit: {
204-
message: 'some message...',
205-
},
206-
}),
207-
},
208-
});
209-
expect(utils.extractSourceBranch(change)).toBe('renovate/dependency-1.x');
210-
});
211-
212-
// for backwards compatibility
213-
it('prefers the footer over the hashtags', () => {
214-
const change = partial<GerritChange>({
215-
hashtags: ['sourceBranch-renovate/dependency-1.x'],
216-
current_revision: 'abc',
217-
revisions: {
218-
abc: partial<GerritRevisionInfo>({
219-
commit: {
220-
message:
221-
'Some change\n\nRenovate-Branch: renovate/dependency-2.x\nChange-Id: ...',
222-
},
223-
}),
224-
},
225-
});
226-
expect(utils.extractSourceBranch(change)).toBe('renovate/dependency-2.x');
227-
});
228187
});
229188

230189
describe('findPullRequestBody()', () => {

lib/modules/platform/gerrit/utils.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,6 @@ export function extractSourceBranch(change: GerritChange): string | undefined {
101101
}
102102
}
103103

104-
// for backwards compatibility
105-
sourceBranch ??= change.hashtags
106-
?.find((tag) => tag.startsWith('sourceBranch-'))
107-
?.replace('sourceBranch-', '');
108-
109104
return sourceBranch ?? undefined;
110105
}
111106

0 commit comments

Comments
 (0)